Medication
→
drug_exposure
documented
primary
The FHIR Medication resource is a vocabulary/codeable-concept resource, not a medication event. It does NOT directly produce a drug_exposure row. Instead, its code and ingredient data are resolved into drug_concept_id and drug_source_value on drug_exposure rows produced by the four event resources (MedicationRequest, MedicationDispense, MedicationAdministration, MedicationStatement). This edge documents how Medication fields contribute to drug_exposure columns when referenced.
Conversion profile
omop-medication-drug-exposure
A FHIR instance converts to drug_exposure iff it validates against this profile.
| Path | Card | Type | Binding / Fixed | Comment |
|---|---|---|---|---|
| Medication.code | 1..*MS | CodeableConcept | omop-drug-codesrequired |
ViewDefinition (Stage 1 flattener)
omop-medication-drug-exposure
6 columns · resource Medication
| column name | FHIRPath | type |
|---|---|---|
| id | Medication.id | id |
| drug_rxnorm | Medication.code.coding.where(system='http://www.nlm.nih.gov/research/umls/rxnorm').first().code | code |
| drug_ndc | Medication.code.coding.where(system='http://hl7.org/fhir/sid/ndc').first().code | code |
| drug_atc | Medication.code.coding.where(system='http://www.whocc.no/atc').first().code | code |
| drug_snomed | Medication.code.coding.where(system='http://snomed.info/sct').first().code | code |
| drug_text | Medication.code.text | string |
Condition: Medication does not directly produce drug_exposure rows. Its code/ingredient data flows into drug_exposure via event resources (MedicationRequest, MedicationDispense, MedicationAdministration, MedicationStatement) when they carry a medicationReference pointing to a Medication resource.
Fields (3)
-
drug_concept_id←Medication.code.coding[best]integer · CodingFK→CONCEPTrequiredtransform:Vocabulary lookup: resolve best coding (RxNorm > NDC > ATC > SNOMED) to OMOP standard concept via CONCEPT tableSet by the event mapper after resolving medicationReference. The 'best' coding is selected by vocabulary priority. -
drug_source_value←Medication.code.coding[best].codevarchar(50) · codeRaw source code from the highest-priority coding in Medication.code -
drug_source_concept_id←Medication.code.coding[best]integer · CodingFK→CONCEPTtransform:Look up source vocabulary concept_id for the raw code (non-standard concept)The source concept before mapping to standard vocabulary
Vocabularies
drug_code_systems
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| http://www.nlm.nih.gov/research/umls/rxnorm | RxNorm | - | RxNorm |
| http://hl7.org/fhir/sid/ndc | NDC (National Drug Code) | - | NDC |
| http://www.whocc.no/atc | ATC (Anatomical Therapeutic Chemical) | - | ATC |
| http://snomed.info/sct | SNOMED CT (product codes) | - | SNOMED |
Edge Cases
medicationReference vs medicationCodeableConcept
Event resources may carry either medicationReference (pointing to a Medication resource) or inline medicationCodeableConcept. When only medicationReference is present, the Medication resource must be resolved to extract the code. Several implementations skip medicationReference entirely and only process inline codes.
Contained reference (#id)
Medication is embedded in the event resource's contained[] array. Iterate contained resources to find a Medication matching the fragment ID. Extract Medication.code. Fall back to Reference.display if no code found.
Bundle-level reference resolution
Medication resources appear as separate entries in a Bundle alongside event resources. Requires pre-indexing all Medications by fullUrl/id before processing events. Two strategies: build an in-memory map (ETL-German) or produce partial rows and merge in post-processing (fhir-to-omop-demo).
Medication.code absent but ingredient present
Some Medication resources carry no top-level code but have ingredient[].itemCodeableConcept with ATC codes. ETL-German extracts ATC from ingredients as the drug source value.
Multiple codings in Medication.code
Pick best coding by vocabulary priority: RxNorm > NDC > ATC > SNOMED > first. Use the selected code for drug_source_value and vocab lookup for drug_concept_id.
Medication.form (dosage form)
Not directly mapped to any OMOP column. Dose form is captured implicitly via drug_concept_id when using RxNorm clinical/branded drug products that encode form.
Medication.manufacturer and Medication.batch
Dropped. No corresponding OMOP drug_exposure columns.
Reference Implementations
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:547-597 — Resolves contained #-references in event resources. Iterates contained[] to find Medication by ID fragment, extracts Medication.code.
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationStatement.java:751-805 — Same contained-reference resolution logic as MedicationRequest mapper.
- fhir-to-omop-demo(jq) refs/refs/fhir-to-omop-demo/demo/translate/map/Medication.jq — Two-phase merge: produces partial drug_exposure rows with concept info only; merged by ID with rows from MedicationRequest.jq in post-processing.
- ETL-German-FHIR-Core(java) refs/refs/ETL-German-FHIR-Core/src/main/java/org/miracum/etl/fhirtoomop/mapper/MedicationMapper.java — Pre-indexed map. Walks all Medication resources up front, builds medication_id_map keyed by resource ID for reference resolution. Extracts ATC codes from ingredients.
- fhir-omop-ig(fml) refs/refs/fhir-omop-ig/input/maps/medication.fml — Maps MedicationStatement only and assumes inline coding. Does not address Medication resource resolution.