eRx
Medication Search
🚧

The eRx Service is currently in beta.

Medication Search

Medication search allows you to search by name or National Drug 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, this example uses medicationSearchV2. The original version is still accessible as shown in our API documentation (opens in a new tab), but will be removed in a future version of Oystehr.

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

You can also search by National Drug Code (NDC) (opens in a new tab).

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

Example 200 response:

{
    "medications": [
        {
            "id": "med_01J8G9NYBGNS1K9XY2EB4K7B9T",
            "name": "Tylenol 8 Hour Arthritis Pain Oral Tablet Extended Release 650 MG",
            "codes": {
                "productNDC": "00045-0838-24"
            },
            "type": "OTC",
            "schedule": "UNCONTROLLED",
            "controlled": false,
            "strength": "650 MG",
            "form": "Tablet Extended Release"
        }
    ]
}

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.