eRx
Medication Search
🚧

The eRx Service is currently in beta.

Medication Search

Medication search allows you to search by name or code. Searching for medications is essential for recording patient medication history such that the eRx service can protect patients from drug interactions. In this guide, we'll cover the basic functionality of medication search as well as a recommended approach for how and when to use medication search in your EHR.

Access Policy

To search for medications, your user needs to have the following access policy:

{
  "rule": [
    {
      "action": "eRx:SearchMedication",
      "resource": "eRx:Medication",
    },
  ],
}

Code Examples

Here is an example of how to search for medications. Note the usage of after and first, these parameters will return the first 10 results back, starting with the medication after id 'med_01HQY2N8PCWKQVZC7GQXEF0Z86'. These parameters are optional and will default to the first 10 medications.

medication-search-by-name.ts
import zapehr from '@zapehr/sdk';
 
zapehr.init({
  ZAPEHR_ACCESS_TOKEN: "<your_access_token>",
});
 
const { medications } = await zapehr.project.erx.medicationSearch({
  name: 'lisinopril',
  after: 'med_01HQY2N8PCWKQVZC7GQXEF0Z86',
  first: 10,
});

You can also search by code.

medication-search-by-name.ts
import zapehr from '@zapehr/sdk';
 
zapehr.init({
  ZAPEHR_ACCESS_TOKEN: "<your_access_token>",
});
 
const { medications } = await zapehr.project.erx.medicationSearch({ code: '104375' });

Example 200 response:

{
    "medications": [
        {
            "id": "med_01HQY2N8F35Q3GX20XD5878KCD",
            "name": "Zestril (Lisinopril 2.5 mg) Oral tablet",
            "codes": {
                "rxcui": "104375",
                "productNDC": null,
                "packageNDC": null,
                "SKU": null,
                "HCPCS": null
            },
            "type": "RX",
            "concept": "DRUG",
            "schedule": null,
            "controlled": false,
            "brandName": "Zestril",
            "genericName": "Lisinopril",
            "strength": "2.5 mg",
            "form": "tablet",
            "manufacturer": null,
            "description": null
        }
    ]
}

Using Medication Search with the eRx Service

To receive medication interaction alerts for a patient's medication history, you'll need to have explicitly synced that medication for a given patient. So, the expected workflow for adding to the patient's medication history looks like this:

  1. Search for a medication
  2. From the search results, choose the identifier of the correct medication
  3. Create a MedicationStatement (opens in a new tab) FHIR resource for this patient. For a code sample of how to create this resource, see the patient sync documentation.
  4. Sync the patient

Once these steps are completed, the eRx service will be aware of the new medication in the patient's medication history and prescriptions to this patient will correctly detect drug interactions.