Modeling a Formulary | Medplum

Medication Formulary Guide

A "formulary" refers to a catalog of drugs offered by your organization. When implementing a custom EMR, Digital Health clinical administrators often curate a formulary of relevant drugs, along with relevant metadata, to assist prescribing physicians, pharmacists, and patients.

This guide covers the basics of how to use the MedicationKnowledge resource, which represents a type of medication that can be ordered. It will cover:

This guide is informed by the DaVinci Payer Data Exchange (PDex) US Drug Formulary implementation guide, which was authored by industry leaders, including Humana, Cigna, and Optum.

Medication Code

When defining MedicationKnowledge.code, it's highly recommended to use RxNorm as the primary coding system. RxNorm is an international standard that normalizes drug names from many different data sources.

RxNorm has codes for medications with different levels of specificity, called "term types". Refer to our RxNorm guide for a detailed understanding of the term-type hierarchy.

The Da Vinci formulary guide recommends using the following term type when creating a formulary to achieve the appropriate level of specificity:

Term Types Requirement Example RxCUI
Semantic Clinical Drug (SCD)
Semantic Branded Drug (SBD)
Generic Pack (GPCK)
Branded Pack (BPCK)
Required acetaminophen 325 MG / oxycodone hydrochloride 5 MG Oral Tablet
[Percocet] 1049640
Semantic Clinical Drug Form (SCDG)
Semantic Branded Drug Form Group (SBDG)
Optional Percocet Pill 1185784

You can use the RxNav browser to search for RxNorm codes for your formulary.

Below is an example MedicationKnowledge with both SBD and SBDG codes:

{
  resourceType: "MedicationKnowledge",
  code: {
    coding: [
      {
        system: "http://www.nlm.nih.gov/research/umls/rxnorm",
        code: "1049640",
        display: "acetaminophen 325 MG / oxycodone hydrochloride 5 MG Oral Tablet [Percocet]"
      },
      {
        system: "http://www.nlm.nih.gov/research/umls/rxnorm",
        code: "1185784",
        display: "Percocet Pill"
      }
    ]
  }
}

Branded vs. Generic Medications

RxNorm term types SBD, BPCK, and SBDG all refer to specific brand names for a given drug. Including branded drugs in your formulary indicates that physicians may only prescribe a specific brand.

In contrast, using generic term types (SCD, GPCK, SCDG) indicates that physicians may prescribe any brand of the medication.

Prescribable vs. Dispensable Medications

While most Medplum applications will include either generic or branded versions of a medication, some advanced implementations may include both. This is especially common with providers that own their own pharmacy.

In these implementations, generic codes would be used by physicians to prescribe the medication, whereas pharmacies branded medications would be used to dispense the medication. See Medication Relationships for details on how to represent the link between branded and generic MedicationKnowledge resources.

Medication Characteristics

The MedicationKnowledge resources can also be used to store details about the physical characteristics of a medication, as well as its packaging and form.

The table below summarizes the most important medication metadata elements.

Element Description Relevant Valueset
drugCharacteristics Physical characteristics of the medication (color, shape, imprint, etc.) Medication knowledge characteristic code
doseForm Physical form of the drug (pill, powder, liquid, etc.) SNOMED Form Codes
packaging Description of the medication package (bottle, blister pack, etc.) MedicationKnowledge Package Type Codes
intendedRoute Method of ingestion (oral, intravenous, etc.) SNOMED Route Codes

Example of Drug Characteristics

