Medication History
The eRx Service provides access to a patient's medication history as sourced from insurance claims. This allows you to view the medications a patient has been prescribed and had filled outside of your application.
Medication history can be retrieved without enrolling users in the eRx service.
This page describes how to use the eRx Service directly to query medication history. Medication history can also be viewed during the ePrescribing workflow on DoseSpot.
Access Policy
To retrieve medication history, your user needs to have the following minimum access policy:
{
"rule": [
{
"action": "eRx:GetMedicationHistory",
"resource": "eRx:Patient",
"effect": "Allow"
},
]
}Sync Patient Data
Prior to querying medication history, you must first sync patient data with the eRx Service. This ensures that the patient's demographic information has been synchronized with the upstream eRx provider.
Query Medication History
Once patient data has been synced, you can retrieve the patient's medication history:
import Oystehr from '@oystehr/sdk';
import { Patient } from 'fhir/r4b';
const patientId = '<your_fhir_patient_id>';
const oystehr = new Oystehr({ accessToken: '<your_access_token>' });
await oystehr.erx.syncPatient({ patientId });
const medicationHistory = await oystehr.erx.getMedicationHistory({ patientId });