<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nico Vignola</title>
    <description>The latest articles on Forem by Nico Vignola (@nvignola).</description>
    <link>https://forem.com/nvignola</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F98319%2F7ae767b0-e3b6-4bca-83d5-f53b976a33c9.jpeg</url>
      <title>Forem: Nico Vignola</title>
      <link>https://forem.com/nvignola</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nvignola"/>
    <language>en</language>
    <item>
      <title>Helping patients to get their medicine - Twilio x DEV Hackathon submission</title>
      <dc:creator>Nico Vignola</dc:creator>
      <pubDate>Wed, 29 Apr 2020 21:27:41 +0000</pubDate>
      <link>https://forem.com/nvignola/helping-patients-to-get-their-medicine-dev-hackathon-project-4ak7</link>
      <guid>https://forem.com/nvignola/helping-patients-to-get-their-medicine-dev-hackathon-project-4ak7</guid>
      <description>&lt;h4&gt;
  
  
  Link to Code
&lt;/h4&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/nvignola" rel="noopener noreferrer"&gt;
        nvignola
      &lt;/a&gt; / &lt;a href="https://github.com/nvignola/kuracado" rel="noopener noreferrer"&gt;
        kuracado
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Kuracado - The treatment app
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/nvignola/kuracadoassets/kuracado.png"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fnvignola%2Fkuracadoassets%2Fkuracado.png" alt="Kuracado logo" width="100%"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Kuracado&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Helping patients to get their medicine. Project for Dev.to - Twilio hackathon.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;About&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Its goal is to facilitate the process of getting the receipt from the doctor and sequentially getting the medicine from the pharmacy.&lt;/p&gt;
&lt;p&gt;Kuracado offers a dashboard through which the doctor can communicate and put in communication the patients, and the pharmacy. It offers also a shipping monitoring when the pharmacy sends the medicine to the patient.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;How it works&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;This application is a demo that assumes the existence of an actual database containing all the data regarding the actors involved in the system.&lt;/p&gt;
&lt;p&gt;Every time a user sends a message to the WhatsApp Sandbox, the webhook is called and the server collects the data.
The application uses the AJAX polling technique to continuously fetch new messages from the server.&lt;/p&gt;
&lt;p&gt;Once the receipt is ready and transformed from HTML code to an image, it is sent to…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/nvignola/kuracado" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h4&gt;
  
  
  Category Submission:
&lt;/h4&gt;

&lt;p&gt;COVID-19 Communications&lt;/p&gt;

&lt;h2&gt;
  
  
  The starting point
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Kuracado&lt;/em&gt; - Esperanto for 'treatment'. &lt;br&gt;
I had the idea for this app after what happened to me. Three months ago I had to do invasive heart surgery. When back home, I couldn't go out anymore, first because I was too weak due to the surgery and the long convalescence period and second because of the coronavirus.  &lt;/p&gt;

&lt;p&gt;I needed medicine for my anticoagulation therapy. I called the doctor and he shipped the receipt at my place, which took 4 days to arrive. But then I had to face another challenge, go to the pharmacy to get the pills.&lt;/p&gt;

&lt;p&gt;Not an ideal situation, considering that I can't go out and that I'm living on the 5th floor without an elevator. It is a good training session though.&lt;/p&gt;

&lt;p&gt;How can we handle these situations? Building a tool where patients, doctors, and pharmacies are connected.&lt;/p&gt;

&lt;h2&gt;
  
  
  Brick by brick
&lt;/h2&gt;

&lt;h3&gt;
  
  
  αlpha stage
&lt;/h3&gt;

&lt;p&gt;So, the idea is to connect them, but how?&lt;br&gt;
The application I thought about should allow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a patient to send messages to the doctor&lt;/li&gt;
&lt;li&gt;the pharmacy:

&lt;ul&gt;
&lt;li&gt;to receive messages from the doctor&lt;/li&gt;
&lt;li&gt;to text the patient when the medication has been sent&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;the doctor to write receipts and text the patient and the pharmacy
This way it is assured that every piece is connected and that they can communicate. &lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5uxxfhsjjih7hvaqioqt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5uxxfhsjjih7hvaqioqt.png" alt="Behind the scene"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are curious and you want to see it in action, check out the video&lt;/p&gt;