{
  resourceType: 'MedicationKnowledge',
  code: {
    text: 'acetaminophen 325 MG [Tylenol]',
    coding: [
      {
        system: 'http://www.nlm.nih.gov/research/umls/rxnorm',
        code: '569998',
      },
      {
        system: 'http://hl7.org/fhir/sid/ndc',
        code: '5058049501',
      },
    ],
  },
  drugCharacteristic: [
    {
      type: {
        text: 'Color',
        coding: [
          {
            system: 'http://terminology.hl7.org/CodeSystem/medicationknowledge-characteristic',
            code: 'color',
          },
        ],
      },
      valueString: 'white',
    },
    {
      type: {
        text: 'Imprint Code',
        coding: [
          {
            system: 'http://terminology.hl7.org/CodeSystem/medicationknowledge-characteristic',
            code: 'imprintcd',
          },
        ],
      },
      valueString: 'Tylenol',
    },
  ],
  amount: {
    value: 100,
    unit: 'tablets',
    system: 'http://terminology.hl7.org/ValueSet/v3-UnitsOfMeasureCaseSensitive',
    code: '{tbl}'
  },
  packaging: {
    type: {
      text: 'Bottle',
      coding: [
        {
          system: 'http://terminology.hl7.org/CodeSystem/medicationknowledge-package-type',
          code: 'bot',
          display: 'Bottle',
        },
      ],
    },
    quantity: {
      value: 100,
      unit: 'tablets',
      system: 'http://terminology.hl7.org/ValueSet/v3-UnitsOfMeasureCaseSensitive',
      code: '{tbl}'
    },
  },
  doseForm: {
    coding: [
      {
        display: 'Tablet',
        code: '385055001',
        system: 'http://snomed.info/sct',
      }
    ]
  },
  intendedRoute: [
    {
      text: 'oral',
      coding: [
        {
          display: 'Oral use',
          code: '26643006',
          system: 'http://snomed.info/sct'
        }
      ]
    },
  ],
}

Classifications and Regulations

The MedicationKnowledge.productType field can be used to categorize the drug within the formulary, potentially along multiple dimensions. This field can also be used to describe:

Representing Controlled Substance Schedules

Certain medications, including narcotics, are classified into schedules based on the U.S. Controlled Substances Act (CSA). MedicationKnowledge.regulatory.schedule is used for specifying the regulatory schedule for any medications subject to these restrictions.

Refer to the HL7 Controlled Substances Schedule for an example valueset.

Compounded Medications

For medications that must be mixed before being dispensed, the MedicationKnowledge.ingredient field is used for listing ingredients of compounded medications, with RxNorm as the preferred code system for each ingredient.

The MedicationKnowledge.amount field indicates the total amount of the compound to be dispensed, and the strength of each ingredient is stored as a ratio of the total volume (e.g. 1g per 100g).

ingredient.isActive indicates which of the listed ingredients are active.

Dose Variations

For compounded medications with multiple dose variations, it's common to model a parent-child relationship where:

This hierarchical structure allows for efficient management of compound families while maintaining specific dosing information for each variation.

Example: Parent Compound Medication

{
  resourceType: "MedicationKnowledge",
  status: "active",
  ingredient: [
    {
      itemReference: {
        reference: "Substance/1234",
        display: "Semaglutide"
      },
      strength: {
        numerator: {
          value: 2.5,
          unit: "mg"
        },
        denominator: {
          value: 1
        }
      }
    },
    {
      itemReference: {
        reference: "Substance/5678",
        display: "Glycine"
      },
      strength: {
        numerator: {
          value: 5,
          unit: "mg"
        },
        denominator: {
          value: 1
        }
      }
    }
  ],
  code: {
    text: "Semaglutide 2.5 mg/mL + Glycine 5 mg/mL",
    coding: [
      {
        system: "medication-coding-system",
        code: "3099",
        display: "Semaglutide 2.5 mg/mL + Glycine 5 mg/mL"
      }
    ]
  },
  productType: [
    {
      coding: [
        {
          system: "medication-type-coding-system",
          code: "compound",
          display: "Compound"
        }
      ]
    }
  ],
  doseForm: {
    coding: [
      {
        system: "http://hl7.org/fhir/administrable-dose-form",
        code: "100000073863",
        display: "Solution for injection"
      }
    ]
  },
  relatedMedicationKnowledge: [
    {
      type: {
        coding: [
          {
            system: "compounded-medication-family",
            code: "child",
            display: "child"
          }
        ]
      },
      reference: [
        {
          reference: "MedicationKnowledge/<child1-id>",
          display: "1.7mg Semaglutide 2.5 mg/mL + Glycine 5 mg/mL 3 mL"
        },
        {
          reference: "MedicationKnowledge/<child2-id>",
          display: "1mg Semaglutide 2.5 mg/mL + Glycine 5 mg/mL 1.5 mL"
        }
      ]
    }
  ]
}

