Build a Medication List

Medication data in HIEBus may come from several types of data sources including prescriptions (from EMRs like Epic and Cerner), pharmacy claims (from payor systems), and pharmacy fills (from networks like Surescripts or pharmacy benefits managers like CVS/CareMark). To build as comprehensive a medication list as possible, you can aggregate data from multiple FHIR resources and use ValueSets to consolidate into a single list organized by generic ingredients.

Querying for Medications

Retrieve medication data from 3 FHIR resources:

Summarizing a Medication List

Many clinical use cases require a single med list summarized by medication irrespective of different brands, formulations, and dosages. To create a single med list from the set of data returned above, group meds by generic ingredient.

  1. Use the $classify operation with version=RxNorm – Multi Ingredient for the RxNorm code for each medication (use codes where system=
  2. Medications can then be grouped by ingredient (the resulting ValueSet names) or by date (fill date and/or order date).

For example, here 4 MedicationDispense rows (shown as ‘Fill’) and 1 MedicationRequest row (shown as ‘Rx) have been grouped into Amoxicillin, Clavulanate (Augmentin). The grouping was found with this query:

https://[YOUR_FHIR_ENDPOINT]/ValueSet/$classify?version=RxNorm - Multi Ingredient&system=,562508

Note that there were 2 pharmacy fills returned for the same date and therefore consolidated into a single row as well. Also note that Augmentin is the brand name of the medication, shown here in parentheses to indicate that the branded version was filled.

Real-World Data Considerations

  • Medication name
    • Whenever possible, HIEBus maps all medications to RxNorm
    • To make use of RxNorm reference mapping, we recommend doing the following to populate user display:
      • First, use medicationCodeableConcept.coding.code.display where userselected=false AND system=
      • If RxNorm mapping is unavailable, use medicationCodeableConcept.coding.text
  • Frequency/Dosing information
    • Pharmacy claims (retrieved from the MedicationDispense) resource do not typically contain frequency (e.g., ‘take every 12 hours’) but rather typically contain days supply and quantity (from which frequency could roughly be calculated).
    • On the other hand, prescriptions (retrieved from the MedicationRequest resource) do not contain evidence that the med was actually filled by a pharmacy or picked up by the patient, but may contain frequency (e.g., ‘take 3 times a day with meals) – However the frequency is often in the text description and NOT in the discrete frequency field.
  • Generic vs Branded - The $classify operation can be used to determine if a medication is generic or branded.
    • Call https://[YOUR_FHIR_ENDPOINT]/ValueSet/$classify?version=RxNorm - Brands&system= for the RxNorm code for each medication.
    • If an RxNorm code is for a generic medication, no brands will be returned. If it is for a branded medication, the ValueSet name will be the medication’s brand name.
  • Strength - Pharmacy claim data returned in EOBs have strength populated in an extension (explanationofbenefits.item.extension('’)).
  • Ordering Clinician - The clinician who prescribed a medication, if available, will be found in
    • MedicationDispense.extension('')
    • MedicationRequest.requester
    • MedicationAdministration.request
      • which gives a Reference(MedicationRequest.requester)
  • Pharmacy - The pharmacy which filled a medication, if available, will be found in
    • Not applicable to MedicationDispense
  • Diagnosis - Rarely populated in real world medication data.