MedicationRequest
→
drug_exposure
implemented
primary
Prescription/order stage of the medication lifecycle. One FHIR MedicationRequest maps to one OMOP drug_exposure row. MedicationRequest is the richest of the four FHIR medication-event resources for OMOP purposes because it carries dispense, refill, and supply-duration metadata that the other three lack. Type concept 38000177 (Prescription written).
Conversion profile
omop-medication-request-drug-exposure
A FHIR instance converts to drug_exposure iff it validates against this profile.
| Path | Card | Type | Binding / Fixed | Comment |
|---|---|---|---|---|
| MedicationRequest.status | 1..*MS | fhir/medicationrequest-statusrequired | ||
| MedicationRequest.intent | 1..*MS | Should be order | original-order | reflex-order | filler-order | instance-order. Proposals/plans do not produce drug_exposure rows. | ||
| MedicationRequest.medication[x] | 1..*MS | CodeableConcept | omop-drug-codesrequired | |
| MedicationRequest.subject | 1..* | Reference | Required for drug_exposure.person_id. | |
| MedicationRequest.authoredOn | 1..1MS | Required for drug_exposure.drug_exposure_start_date / _start_datetime. |
ViewDefinition (Stage 1 flattener)
omop-medicationrequest-drug-exposure
21 columns · resource MedicationRequest
| column name | FHIRPath | type |
|---|---|---|
| id | MedicationRequest.id | id |
| drug_rxnorm | MedicationRequest.medicationCodeableConcept.coding.where(system='http://www.nlm.nih.gov/research/umls/rxnorm').first().code | code |
| drug_ndc | MedicationRequest.medicationCodeableConcept.coding.where(system='http://hl7.org/fhir/sid/ndc').first().code | code |
| drug_atc | MedicationRequest.medicationCodeableConcept.coding.where(system='http://www.whocc.no/atc').first().code | code |
| drug_snomed | MedicationRequest.medicationCodeableConcept.coding.where(system='http://snomed.info/sct').first().code | code |
| drug_text | MedicationRequest.medicationCodeableConcept.text | string |
| subject_id | MedicationRequest.subject | Reference(Patient) |
| drug_exposure_start_date | MedicationRequest.authoredOn | dateTime |
| drug_exposure_start_datetime | MedicationRequest.authoredOn | dateTime |
| drug_exposure_end_date | MedicationRequest.dispenseRequest.validityPeriod.end | dateTime |
| drug_exposure_end_datetime | MedicationRequest.dispenseRequest.validityPeriod.end | dateTime |
| stop_reason | MedicationRequest.statusReason | CodeableConcept |
| refills | MedicationRequest.dispenseRequest.numberOfRepeatsAllowed | integer |
| quantity | MedicationRequest.dosageInstruction[0].doseAndRate[0].doseQuantity.value | decimal |
| days_supply | MedicationRequest.dispenseRequest.expectedSupplyDuration | Duration |
| sig | MedicationRequest.dosageInstruction[0].text | string |
| route | MedicationRequest.dosageInstruction[0].route | CodeableConcept |
| route_text | MedicationRequest.dosageInstruction[0].route.text | string |
| performer_id | MedicationRequest.requester | Reference(Practitioner) |
| encounter_id | MedicationRequest.encounter | Reference(Encounter) |
| dose_unit_text | MedicationRequest.dosageInstruction[0].doseAndRate[0].doseQuantity.unit | string |
Condition: status in {active, completed} AND intent in {order, original-order, reflex-order, filler-order, instance-order}
Implementation:
src/mapper/medication.tsFields (23)
-
drug_exposure_id←MedicationRequest.idinteger · idPKrequiredSurrogate key. Hash/sequence/lookup of FHIR resource id. omoponfhir uses IdMapping.getOMOPfromFHIR(); NACHC uses autogen sequence; fhir-to-omop-demo uses FHIR .id directly.3 sources ▾
-
omoponfhir uses a bidirectional IdMapping registry (getOMOPfromFHIR) to map FHIR ids to integer surrogate keys
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:492-495 — IdMapping.getOMOPfromFHIR() call at start of constructOmop()
-
NACHC uses an autogenerated sequence rather than deriving from the FHIR id
- NACHC-fhir-to-omop(java) refs/refs/NACHC-fhir-to-omop/src/main/java/org/nachc/tools/fhirtoomop/fhir/parser/medicationrequest/MedicationRequestParser.java — Autogen sequence for surrogate key
-
fhir-to-omop-demo uses the FHIR .id string directly as the drug_exposure_id
- fhir-to-omop-demo(jq) refs/refs/fhir-to-omop-demo/demo/translate/map/MedicationRequest.jq — 81 lines — uses .id directly
-
-
person_id←MedicationRequest.subjectinteger · Reference(Patient)FK→PERSONrequiredResolve Patient reference to integer person_id. If unresolvable, omoponfhir throws FHIRException; FhirToCdm skips the record; this project defaults to 0.2 sources ▾
-
omoponfhir throws FHIRException when Patient reference cannot be resolved
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:497-508 — Patient resolution with FHIRException on failure
-
FhirToCdm silently skips the entire record when subject is unresolvable
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs:322-373 — MedicationRequest processing — skips on unresolvable subject
-
-
drug_concept_id←MedicationRequest.medication[x]integer · CodeableConcept/ReferenceFK→CONCEPTrequiredmap:drugRxNorm (US) or ATC (EU) code mapped to OMOP standard concept via vocabulary lookup. Placeholder: 0 when concept lookup unavailable. -
drug_exposure_start_date←MedicationRequest.authoredOndate · dateTimerequiredThe date the prescription was authored. NACHC falls back to encounter start date if null. FhirToCdm derives from VisitOccurrence instead.3 sources ▾
-
omoponfhir and this project use authoredOn directly as the start date
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:622-623 — Start/end date from authoredOn
-
NACHC falls back to encounter start date when authoredOn is null
- NACHC-fhir-to-omop(java) refs/refs/NACHC-fhir-to-omop/src/main/java/org/nachc/tools/fhirtoomop/fhir/parser/medicationrequest/MedicationRequestParser.java:140-153 — authoredOn with encounter fallback
-
FhirToCdm derives start date from VisitOccurrence dates rather than authoredOn
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs:366-369 — Visit-derived dates (start/end from VisitOccurrence)
-
-
drug_exposure_start_datetime←MedicationRequest.authoredOndatetime · dateTimeFull ISO datetime from authoredOn. -
drug_exposure_end_date←MedicationRequest.dispenseRequest.validityPeriod.enddate · dateTimerequiredIf absent, fallback to start date. This project also derives end from dispenseRequest.expectedSupplyDuration only when validityPeriod.end is absent. -
drug_exposure_end_datetime←MedicationRequest.dispenseRequest.validityPeriod.enddatetime · dateTimeFull ISO datetime. Null if no end available. -
verbatim_end_date← — dateNot applicable for MedicationRequest. Most implementations leave null. HL7 IG FML maps this from effectivePeriod.end (MedicationStatement only). -
drug_type_concept_id← constant integerFK→CONCEPTrequiredmap:drug_type=3800017738000177 = 'Prescription written'. fhir-to-omop-demo uses 32838 (EHR prescription). FhirToCdm/ETL-German use 32817 (EHR).3 sources ▾
-
omoponfhir and this project use 38000177 (Prescription written) — semantically precise for MedicationRequest
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:616-619 — Type concept 38000177 set here
-
fhir-to-omop-demo uses 32838 (EHR prescription) — a different EHR-specific concept
- fhir-to-omop-demo(jq) refs/refs/fhir-to-omop-demo/demo/translate/map/MedicationRequest.jq:61-61 — drug_type_concept_id = 32838
-
FhirToCdm and ETL-German use 32817 (EHR) universally for all medication-derived rows
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs:338-338 — Type concept 32817 for all medication resources
- ETL-German-FHIR-Core(java) refs/refs/ETL-German-FHIR-Core/src/main/java/org/miracum/etl/fhirtoomop/mapper/MedicationMapper.java — CONCEPT_CLAIM (32817) universal
-
-
stop_reason←MedicationRequest.statusReasonvarchar(20) · CodeableConceptReason for discontinuation. omoponfhir truncates to 20 chars. Only populated when status = stopped. Most implementations leave null. -
refills←MedicationRequest.dispenseRequest.numberOfRepeatsAllowedinteger · integerNumber of refills. omoponfhir reads from dispenseRequest as fallback when dosageInstruction is empty. Only applicable to MedicationRequest. -
quantity←MedicationRequest.dosageInstruction[0].doseAndRate[0].doseQuantity.valuefloat · decimalDose amount per administration. omoponfhir also reads dispenseRequest.quantity.value as fallback. ETL-German computes mean of Range when doseRange is used.2 sources ▾
-
omoponfhir reads doseQuantity.value first, then falls back to dispenseRequest.quantity.value when dosageInstruction is empty
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:674-731 — Dosage quantity + dispense request fallback
-
ETL-German computes the arithmetic mean of doseRange.low and doseRange.high when a Range type is used
- ETL-German-FHIR-Core(java) refs/refs/ETL-German-FHIR-Core/src/main/java/org/miracum/etl/fhirtoomop/mapper/MedicationStatementMapper.java:622-634 — Quantity from doseQuantity or Range mean
-
-
days_supply←MedicationRequest.dispenseRequest.expectedSupplyDurationinteger · Durationtransform:convertUcumDuration(value, unit) -- h/d/wk/mo/a to daysDays of medication supply. Calculated from expectedSupplyDuration.value with UCUM unit conversion. This project converts h/d/wk/mo/a units. No reference implementation populates this. -
sig←MedicationRequest.dosageInstruction[0].text | .patientInstructionvarchar(MAX) · stringFree-text dosage instructions. FhirToCdm reads dosageInstruction[0].text. fhir-to-omop-demo uses .note.2 sources ▾
-
FhirToCdm reads dosageInstruction[0].text exclusively
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs:352-354 — sig from dosageInstruction[0].text
-
fhir-to-omop-demo reads MedicationRequest.note rather than dosageInstruction[].text
- fhir-to-omop-demo(jq) refs/refs/fhir-to-omop-demo/demo/translate/map/MedicationRequest.jq — 81 lines — uses .note for sig
-
-
route_concept_id←MedicationRequest.dosageInstruction[0].routeinteger · CodeableConceptFK→CONCEPTmap:routeAdministration route. Requires vocabulary lookup against SNOMED route concepts. This project currently sets null and captures route_source_value only. -
route_source_value←MedicationRequest.dosageInstruction[0].route.text | .route.coding[0].displayvarchar(50) · stringRaw route code or display text. omoponfhir prefers route.text, falls back to coding[0].display. -
lot_number← — varchar(50)Not applicable for MedicationRequest. Immunization-only field. -
provider_id←MedicationRequest.requesterinteger · Reference(Practitioner)FK→PROVIDERPrescriber. omoponfhir uses recorder instead. This project uses requester.2 sources ▾
-
omoponfhir reads provider from recorder (not requester), filtering to Practitioner-typed references only
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:733-742 — Provider from recorder
-
fhir-to-omop-demo reads provider from requester.id
- fhir-to-omop-demo(jq) refs/refs/fhir-to-omop-demo/demo/translate/map/MedicationRequest.jq:69-69 — Provider from requester.id
-
-
visit_occurrence_id←MedicationRequest.encounterinteger · Reference(Encounter)FK→VISIT_OCCURRENCEResolve Encounter reference. omoponfhir validates that the referenced VisitOccurrence exists in the database. -
visit_detail_id← — integerFK→VISIT_DETAILNull in all reviewed implementations. FhirToCdm sets it equal to visit_occurrence_id (non-standard). -
drug_source_value←MedicationRequest.medication[x].coding[best].codevarchar(50) · codeBest code by vocabulary priority (RxNorm > ATC > NDC > first). omoponfhir uses identifier.value as source value.2 sources ▾
-
omoponfhir uses MedicationRequest.identifier.value (business identifier) rather than the medication coding as source value; truncates to 50 chars
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:547-597 — Medication resolution including source value extraction; truncation to 50 chars
-
This project, FhirToCdm, and ETL-German use the medication coding code as source value, prioritizing vocabulary (RxNorm > ATC > NDC)
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs:325-327 — Medication CodeableConcept extraction
- ETL-German-FHIR-Core(java) refs/refs/ETL-German-FHIR-Core/src/main/java/org/miracum/etl/fhirtoomop/mapper/MedicationMapper.java — ATC code used as source value for EU data
-
-
drug_source_concept_id← constant integerFK→CONCEPT=0Source vocabulary concept ID (non-standard). Placeholder: 0. fhir-to-omop-demo uses a pre-computed source_concept_id from vocabulary lookup.1 source ▾
-
fhir-to-omop-demo pre-computes source_concept_id via a two-phase merge with Medication.jq rather than defaulting to 0
- fhir-to-omop-demo(jq) refs/refs/fhir-to-omop-demo/demo/translate/map/MedicationRequest.jq:10-24 — Drug concept from pre-computed vocabulary; also produces drug_source_concept_id
- fhir-to-omop-demo(jq) refs/refs/fhir-to-omop-demo/demo/translate/map/Medication.jq — 71 lines — produces partial rows with concept info merged by ID
-
-
dose_unit_source_value←MedicationRequest.dosageInstruction[0].doseAndRate[0].doseQuantity.unit | .codevarchar(50) · stringRaw dose unit string. omoponfhir prefers .code, falls back to .unit.1 source ▾
-
omoponfhir prefers doseQuantity.code (UCUM code), falls back to doseQuantity.unit (display string)
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:674-699 — Dosage quantity + unit extraction
-
Vocabularies
drug_type
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| MedicationRequest | Prescription written | 38000177 | Prescription written |
| MedicationRequest (alt: fhir-to-omop-demo) | EHR prescription | 32838 | EHR prescription |
| MedicationRequest (alt: FhirToCdm/ETL-German) | EHR | 32817 | EHR |
drug
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| RxNorm (http://www.nlm.nih.gov/research/umls/rxnorm) | RxNorm | - | Standard OMOP drug vocabulary (US). Maps directly to drug_concept_id. |
| ATC (http://www.whocc.no/atc) | ATC | - | Maps via concept_relationship to RxNorm. |
| NDC (http://hl7.org/fhir/sid/ndc) | NDC | - | National Drug Code (US). Maps to RxNorm via concept_relationship. |
| SNOMED (http://snomed.info/sct) | SNOMED CT product codes | - | Require mapping to RxNorm via OMOP concept tables. |
route
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| 26643006 | Oral route | 4132161 | Oral |
| 47625008 | Intravenous route | 4171047 | Intravenous |
| 78421000 | Intramuscular route | 4302612 | Intramuscular |
| 34206005 | Subcutaneous route | 4142048 | Subcutaneous |
| 46713006 | Nasal route | 4262099 | Nasal |
| 6064005 | Topical route | 4263689 | Topical |
| 37161004 | Rectal route | 4115462 | Rectal |
| 45890007 | Transdermal route | 4262914 | Transdermal |
Edge Cases
medicationReference to contained Medication
omoponfhir iterates contained[] to find matching Medication by ID fragment. This project skips (returns null).
medicationReference to external Medication
Requires Bundle-level or server-side resolution. fhir-to-omop-demo merges in post-processing. Most implementations skip.
Multiple dosageInstruction entries
Take first for route and dose. omoponfhir iterates all entries but breaks after first match.
status = entered-in-error
Skip -- do not create drug_exposure row. All implementations agree.
status = stopped
omoponfhir populates stop_reason from statusReason and still creates the row. This project skips.
status = on-hold / draft / unknown
This project skips (only maps active and completed). omoponfhir maps all statuses except entered-in-error.
intent = proposal / plan
This project skips -- only maps order, original-order, reflex-order, filler-order, instance-order. omoponfhir maps all intents.
No end date available
Use start date as end date. Consensus across all implementations.
dispenseRequest absent
No validityPeriod.end, no expectedSupplyDuration, no numberOfRepeatsAllowed available. Fall back to start = end and null days_supply/refills.
expectedSupplyDuration UCUM units
This project converts h, d, wk, mo, a to days. Other UCUM duration codes are not supported.
authoredOn null
NACHC falls back to encounter start date. FhirToCdm derives from VisitOccurrence. This project leaves null.
Multiple codings in medication[x]
This project uses selectBestCoding() by vocabulary priority (RxNorm > ATC > NDC > first). fhir-to-omop-demo warns. omoponfhir iterates all codings against OMOP concept table.
No medication code found
This project returns null (skips). omoponfhir throws FHIRException.
drug_source_value exceeds 50 chars
omoponfhir truncates medicationCodeableConcept.getText() to 50 chars: .substring(0, 50). OMOP CDM field is varchar(50).
stop_reason exceeds 20 chars
omoponfhir truncates: .substring(0, 20). OMOP CDM field is varchar(20).
Reference Implementations
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopMedicationRequest.java:1-746 — Most complete: RxNorm concept lookup, contained reference resolution, route concept lookup, dosage parsing, dispense-request fallback for refills/quantity, provider from recorder.
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs — CreateDrugExposure() lines 310-405, MedicationRequest branch lines 322-373. Vocabulary file lookup. Dates derived from VisitOccurrence. Type concept 32817.
- fhir-to-omop-demo(jq) refs/refs/fhir-to-omop-demo/demo/translate/map/MedicationRequest.jq — 81 lines. Two-phase merge with Medication.jq by ID. Pre-computed vocabulary concepts. Type concept 32838.
- NACHC-fhir-to-omop(java) refs/refs/NACHC-fhir-to-omop/src/main/java/org/nachc/tools/fhirtoomop/fhir/parser/medicationrequest/MedicationRequestParser.java — 155 lines. Parses medication code, status, intent, dates. Falls back to encounter start date when authoredOn is null.
- ETL-German-FHIR-Core(java) refs/refs/ETL-German-FHIR-Core/src/main/java/org/miracum/etl/fhirtoomop/mapper/MedicationMapper.java — German MII FHIR Core profile. Uses ATC vocabulary. Type concept 32817.