Oystehr
eRx
Create Prescriptions
🚧

The eRx Service is currently in beta.

Prescribing

The eRx Service allows you to prescribe medications to your patients via an embedded or popped-out UI. The details of these prescriptions are synced back into the FHIR service in the form of MedicationRequest (opens in a new tab), MedicationDispense (opens in a new tab), and MedicationStatement (opens in a new tab) resources.

Getting Started

To prescribe medications, you'll need to use the Oystehr eRx service to generate an SSO URL and either pass that to an iframe or open it in a new window.

First use the SDK to create an SSO link for a provider that has been set up in the eRx service:

import Oystehr from '@oystehr/sdk';
 
const oystehr = new Oystehr({
  accessToken: '<your_access_token>',
});
 
const ssoLink = await oystehr.erx.connectPractitioner();

You can then use this link to open the eRx service in a new window or an iframe:

const ssoLink = await oystehr.erx.connectPractitioner();
 
// Open the link in a new window
window.open(ssoLink, '_blank').focus();
 
// Or use it in an iframe
const iframe = document.createElement('iframe');
iframe.src = ssoLink;
iframe.width = '100%';
iframe.height = '100%';
document.body.appendChild(iframe);

The first time a provider authenticates with the eRx service, they will be prompted to confirm their account and verify their identity. This is a one-time process.

You can also create a link to the prescribing page for a specific patient:

const ssoLink = await oystehr.erx.connectPatient({
  patientId: 'patient-uuid',
});

It's required that you sync your patient with the eRx service before presenting the prescribe interface to providers. For more information see patient sync.

Prescriptions on FHIR

The eRx service provides built in FHIR workflow support for the prescription and dispensing of medications.

MedicationRequest

When a medication is prescribed, a MedicationRequest (opens in a new tab) resource is created. This resource contains the details of the prescription, such as the medication, the dosage, and the patient.

Here is an example medication request:

{
    "resourceType": "MedicationRequest",
    "identifier": [
        {
            "system": "https://identifiers.fhir.oystehr.com/erx-patient-prescription-id",
            "value": "19421344"
        }
    ],
    "status": "active",
    "intent": "order",
    "subject": {
        "reference": "Patient/06d1cf3d-c33e-40d2-b6c2-191538e9bb8c"
    },
    "requester": {
        "reference": "Practitioner/3c9a43c1-00fe-432c-9782-ce876c2e5831"
    },
    "dispenseRequest": {
        "quantity": {
            "unit": "EA",
            "value": 20
        },
        "numberOfRepeatsAllowed": 2,
        "expectedSupplyDuration": {
            "code": "d",
            "system": "http://unitsofmeasure.org",
            "unit": "day",
            "value": 10
        },
        "validityPeriod": {
            "start": "2022-01-01",
            "end": "2023-01-01"
        }
    },
    "dosageInstruction": [
        {
            "patientInstruction": "Take twice daily"
        }
    ],
    "medicationCodeableConcept": {
        "coding": [
            {
                "system": "https://terminology.fhir.oystehr.com/CodeSystem/medispan-dispensable-drug-id",
                "code": "7124",
                "display": "Zestril (Lisinopril 2.5 mg) Oral tablet"
            }
        ]
    },
    "id": "1d9df545-8230-4913-a6be-90886a4abf4f",
    "meta": {
        "versionId": "a5de4dbb-e8ed-4965-806b-ffd9d8e47fe0",
        "lastUpdated": "2024-05-15T23:11:30.669Z"
    }
}

A few of these fields are worthy of note.

  • requester.reference property points to the practitioner who prescribed the medication
  • subject.reference references the patient prescribed the medication
  • medicationCodeableConcept describes the medication coding information for the drug that was prescribed
  • dispenseRequest is the information sent to the pharmacy about the quantity, timing, and refills of the prescription
  • dosageInstruction is the instructions provided to the patient
  • status can be 'active', 'completed', or 'stopped' and will update as the patient fills their medication

MedicationDispense

When the prescription is sent to the pharmacy for filling, a MedicationDispense (opens in a new tab) resource is created.

{
    "resourceType": "MedicationDispense",
    "identifier": [
        {
            "system": "https://identifiers.fhir.oystehr.com/erx-patient-prescription-id",
            "value": "19421344"
        }
    ],
    "status": "unknown",
    "subject": {
        "reference": "Patient/06d1cf3d-c33e-40d2-b6c2-191538e9bb8c"
    },
    "medicationCodeableConcept": {
        "coding": [
            {
                "system": "https://terminology.fhir.oystehr.com/CodeSystem/medispan-dispensable-drug-id",
                "code": "7124",
                "display": "Zestril (Lisinopril 2.5 mg) Oral tablet"
            }
        ]
    },
    "authorizingPrescription": [
        {
            "reference": "MedicationRequest/f176619d-08c2-4754-a9d6-ddab468b3fb1"
        }
    ],
}

Here are some note-worthy properties:

  • authorizingPrescription points back to the original prescription stored in a MedicationRequest resource
  • medicationCodeableConcept describes the medication coding information for the drug that was dispensed (note that this can theoretically be different than what was prescribed)