AllergyIntolerance
→
observation
implemented
primary
FHIR AllergyIntolerance records patient allergies and intolerances. OMOP has no dedicated allergy table, so allergies are stored in the observation table with allergy-specific SNOMED concepts. One AllergyIntolerance maps to one observation row. Status filtering excludes inactive/resolved allergies and entered-in-error/refuted records.
Conversion profile
omop-allergyintolerance-observation
A FHIR instance converts to observation iff it validates against this profile.
| Path | Card | Type | Binding / Fixed | Comment |
|---|---|---|---|---|
| AllergyIntolerance.clinicalStatus | fhir/allergyintolerance-clinicalrequired | |||
| AllergyIntolerance.verificationStatus | fhir/allergyintolerance-verificationrequired | |||
| AllergyIntolerance.code | 1..*MS | omop-observation-codesrequired | ||
| AllergyIntolerance.patient | 1..* | Reference | Required for observation.person_id. |
ViewDefinition (Stage 1 flattener)
omop-allergyintolerance-observation
15 columns · resource AllergyIntolerance
| column name | FHIRPath | type |
|---|---|---|
| id | AllergyIntolerance.id | id |
| code_snomed | AllergyIntolerance.code.coding.where(system='http://snomed.info/sct').first().code | code |
| code_rxnorm | AllergyIntolerance.code.coding.where(system='http://www.nlm.nih.gov/research/umls/rxnorm').first().code | code |
| code_text | AllergyIntolerance.code.text | string |
| value_code_snomed | AllergyIntolerance.code.coding.where(system='http://snomed.info/sct').first().code | code |
| value_code_rxnorm | AllergyIntolerance.code.coding.where(system='http://www.nlm.nih.gov/research/umls/rxnorm').first().code | code |
| value_code_text | AllergyIntolerance.code.text | string |
| subject_id | AllergyIntolerance.patient | Reference(Patient) |
| observation_date | AllergyIntolerance.onsetDateTime | dateTime |
| observation_datetime | AllergyIntolerance.onsetDateTime | dateTime |
| value_as_string | AllergyIntolerance.reaction[*].manifestation[*].text | string |
| qualifier_text | AllergyIntolerance.type | code |
| performer_id | AllergyIntolerance.asserter | Reference(Practitioner | PractitionerRole) |
| encounter_id | AllergyIntolerance.encounter | Reference(Encounter) |
| value_text | AllergyIntolerance.criticality | code |
Condition: clinicalStatus is active or absent; verificationStatus is not entered-in-error or refuted
Implementation:
src/mapper/allergy-intolerance.tsFields (21)
-
observation_id←AllergyIntolerance.idinteger · idPKrequiredSurrogate key from AllergyIntolerance.id. Hash or sequence via ctx.ids.getId(). -
person_id←AllergyIntolerance.patientinteger · Reference(Patient)FK→PERSONrequiredResolve Patient reference via ctx.ids.resolveRef(). -
observation_concept_id←AllergyIntolerance.codeinteger · CodeableConceptFK→CONCEPTrequiredSNOMED allergy/substance concept. Requires vocabulary lookup. This project: 0 (placeholder). omoponfhir: category-driven (food->4188027, medication->439224, default->40772948). FhirToCdm: direct vocab lookup on code.2 sources ▾
-
Category-based concept (allergy category → concept_id); substance goes to value_as_concept_id
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopAllergyIntolerance.java:408-431
- omoponfhir-v54(java) refs/refs/omoponfhir-v54-r4/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopAllergyIntolerance.java:408-431
-
Direct substance concept via vocabulary lookup on AllergyIntolerance.code
- fhir-omop-ig(fml) refs/refs/fhir-omop-ig/input/maps/Allergy.fml:14-18
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs:471-473
-
-
observation_date←AllergyIntolerance.onsetDateTime | AllergyIntolerance.onsetPeriod.start | AllergyIntolerance.recordedDatedate · dateTimerequiredtransform:dateTime -> date; fallback chain: onsetDateTime -> onsetPeriod.start -> recordedDateIf all absent, the record is skipped.3 sources ▾
-
Full fallback chain: onsetDateTime → onsetPeriod.start → recordedDate; skip if all absent
-
recordedDate only (no onset fallback)
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs:475-475
-
onsetDateTime only (dateTime type, no Period or recordedDate fallback)
- fhir-omop-ig(fml) refs/refs/fhir-omop-ig/input/maps/Allergy.fml:40-40
-
-
observation_datetime←AllergyIntolerance.onsetDateTimedatetime · dateTimeFull ISO datetime when available. Null if source is date-only or from fallback. -
observation_type_concept_id← constant integerrequired=32817EHR. omoponfhir uses 38000280 (Observation recorded from EHR).2 sources ▾
-
32817 (EHR) — modern OMOP CDM v6 recommendation
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs:468-468
-
38000280 (Observation recorded from EHR) — legacy type concept
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopAllergyIntolerance.java:446-446
- omoponfhir-v54(java) refs/refs/omoponfhir-v54-r4/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopAllergyIntolerance.java:446-446
-
-
value_as_number← constant float=nullNot applicable for allergy data. -
value_as_string←AllergyIntolerance.reaction[*].manifestation[*].textvarchar(60) · stringtransform:Concatenate all reaction manifestation display names, semicolon-separated.All reactions and manifestations are included. -
value_as_concept_id←AllergyIntolerance.reaction[0].manifestation[0]integer · CodeableConceptFK→CONCEPTFirst reaction manifestation concept. Requires vocab lookup. This project: null (placeholder). HL7 IG FML maps manifestation code here. omoponfhir places the substance here instead.2 sources ▾
-
Reaction manifestation code (first manifestation of first reaction)
- fhir-omop-ig(fml) refs/refs/fhir-omop-ig/input/maps/Allergy.fml:42-50
-
Substance concept (AllergyIntolerance.code, not manifestation) placed here; observation_concept_id holds category concept
-
-
qualifier_concept_id← constant integerFK→CONCEPT=nullCould map type (allergy/intolerance) or criticality if standard concepts existed. -
qualifier_source_value←AllergyIntolerance.typevarchar(50) · code"allergy" or "intolerance". Preserves the type distinction. -
unit_concept_id← constant integerFK→CONCEPT=nullNot applicable for allergy data. -
unit_source_value← constant varchar(50)=nullNot applicable for allergy data. -
provider_id←AllergyIntolerance.asserter | AllergyIntolerance.recorderinteger · Reference(Practitioner | PractitionerRole)FK→PROVIDERtransform:Prefer asserter, fall back to recorder. Only Practitioner/PractitionerRole references are valid for provider_id.omoponfhir uses recorder only.2 sources ▾
-
recorder only (no asserter consideration)
-
Not mapped (provider_id left null or commented out)
- fhir-omop-ig(fml) refs/refs/fhir-omop-ig/input/maps/Allergy.fml:20-38 — Patient/encounter/provider all commented out as TODO
-
-
visit_occurrence_id←AllergyIntolerance.encounterinteger · Reference(Encounter)FK→VISIT_OCCURRENCEResolve Encounter reference. Null if absent. -
visit_detail_id← — integerFK→VISIT_DETAILNot mapped by any implementation. -
observation_source_value←AllergyIntolerance.code.coding[best].codevarchar(50) · codeSource allergy code (verbatim). Best coding selected by system priority (SNOMED > RxNorm > first). -
observation_source_concept_id← constant integer=0Could hold the non-standard concept for the source code if vocabulary lookup is available. -
value_source_value←AllergyIntolerance.criticalityvarchar(50) · code"low", "high", or "unable-to-assess". Preserves criticality. -
observation_event_id← — integerNot mapped. Could link to related records. -
obs_event_field_concept_id← — integerFK→CONCEPTNot mapped.
Vocabularies
observation_concept_id_category_based
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| food | Food allergy category | 4188027 | Allergy to food |
| medication | Medication allergy category | 439224 | Allergy to drug |
| environment | Environmental allergy category | 40772948 | Allergy |
| biologic | Biologic allergy category | 40772948 | Allergy |
| (absent) | No category, substance domain = Drug | 439224 | Allergy to drug |
| (absent, other) | No category, other domain | 40772948 | Allergy |
observation_type_concept_id
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| 32817 | EHR | 32817 | EHR |
| 38000280 | Observation recorded from EHR | 38000280 | Observation recorded from EHR |
clinicalStatus_filtering
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| active | Active | - | |
| inactive | Inactive | - | |
| resolved | Resolved | - | |
| (absent) | Not provided | - |
verificationStatus_filtering
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| confirmed | Confirmed | - | |
| unconfirmed | Unconfirmed | - | |
| provisional | Provisional | - | |
| differential | Differential | - | |
| entered-in-error | Entered in Error | - | |
| refuted | Refuted | - | |
| (absent) | Not provided | - |
allergy_type
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| allergy | Allergy | - | |
| intolerance | Intolerance | - |
criticality
| Source | Display | Concept ID | Concept Name |
|---|---|---|---|
| low | Low Risk | - | |
| high | High Risk | - | |
| unable-to-assess | Unable to Assess | - |
Edge Cases
No onsetDateTime, no onsetPeriod, no recordedDate
Skip the record -- observation_date is NOT NULL. This project returns null.
onsetPeriod.start only (no onsetDateTime)
Use onsetPeriod.start as observation_date.
recordedDate only (no onset fields)
Use as last-resort date.
No code or empty code.coding[]
Skip the record -- cannot identify the substance.
code with text only (no coding)
Skip -- no structured code to map.
Multiple reaction entries
Concatenate all manifestation display names into value_as_string, semicolon-separated.
Multiple manifestation per reaction
Include all in value_as_string concatenation.
category = medication
Code might overlap with drug concepts. Still maps to observation, not drug_exposure.
category = food
omoponfhir sets observation_concept_id = 4188027 (Allergy to food). This project: not yet implemented.
criticality present
Stored in value_source_value.
type = intolerance
Stored in qualifier_source_value. No separate OMOP handling.
verificationStatus = entered-in-error
Skip the record.
verificationStatus = refuted
Skip the record.
clinicalStatus = inactive or resolved
Skip the record.
clinicalStatus absent
Map permissively (not required in FHIR).
asserter is a Patient (self-reported)
Cannot map to OMOP provider_id -- set null. resolveRef will produce an ID but it won't correspond to a provider row.
recorder is a RelatedPerson
Cannot map to OMOP provider_id -- set null.
reaction[].severity present
Lost -- no OMOP field for severity. Could store in qualifier_source_value but this project uses it for type.
reaction[].substance differs from code
The per-reaction substance is lost. Only code (top-level) is mapped.
note[] present
Lost -- no standard OMOP target. Could append to value_as_string but would mix with manifestation text.
Multiple coding in code
Best coding selected by system priority (SNOMED preferred).
onsetAge or onsetRange
Not handled -- only onsetDateTime and onsetPeriod supported. Would require birth date to compute absolute date.
onsetString
Not handled -- free-text onset cannot produce a date. Skip or store in a separate field.
Reference Implementations
- fhir-omop-ig(fml) refs/refs/fhir-omop-ig/input/maps/Allergy.fml — 51 lines. Maps code -> observation_concept_id, onset -> observation_date, reaction.manifestation -> value_as_concept_id. Patient/encounter/provider commented out (TODO). Status: draft.
- omoponfhir(java) refs/refs/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopAllergyIntolerance.java:350-449 — Bidirectional (449 lines). Category-driven concept selection: food->4188027, medication->439224, default->40772948. Substance -> value_as_concept_id. Type concept = 38000280.
- omoponfhir-v54(java) refs/refs/omoponfhir-v54-r4/omoponfhir-omopv5-r4-mapping/src/main/java/edu/gatech/chai/omoponfhir/omopv5/r4/mapping/OmopAllergyIntolerance.java:350-450 — 450 lines. Identical logic to omoponfhir.
- FhirToCdm(csharp) refs/refs/FhirToCdm/FhirToCdmMappings.cs:453-480 — Maps AllergyIntolerance -> observation via vocabulary lookup on code. Uses recordedDate for date. No status filtering. Minimal field coverage.
- fhir-to-omop-demo(jq) refs/refs/fhir-to-omop-demo/demo/translate/map/AllergyIntolerance.jq — 48 lines. Divergent: maps to condition_occurrence (not observation). Uses recordedDate for start date. Type concept = 32817.