Example: Child Dose Variation

{
  resourceType: "MedicationKnowledge",
  status: "active",
  amount: {
    value: 1,
    extension: [
      {
        id: "medication-days-supply",
        url: "https://www.hl7.org/fhir/datatypes.html#integer",
        valueInteger: 28
      }
    ],
    unit: "Each"
  },
  code: {
    text: "1.7mg Semaglutide 2.5 mg/mL + Glycine 5 mg/mL 3 mL",
    coding: [
      {
        system: "medication-coding-system",
        code: "3080",
        display: "1.7mg Semaglutide 2.5 mg/mL + Glycine 5 mg/mL 3 mL"
      }
    ]
  },
  administrationGuidelines: [
    {
      dosage: [
        {
          dosage: [
            {
              patientInstruction: "Inject Semaglutide 1.7mg (0.70mL or units) subcutaneously once weekly"
            }
          ],
          type: {
            coding: [
              {
                code: "maintenance",
                display: "maintenance"
              }
            ]
          }
        }
      ]
    }
  ],
  productType: [
    {
      coding: [
        {
          system: "medication-type-coding-system",
          code: "compound",
          display: "Compound"
        }
      ]
    }
  ],
  relatedMedicationKnowledge: [
    {
      type: {
        coding: [
          {
            system: "compounded-medication-family",
            code: "parent",
            display: "parent"
          }
        ]
      },
      reference: [
        {
          reference: "MedicationKnowledge/<parent-id>",
          display: "Semaglutide 2.5 mg/mL + Glycine 5 mg/mL"
        }
      ]
    }
  ]
}

Key Considerations for Parent-Child Compounds

Parent Medication Features:

Child Medication Features:

Benefits of This Approach:

Example: Traditional Single Compounded Medication

{
  resourceType: 'MedicationKnowledge',
  amount: {
    value: 200,
    unit: 'g',
    system: 'http://unitsofmeasure.org',
  },
  ingredient: [
    {
      isActive: true,
      itemCodeableConcept: {
        text: 'Baclofen powder',
        coding: [
          {
            system: 'http://www.nlm.nih.gov/research/umls/rxnorm',
            code: '1292',
          },
        ],
      },
      strength: {
        numerator: {
          value: 5,
          unit: 'g',
          system: 'http://unitsofmeasure.org',
        },
        denominator: {
          value: 100,
          unit: 'g',
          system: 'http://unitsofmeasure.org',
        },
      },
    },
    {
      isActive: true,
      itemCodeableConcept: {
        text: 'Ketoprofen powder',
        coding: [
          {
            system: 'http://www.nlm.nih.gov/research/umls/rxnorm',
            code: '6142',
          },
        ],
      },
      strength: {
        numerator: {
          value: 10,
          unit: 'g',
          system: 'http://unitsofmeasure.org',
        },
        denominator: {
          value: 100,
          unit: 'g',
          system: 'http://unitsofmeasure.org',
        },
      },
    },
    { 
      // Additional ingredients here...
    }
  ],
  packaging: {
    type: {
      text: 'Tube',
      coding: [
        {
          system: 'http://terminology.hl7.org/CodeSystem/medicationknowledge-package-type',
          code: 'tube',
          display: 'Tube',
        },
      ],
    },
  },
}

Medication Relationships

Advanced implementations might want to model structured relationships between medications. For example, administrators might want to link MedicationKnowledge resources representing generic and branded medications, to aid in fulfillment (see Branded vs. Generic Medications)

Relationships between drugs in the formulary are modeled using the MedicationKnowledge.relatedMedicationKnowledge field. The type of each relationship is specified by MedicationKnowledge.relatedMedicationKnowledge.type.

Common relationship types include:

Custom relationship type systems can be defined for organization-specific needs, such as the "compounded-medication-family" system shown in the compound examples above.

Refer to the RxNORM relationship codes for an example code system of relationships between drugs.