> For the complete documentation index, see [llms.txt](https://docs.snomed.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snomed.org/implementation-guides/drug-model-implementation-guide/technical-application/querying-the-drug-model.md).

# Querying the Drug Model

## Overview

Querying SNOMED CT drug content is a fundamental capability for supporting clinical workflows, product selection, and analytics.

Because drug concepts are defined using structured attributes, effective querying depends on understanding both the hierarchy and the concept model.

The SNOMED CT Drug Model is designed to enable flexible querying across:

* hierarchical relationships (e.g. ingredient → product → package)
* defining attributes (e.g. ingredient, dose form, strength)
* levels of abstraction (MP, MPF, CD, RCD, RPCD)

Effective querying relies on the use of Expression Constraint Language (ECL), which allows both hierarchical and attribute-based constraints to be combined. More information, see [SNOMED CT Expression Constraint Language](https://docs.snomed.org/snomed-ct-specifications/snomed-ct-expression-constraint-language/)

## Hierarchical Queries

Hierarchical queries use subtype relationships to retrieve groups of related concepts. These are particularly useful for aggregation and broad filtering.

**Example: Aggregate by ingredient**

```
<< 372687004 |Amoxicillin (substance)|
```

Explanation:

Retrieves all medicinal products containing amoxicillin, across all levels of the drug model (MP, MPF, CD, RCD, RPCD).

Typical use cases:

* drug interaction checking
* allergy alerts
* population-level reporting

**Example: Retrieve all capsule drugs**

{% code overflow="wrap" %}

```
<< 763158003 |Medicinal product| : 
763032000 |Has unit of presentation (attribute)| = 732937005 |Capsule (unit of presentation)|
```

{% endcode %}

Explanation:

Retrieves all medicinal products that have [unit of presentation](/snomed-ct-specifications/snomed-ct-editorial-guide/readme/authoring/domain-specific-modeling/pharmaceutical-and-biologic-product/index/unit-of-presentation.md) of capsule, regardless of ingredient or strength.

Typical use cases:

* filtering drug lists in prescribing systems
* form-specific clinical rules

## Attribute-Based Queries

Attribute-based queries refine results using specific characteristics of medicinal products.

**Example: Dose-specific Clinical Drugs**

The following expression constraint is satisfied by oral medicinal products, which contain amoxicillin and have a presentation strength greater than or equal to 250 mg.

```
< 763158003 |Medicinal product (product)| :
  411116001 |Has manufactured dose form (attribute)| = << 385268001 |Oral dose form (dose form)| ,
  {
    << 127489000 |Has active ingredient (attribute)| = << 372687004 |Amoxicillin (substance)|,
    1142135004 |Has presentation strength numerator value (attribute)| >= #250,
    732945000 |Has presentation strength numerator unit (attribute)| = 258684004 |milligram (qualifier value)|
  }
```

Retrieves Clinical Drugs containing amoxicillin at a strength of 250 mg.

Typical use cases:

* dose validation
* prescribing decision support

## Cross-Level Navigation

A key feature of the SNOMED CT Drug Model is the ability to move between levels of abstraction.

**Upward navigation (aggregation)**

* RCD → CD → MP

Used to:

* aggregate dispensing or administration data
* support reporting and analytics

**Downward navigation (product identification)**

* MP → CD → RCD → RPCD

Used to:

* identify available products for a given clinical definition
* support substitution and dispensing workflows

## ECLs for Selecting Drug Model Classes

Selecting specific drug model classes is essential for accurate data entry and meaningful analytics. This can be achieved using ECL expressions that constrain content based on hierarchical structure, as well as the presence or absence of relevant attributes.

The following table shows the ECLs required to query specific Drug model classes.

<table data-full-width="true"><thead><tr><th width="218.7578125">Class</th><th>ECL</th></tr></thead><tbody><tr><td>Medicinal product (MP)</td><td>&#x3C;&#x3C; 763158003 |Medicinal product| :<br>[0..0] 1142139005 |Count of base of active ingredient| = *,<br>[0..0] 411116001 |Has manufactured dose form| = *,<br>[0..0] 774158006 |Has product name| = *</td></tr><tr><td>Medicinal product only (MPO)</td><td>&#x3C;&#x3C; 763158003 |Medicinal product| :<br>1142139005 |Count of base of active ingredient| = *,<br>[0..0] 411116001 |Has manufactured dose form| = *,<br>[0..0] 774158006 |Has product name| = *</td></tr><tr><td>Medicinal product form (MPF)</td><td>&#x3C;&#x3C; 763158003 |Medicinal product| :<br>[0..0] 1142139005 |Count of base of active ingredient| = *,<br>411116001 |Has manufactured dose form| = *,<br>[0..0] 774158006 |Has product name| = *</td></tr><tr><td>Medicinal product form only (MPFO)</td><td>&#x3C;&#x3C; 763158003 |Medicinal product| :<br>1142139005 |Count of base of active ingredient| = *,<br>411116001 |Has manufactured dose form| = *,<br>[0..0] 732943007 |Has basis of strength substance (attribute)| = *,<br>[0..0] 774158006 |Has product name| = *</td></tr><tr><td>Medicinal product precisely (MPP)</td><td>&#x3C;&#x3C; 763158003 |Medicinal product| :<br>762949000 |Has precise active ingredient (attribute)| = *,<br>1142139005 |Count of base of active ingredient| = *,<br>[0..0] 732943007 |Has basis of strength substance (attribute)| = *,<br>[0..0] 774158006 |Has product name| = *</td></tr><tr><td>Real medicinal product (RMP)</td><td>&#x3C;&#x3C; 763158003 |Medicinal product| :<br>[0..0] 411116001 |Has manufactured dose form| = *,<br>774158006 |Has product name| = *</td></tr><tr><td>Clinical drug (CD)</td><td>&#x3C;&#x3C; 763158003 |Medicinal product| :<br>732943007 |Has basis of strength substance (attribute)| = *,<br>[0..0] 774158006 |Has product name| = *</td></tr><tr><td>Real clinical drug (RCD)</td><td>&#x3C;&#x3C; 763158003 |Medicinal product| :<br>732943007 |Has basis of strength substance (attribute)| = *,<br>774158006 |Has product name| = *</td></tr><tr><td>Packaged clinical drug (PCD)</td><td>&#x3C;&#x3C; 781405001 |Medicinal product package|:<br>[0..0] 774158006 |Has product name| = *</td></tr><tr><td>Real packaged clinical drug (RPCD)</td><td>&#x3C;&#x3C; 781405001 |Medicinal product package|:<br>774158006 |Has product name| = *</td></tr></tbody></table>

These ECLs can be tested live in this demonstrator:

<https://ihtsdo.github.io/sct-implementation-demonstrator/#/medicinal-product-classes>

## Querying by Use Case

The appropriate query pattern depends on the use case and required level of detail.

### **Drug interaction checking (MP level)**

Uses ingredient-level aggregation to ensure that all relevant products are included.

```
Example to be added
```

### **Dose validation (CD level)**

Targets Clinical Drugs to ensure precise matching of strength and formulation.

```
Example to be added
```

### **Product selection (RCD level)**

Retrieves all products containing a given ingredient, supporting dispensing and inventory workflows.

```
Example to be added
```

##

<a href="https://docs.google.com/forms/d/e/1FAIpQLScTmbZIf0UEQwYDkY27EEWBkaiYkHSbR0_9DmFrMLXoQLyL7Q/viewform?usp=pp_url&#x26;entry.1767247133=SNOMED+Drug+Extension+Guide&#x26;entry.670899847=Querying%20the%20Drug%20Model" class="button primary">Provide Feedback</a>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.snomed.org/implementation-guides/drug-model-implementation-guide/technical-application/querying-the-drug-model.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
