MedicationRequest.jq · fhir2omop
refs/refs/fhir-to-omop-demo/demo/translate/map/MedicationRequest.jq
lines 61–61
81 lines · jq
2# Transforms FHIR MedicationRequests into OMOP table records. 9# Include the route_concept_id in the drug concept. 11 if has("medicationCodeableConcept") then 12 if (.medicationCodeableConcept.coding | length) > 1 then 13 debug("Multiple medicationCodeableConcept.codings in MedicationRequest/\(.id)") 15 | .medicationCodeableConcept.coding[0].concept 20 "route_concept_id": null, 21 "source_concept_id": null 27# See: https://ohdsi.github.io/CommonDataModel/drug_dose.html 28# TODO: include the 'has dose form' value in concept 29# TODO: include numerator in concept 30# TODO: if there is a dosageQuantity, use it, too 32 if (drug | has("drug") and drug.has_dose_form) then 39# If this is a MedicationReference, then the contents of this record will be 40# merged with the Medication record contents in the next phase of loading. 42 if has("medicationReference") then 43 .medicationReference.id 52 "drug_exposure", # TABLE COLUMNS 53 id, # drug_exposure_id 54 .subject.id, # person_id 55 drug.concept_id, # drug_concept_id 56 .authoredOn, # drug_exposure_start_date 57 .authoredOn, # drug_exposure_start_datetime 58 null, # drug_exposure_end_date 59 null, # drug_exposure_end_datetime 60 null, # verbatim_end_date 61 32838, # drug_type_concept_id - EHR prescription 67 drug.route_concept_id, # route_concept_id 69 .requester.id, # provider_id 70 .encounter.id, # visit_occurrence_id 71 null, # visit_detail_id 72 drug.concept_code, # drug_source_value 73 drug.source_concept_id, # drug_source_concept_id 74 null, # route_source_value 75 null # dose_unit_source_value 78 ((.[0] == "drug_exposure") and length == 24)