&lt;p&gt;The main control resides in the dashboard that is managed by the doctor. Here he/she can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;receive the messages in realtime from the patients&lt;/li&gt;
&lt;li&gt;write the receipt&lt;/li&gt;
&lt;li&gt;send the receipt to the patient and the pharmacy&lt;/li&gt;
&lt;li&gt;monitor the status of the shipment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the message part, SMS came in my mind first. Thing is that I wanted to send the receipt as an image or a pdf.&lt;br&gt;
I've tested the MMS but my phone didn't handle it as expected, the content was blocked (probably because I'm living in Germany for three years and I still use my Italian contract). Turned out that I also pay 0.50€ for every MMS I received 🤯.&lt;br&gt;
What now? I've found the solution that fits my needs looking at Twilio's products: &lt;strong&gt;Whatsapp Sandbox&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;Now it is time to put everything together.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚠️ Disclaimer ⚠️
&lt;/h3&gt;

&lt;p&gt;All the data that are displayed (names, addresses, etc...) are randomly generated using &lt;a href="https://github.com/marak/Faker.js/" rel="noopener noreferrer"&gt;Faker.js&lt;/a&gt;.&lt;br&gt;
The phone numbers are hidden for privacy reasons.&lt;br&gt;
This project is a demo that assumes the existence of an actual database containing all the data regarding the actors (doctors, patients and pharmacies) involved in the system.&lt;/p&gt;

&lt;h3&gt;
  
  
  ßeta stage
&lt;/h3&gt;

&lt;p&gt;The application is divided into two parts, client and server.&lt;br&gt;
Tech stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js web server using &lt;a href="https://npm.im/express" rel="noopener noreferrer"&gt;Express.js&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Web user interface using &lt;a href="https://npm.im/vue" rel="noopener noreferrer"&gt;Vue&lt;/a&gt; along with &lt;a href="https://npm.im/vue" rel="noopener noreferrer"&gt;Bootstrap Vue&lt;/a&gt; for the UI components&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://parceljs.org/" rel="noopener noreferrer"&gt;Parcel&lt;/a&gt; bundler&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Archiving realtime messaging
&lt;/h4&gt;

&lt;p&gt;WebSocket API right? Nope. For this, I've opted for an AJAX polling. For the sake of simplicity and time constraints, I've avoided configuring the server to receive WS connection. The AJAX polling accomplishes what is needed.&lt;br&gt;
Here is what happens behind the scene:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fijnbp3a6xyo5fxznxbla.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fijnbp3a6xyo5fxznxbla.png" alt="Polling messages"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  One sandbox to rule them all
&lt;/h4&gt;

&lt;p&gt;I've been using only one Whatsapp sandbox. To let communicate the pharmacy with the client I had to use the sandbox as a proxy. So actually when a message is received, the server checks the phone number and if it matches the pharmacy one, it sends the message to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxi9e2z0t9jose82ekab6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxi9e2z0t9jose82ekab6.png" alt="Phone views. Patient + Pharmacy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  "Printing" the receipt
&lt;/h4&gt;

&lt;p&gt;At this point, the doctor is going to send the receipt to both patient and pharmacy. In the beginning, I've thought to send a PDF. There are many JS libraries for this purpose, but I wanted something easy to configure and use. &lt;br&gt;
I have started thinking to create an extra page in which I could have built the receipt template with Html and then take a screenshot of the page (with Puppeteer).&lt;br&gt;
This option was causing too much overhead. Luckily this world is populated by amazing people, and I've found the solution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/frinyvonnick/node-html-to-image" rel="noopener noreferrer"&gt;https://github.com/frinyvonnick/node-html-to-image&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And...(Ta-Da! 🎊)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvzrd5fahnikbhq3xng67.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvzrd5fahnikbhq3xng67.png" alt="The 'printed' receipt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Status update
&lt;/h4&gt;

&lt;p&gt;The last features I've implemented are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;showing if a patient already received the receipt&lt;/li&gt;
&lt;li&gt;showing if the pharmacy shipped the medicine&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both of those features happen in realtime. The first one when the doctor sends the receipt and the system transforms the HTML code to image. The second one when the pharmacy text the patient.&lt;br&gt;
In the following animated gif, it is possible to see the icons change in action.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuccuveqouguywnl2y2p9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuccuveqouguywnl2y2p9.gif" alt="Updating the status of the receipt and shipping"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Release 🎉
&lt;/h3&gt;

&lt;p&gt;As always, many things can be improved but the final result brings the basic functionality that I've planned in the beginning. It has been fun to work on Kuracado and I also feel emotionally attached to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh05gzsgk4nxgmk21nn3a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh05gzsgk4nxgmk21nn3a.png" alt="Kuracado Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I strongly suggest to try out the application downloading the code and playing with it.&lt;br&gt;
Otherwise, to get a general idea of how the app works, check out this video:&lt;/p&gt;

&lt;h4&gt;
  
  
  Demo
&lt;/h4&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/sSJlsbYCp6M"&gt;
&lt;/iframe&gt;
&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Resources/Info
&lt;/h2&gt;

&lt;p&gt;Template used as a base for the receipt: &lt;a href="https://github.com/sparksuite/simple-html-invoice-template" rel="noopener noreferrer"&gt;https://github.com/sparksuite/simple-html-invoice-template&lt;/a&gt;&lt;br&gt;
Library to transform HTML to image: &lt;a href="https://github.com/frinyvonnick/node-html-to-image" rel="noopener noreferrer"&gt;https://github.com/frinyvonnick/node-html-to-image&lt;/a&gt;&lt;br&gt;
All the schema are built with &lt;a href="https://excalidraw.com/" rel="noopener noreferrer"&gt;https://excalidraw.com/&lt;/a&gt;&lt;br&gt;
The icon pharmacy is from svgrepo: &lt;a href="https://www.svgrepo.com/svg/102720/pharmacy" rel="noopener noreferrer"&gt;https://www.svgrepo.com/svg/102720/pharmacy&lt;/a&gt;&lt;br&gt;
The song of the video is from Bensound: &lt;a href="https://www.bensound.com/royalty-free-music/track/ukulele" rel="noopener noreferrer"&gt;https://www.bensound.com/royalty-free-music/track/ukulele&lt;/a&gt;&lt;br&gt;
Data (names, address, etc...) is randomly generated with &lt;a href="https://github.com/marak/Faker.js/" rel="noopener noreferrer"&gt;Faker.js&lt;/a&gt;&lt;/p&gt;

</description>
      <category>twiliohackathon</category>
    </item>
  </channel>
</rss>
