---
description: Represent a compound medication in FHIR, store the DEA schedules and NDCs of its ingredients, and see the checks the Aidbox ePrescription module runs on it.
---

> For the complete documentation index, see [llms.txt](https://www.health-samurai.io/docs/aidbox/llms.txt).
> Use it to discover all available pages before guessing URLs.

---

# Compound Medications

The module treats a `Medication` as a compound when either of these is true:

* its `http://aidbox.app/ePrescription/FHIRSchema/medication-is-compound` extension has `valueBoolean: true`
* it has `ingredient` entries and `Medication.code` has no National Drug Code (NDC) coding

## Ingredient NDCs

Store an 11-digit NDC for each scheduled ingredient as a coding under `http://hl7.org/fhir/sid/ndc` in its `itemCodeableConcept`.

## Ingredient Schedules

Store the schedule of each scheduled ingredient in the [DEA schedule extension](../epcs/dea-schedules.md#store-a-dea-schedule) of its `Medication.ingredient.itemCodeableConcept`.

A prescription whose compound has at least one scheduled ingredient is a [controlled prescription](../epcs/dea-schedules.md).
Its schedule is the strictest ingredient schedule.
`I` is the strictest and `V` the least strict, so a compound with a Schedule II and a Schedule IV ingredient follows the rules of Schedule II.

A schedule on `Medication.code` of a compound is optional.
When you store one, it must equal the strictest ingredient schedule.
The module never classifies a compound by that schedule.

Only an active ingredient can have a schedule, so leave the extension out of an ingredient with `isActive: false`.

<details>

<summary>Compound with a scheduled ingredient</summary>

```json
{
  "resourceType": "Medication",
  "id": "compound-example",
  "code": {
    "text": "Hydrocodone 1 mg/mL in oral suspension base"
  },
  "extension": [
    {
      "url": "http://aidbox.app/ePrescription/FHIRSchema/medication-is-compound",
      "valueBoolean": true
    }
  ],
  "ingredient": [
    {
      "itemCodeableConcept": {
        "text": "Hydrocodone bitartrate powder",
        "coding": [
          {
            "system": "http://hl7.org/fhir/sid/ndc",
            "code": "38779052405"
          }
        ],
        "extension": [
          {
            "url": "http://aidbox.app/ePrescription/FHIRSchema/medication-dea-schedule",
            "valueCodeableConcept": {
              "coding": [
                {
                  "system": "http://terminology.hl7.org/CodeSystem/v2-0477",
                  "code": "II"
                }
              ]
            }
          }
        ]
      },
      "isActive": true
    },
    {
      "itemCodeableConcept": {
        "text": "Oral suspension base"
      },
      "isActive": false
    }
  ]
}
```

</details>

## Compound Checks

<details>

<summary>Error Responses</summary>

* The compound's `Medication.code`:
  * `compound-root-dea-schedule-without-ingredient-schedules`: the code of a compound has a schedule, and no ingredient has one.
  * `compound-root-dea-schedule-mismatch`: the code of a compound has a schedule other than the strictest ingredient schedule.
* A compound ingredient:
  * `compound-ingredient-has-multiple-dea-schedules`: the ingredient has more than one schedule extension, or more than one coding under `http://terminology.hl7.org/CodeSystem/v2-0477` in one extension.
  * `compound-ingredient-dea-schedule-coding-system-is-not-supported`: a schedule extension has codings, and none of them is under `http://terminology.hl7.org/CodeSystem/v2-0477`.
  * `compound-ingredient-invalid-dea-schedule`: the schedule is not one of `I` to `V`, or a schedule extension's codings under `http://terminology.hl7.org/CodeSystem/v2-0477` have no code.
  * `compound-inactive-ingredient-has-dea-schedule`: an ingredient with `isActive: false` has a schedule.
* A scheduled ingredient of a compound:
  * `controlled-compound-ingredient-missing-ndc`: the ingredient has no coding under `http://hl7.org/fhir/sid/ndc`.
  * `controlled-compound-ingredient-invalid-ndc`: the ingredient's NDC coding has no code, or its code does not have 11 digits.

Example response for `controlled-compound-ingredient-missing-ndc` on the first ingredient of the compound above:

```json
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "invalid",
      "details": {
        "text": "Compound ingredient with a DEASchedule must include an NDC"
      },
      "diagnostics": "{\"in\":[\"Medication\",\"ingredient\",0],\"resourceType\":\"Medication\",\"id\":\"compound-example\"}"
    }
  ]
}
```

</details>
