This site uses cookies and by using the site you are consenting to this. We utilize cookies to optimize our brand’s web presence and website experience. To learn more about cookies, click here to read our privacy statement.

Pharmacy Rx for Efficiency and Savings: An Event-Driven, Serverless Application

A group of people in a pharmacy.

A full-service pharmacy, divvyDOSE, delivers pre-dosed prescriptions directly to consumers needed a new reporting system. To be more precise, they needed 50 new reporting systems –one for each state in the US. SPR successfully automated divvyDOSE’s state reporting processes, while minimizing computing costs, by implementing an event-based serverless architecture.


All pharmacies in all states are required to submit reports on dispensed controlled substances to a state-run prescription monitoring program (PMP). The PMP reports are required to be in a state-specific, asterisk-separated format called ASAP. While there are three basic ASAP formats, each state has different requirements for the drugs to be reported as well as different requirements for specific information to be included in each report ­– thereby necessitating fifty individual ASAP formats.

SPR was enlisted to develop a user-friendly administrative application to harvest prescription transaction information from divvyDOSE, filter the transactions by state, by required drugs to be reported, and by required reporting information fields, convert the filtered transactions to the state-specified ASAP format, and then securely transfer the ASAP files to each state.


Prior to this project, the client was manually generating ASAP reports, an effort that was incredibly labor intensive and costly. The client subject matter experts were spending too much time on the process and not enough time moving their business forward. The goal was to automate generation and submission of the ASAP reports in order to save money and be better able to allocate labor resources to other business areas.

SPR worked with divvyDOSE’s program manager, SME and engineering resource to help define an architecture and implementation based on very high-level requirements.  The result was an event-driven architecture utilizing many of the AWS services to make the operational overhead minimal and allow the SMEs to focus on the accuracy of the report content instead of the report generation.


After careful study, SPR recommended an event-driven serverless application that allowed the client to automate their PMP reporting process, thereby reducing and reallocating labor costs to other business areas. In addition, by employing an event-driven serverless application structure, SPR assisted divvyDOSE in reducing expenditures on servers and compute time. divvyDOSE has been positive and enthusiastic about the overall outcome of the project.

AWS tools used in this project include S3, CloudWatch, SQS, RDS (Postgres), DynamoDB, EC2, and Lambdas with a Python 3.6 runtime. The admin app was written using Python 3.6, Flask, and Vue.js. Terraform was used for infrastructure and deployment automation.