Golang, email generation, postgresql and a bit of S3
$250-750 AUD
Terminado
Publicado hace alrededor de 4 años
$250-750 AUD
Pagado a la entrega
You will be working on a program that helps in teledentistry. Patients
send us images, it goes through our processing pipeline and we make
some other images from it. You will be writing the program
(/usr/local/bin/composer) that takes the processed images and sends them
on to the dentist.
There will be a configuration file in the home directory of the user
the program runs as which contains the database connectivity details,
and an s3 path to put the generated emails. You read this with viper.
There will also be AWS credentials in the user's home directory so
that you can use the ordinary AWS golang APIs to access files from s3.
Developer needs to know something about the SMTP and raw email creation (adding attachments and that sort of thing) programmatically.
The program you will be writing can be invoked in one of three ways
/usr/local/bin/composer
/usr/local/bin/composer -a
/usr/local/bin/composer -m {message_id}
If it is the first version (with no arguments given), then it runs
select message_id from ready_for_reply order by random()
and iterates through that list of message_ids, stopping after 59 seconds have elapsed.
If it is the second version (with -a) then it starts a transaction and
runs the same query but doesn't stop after 59 seconds -- it just keeps
going until it is finished.
If it is the third version, it just operates on that one message id.
For each message, it begins a transaction and runs
select from_field, to_field, subject, number_of_images, plaintext_body, replied
from email_headers_received for update;
It does a sanity check on 'replied' (it should be false) and remembers those other
fields for later.
It's possible that there are no images, in which case the body of the composed
email should say "The following email was received by {to_field} from {from_field} and had no
images in it{plaintext_body}"
Otherwise, the images can be found by running this query...
select image_id, cropped_version_s3_path from images_received where
source_email = {message_id};
... and then fetching the images from s3.
The composed email body should then say "The following email was received by {to_field} from {from_field} and had {number_of_images} attached.{plaintext_body}". Then the emails
themselves should be attached: they images will be on s3 in the location given
by cropped_version_s3_path.
The subject line of the email is {subject}.
The email is sent to
select imagery_destination_email
from clinics inner join clinic_emails_received using(clinic_id)
where message_id = {message_id}
The generated email gets stored in s3://{generated_emails_bucket}/{message_id} --
{generated_emails_bucket} is defined in the config file.
There will be a copy of postfix running on the box which can then be
used to deliver the mail, so ordinary local mail sending will work
and/or using localhost as the SMTP server will work.
If all this has worked, then run
insert into email_replies (source_message, s3_path) values
({message_id}, s3://{generated_emails_bucket}/{message_id});
update email_headers_received set replied = true where message_id = {message_id}
And finally -- if everything has worked, commit the transaction.
Otherwise, abort the transaction and exit with an error message and suitable error code.
Relevant schema:
create table if not exists email_headers_received (
message_id uuid unique,
from_field varchar not null,
to_field varchar not null,
subject varchar not null,
plaintext_body varchar,
number_of_images int not null
replied boolean default false
);
create table clinics (
clinic_id uuid primary key,
imagery_destination_email varchar not null,
);
create table ready_for_reply (message_id uuid);
create table email_replies (
source_message uuid references raw_emails_received unique,
s3_path varchar not null unique,
when_sent timestamp default timenow()
);
create table images_received (
image_id uuid primary key,
cropped_version_created boolean,
cropped_version_s3_path varchar
);
Hi there,
First of all project requirements are described very well i must appreciate that it is very good detailed.
I am professional Web-app Architect. I have done implemented all aspects in your requirement details in other projects
My last and one ongoing project are best matching to your requirements partially
1) [login to view URL]
Here i implemented all email related apis , user can connect his own email account ("SMTP", GMAIL, Live, Zoho, Send-grid) can send and receive email with attachments also forward them , this application can also parse email and extract information to store in database, some automated actions can crate and send email automatically.
All attachments and HTML email are saved on S3 storage in well formatted folder structure with strong encrypted and permission based architect it utilize aws server behind load balencer , MySQL server , now a days Amazon Aurora, Multi region Database server architecture at full potential
2) [login to view URL]
Here i auto generate web-pages for non technical user automatically based in information filled in account form . Auto generated emails are sent to user on few events . it utilize go-lang Templates very intensively to auto generate webpage for user and catch them.
So basically I am perfect choice if you want to play with SMTP, S3, and MySQL in golang. and call server app from command line
Have a chat with me to know more and fix the price.
$250 AUD en 5 días
5,0 (2 comentarios)
2,7
2,7
8 freelancers están ofertando un promedio de $519 AUD por este trabajo
Hey there,
We'll use the AWS SDK for GO to connect to the S3 to put the generated emails.
We will also use the database/sql GO package to connect to postgresql and select/insert the necessary data.
Creating a RAW Email is very easy, we'll use TextProto or something similar to it which "implements generic support for text-based request/response protocols in the style of HTTP, NNTP, and SMTP"
This shouldn't take longer than 3 days and I'll do my best to deliver perfection.
Thanks for reading,
Mario A.
Hello Greg. I can work on your composer script to send emails to dentists after the whole pipeline has run and cropped image has been created. Please contact me for further discussion.
What purpose of making query less efficient query with random() if you anyway want to break transaction after 59 sec and ordering of records is not important?