PillFill Rx Aggregation Service
Get your users on-boarded & engaged by importing their existing data.
It’s insanely difficult to get users on-boarded & engaged with consumer healthcare apps. (“Great, you want me to input my life story on my mobile keyboard. I’ll pass.”) First impressions are critical- You need low friction options to help your users get started with your product quickly and, just as important, to stage engaged even when the novelty starts to wane.
We created PillFill to address this very problem. We’ve now shown that with our automatic Rx import/normalization capability, our users finally have all of their medications, doctors, and pharmacies in one place with zero data entry. More importantly, it makes it possible to automatically detect and alert users about medication interactions, recalls, shortages, and even unintentional overdoses whenever a new medication becomes available.
We’re now opening up our API to help others in the consumer health space do the same thing. In this post you’ll see how our services can help your users leverage their existing pharmacy or insurance accounts to quickly import their medication, doctor, and pharmacy information directly into your application.
(Note: This explanation is intended for developers- It‘s much easier to use our PillFill Android or iOS app if you don’t speak RESTful services! Also, just to be clear, none of the healthcare providers identified or mentioned here have sanctioned this service.)
Aggregating Prescription Information
Let’s download our prescription data and see how we can make sense of it. We’ll start by POSTing a RX Aggregation Request:
{“username”: “test@walgreens.com”, “password”: “TestPassword123", “datasource”: “walgreens”, "dob":"1970-01-01"}
When you submit this request, a secure worker process preforms a one-time extraction of Rx information from the account. Neither the provided username, password, nor any personally identifiable information is retained after the process completes.
As of today, you can request aggregations on Walgreens, CVS, & Walmart pharmacies and Express Scripts (ESI), Catamaran, & Caremark insurance/PBM accounts. There’s no magic here- an existing online account is required for this to work. The username & password you submit in the aggregation request is the same used on the provider’s website.
Once you POST the request, you’ll get a status message back with a request ID that can be used to retrieve the results.
{ “taskId”: “ef26ecfa-c8dd-411c-2b1f-112bfb55655a”, “status”: “WAITING”, “rxListResult”: [], “resultCode”: 0 }
To check the progress of the request, GET the task ID from the previous message. If you submit the fictitious information from above (test@walgreens.com), you’ll get an understandable error about the account information being incorrect:
{ “taskId”: “ef26ecfa-c8dd-411c-2b1f-112bfb55655a”, “message”: “Invalid Username or Password.”, “status”: “ERROR”, “rxListResult”: [], “resultCode”: 401 }
Now, let’s try it again with a real account and a valid password. While the account data is being collected, you’ll see a PROCESSING interim result:
{ “taskId”: “ef26ecfa-c8dd-411c-2b1f–725557787a9e”, “status”: “PROCESSING”, “rxListResult”: [], “resultCode”: 0 }
The process takes about 10–30 seconds depending on how many prescriptions the account has included. You can continue polling the same URL until the process completes:
{ “taskId”: “ef26ecfa-c8dd-411c-2b1f–725557787a9e”, “status”: “COMPLETE”, “rxListResult”: [ “8422450E64F0A957E066BB31D3EEF383E78339D9F7A20E232F07787CE38E4885", “8BD59EDDAF8876D2FC745C64E0FD9F7A20EB985644E69B2C7F1D14531C0E43E2", ...
“8CFB81608422450EAA030093D682FD75A8EE9B284FFBA17D3252BCC13DE4FD24" ], “resultCode”: 200 }
Each one of the IDs in the RxListResult represents a single prescription. Congratulations! You now have your prescriptions extracted from your account. Now, to inspect the available data!
Accessing a Prescription
Accessing one of the prescriptions in the RxListResult is easy. A call to the /service/v1/prescription/{rxId} endpoint will return all of the available information about the entry:
{
“_id”: “RX-8422450E64F0A957E066BB31D3EEF383E78339D9F7A20E232F07787CE38E4885",
“rxNumber”: “901103",
“medicationName”: “TRAMADOL HCL 50 MG TABLET”,
“pharmacyStoreId”: “CVS #5295",
“daysSupply”: 30,
“quantityPerDose”: 1,
“quantityRemaining”: 120,
“dosesPerDay”: 4,
“frequency”: 15,
“isOtc”: false,
“dispenseDate”: “2014–08–14",
“computedInactiveAfterDate”: “2014–09–14",
“previousDispenseDates”: [ “2014–08–14" ],
“prescriber”: “JAMES SMITH”,
“prescriberNPI”: “1011778276",
“quantity”: “120",
“sig”: “TAKE 1 TABLET BY MOUTH EVERY 6 HOURS AS NEEDED.”,
“ndc”: “00093005805",
“rxNormId”: “835603",
“ndfrtNui”: “N0000160641",
“ndfrtName”: “TRAMADOL HCL 50MG TAB”,
“drugImageUrl”: “https://www.cvs.com/webcontent/images/drug/DrugItem_7191.JPG", “splId”: “6D3B4049–2BFD-4874-B984–8FB231BFF27C”,
“doseType”: “Tab”,
“source”: “CVS”,
“uuid”: “8422450E64F0A957E066BB31D3EEF383E78339D9F7A20E232F07787CE38E4885" }
More information about the various fields here is available in the prescription model documentation. This is a great start- We’ll get into how to use the Drug Information Service to get additional information about the drug, the generic form, and active ingredients in the next post.