Medication.jq · fhir2omop
refs/refs/fhir-to-omop-demo/demo/translate/map/Medication.jq
72 lines · jq
2# Transforms FHIR Medication into OMOP table records. 4# This transformation is needed to populate missing medication information 5# from the MedicationRequest records when a MedicationReference is used. 12# Select the drug concept from the Medication record. 16 if (.code.coding | length) > 1 then 17 error("Multiple code.codings in Medication/\(.id)") 19 | .code.coding[0].concept 24 "route_concept_id": null, 25 "source_concept_id": null 30# See: https://ohdsi.github.io/CommonDataModel/drug_dose.html 31# TODO: include the 'has dose form' value in concept 32# TODO: include numerator in concept 33# TODO: if there is a dosageQuantity, use it, too 35 if (drug | has("drug") and drug.has_dose_form) then 46 .id, # drug_exposure_id 48 drug.concept_id, # drug_concept_id 49 null, # drug_exposure_start_date 50 null, # drug_exposure_start_datetime 51 null, # drug_exposure_end_date 52 null, # drug_exposure_end_datetime 53 null, # verbatim_end_date 54 null, # drug_type_concept_id - EHR prescription 60 drug.route_concept_id, # route_concept_id 63 null, # visit_occurrence_id 64 null, # visit_detail_id 65 drug.concept_code, # drug_source_value 66 drug.source_concept_id, # drug_source_concept_id 67 null, # route_source_value 68 null # dose_unit_source_value