Medication_medication_dispense ============================== *Source file:* ``medication_medication_dispense.py`` Root XPath ---------- .. code-block:: xpath ./hl7:component/hl7:structuredBody/hl7:component/hl7:section/hl7:templateId[@root="2.16.840.1.113883.10.20.22.2.1" or @root="2.16.840.1.113883.10.20.22.2.1.1"]/../hl7:entry/hl7:substanceAdministration[@moodCode="INT" or @moodCode="EVN"]/hl7:entryRelationship/hl7:supply/hl7:statusCode[@code="active" or @code="completed"]/hl7:statusCode[@code="active" or @code="completed"]/../hl7:templateId[@root="2.16.840.1.113883.10.20.22.4.18"]/../hl7:product/hl7:manufacturedProduct/hl7:manufacturedMaterial **Expected OMOP domain:** Drug Fields ------ +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Type | Order | Details | +====================================+==========+=======+===================================================================================================================================================================================================================================================+ | drug_exposure_id | HASH | 1 | hash(person_id, provider_id, drug_concept_code, drug_concept_codeSystem, drug_exposure_start_date, drug_exposure_start_datetime, drug_exposure_end_date, drug_exposure_end_datetime, quantity, drug_exposure_id_root, drug_exposure_id_extension) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | person_id | FK | 2 | FK → ``person_id`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_concept_id | DERIVED | 3 | ``VT.codemap_xwalk_concept_id(concept_code=drug_concept_code, vocabulary_oid=drug_concept_codeSystem)`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_start_date | PRIORITY | 4 | coalesce candidates by priority | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_start_datetime | PRIORITY | 5 | coalesce candidates by priority | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_end_date | PRIORITY | 6 | coalesce candidates by priority | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_end_datetime | PRIORITY | 7 | coalesce candidates by priority | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | verbatim_end_date | FIELD | 8 | ``../../../hl7:effectiveTime/hl7:high[not(@nullFlavor="UNK")]`` @value [DATE] | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_type_concept_id | CONSTANT | 9 | ``32825`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | stop_reason | CONSTANT | 10 | ```` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | refills | None | 11 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | quantity | FIELD | 12 | ``../../../hl7:quantity`` @value [FLOAT] | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | days_supply | None | 13 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | sig | None | 14 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | route_concept_id | None | 15 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | lot_number | None | 16 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | provider_id | FK | 17 | FK → ``provider_id`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | visit_occurrence_id | FK | 18 | FK → ``visit_occurrence_id`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | visit_detail_id | None | 19 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_source_value | DERIVED | 20 | ``VT.concat_fields(first_field=drug_concept_code, second_field=drug_concept_codeSystem)`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_source_concept_id | DERIVED | 21 | ``VT.codemap_xwalk_source_concept_id(concept_code=drug_concept_code, vocabulary_oid=drug_concept_codeSystem)`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | route_source_value | None | 22 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | dose_unit_source_value | FIELD | 23 | ``../../../hl7:doseQuantity`` @unit | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | data_partner_id | DERIVED | 24 | ``VT.get_data_partner_id(filename=filename)`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | filename | FILENAME | 100 | source XML filename | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | cfg_name | CONSTANT | 101 | ``Medication_medication_dispense`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | domain_id | DERIVED | | ``VT.codemap_xwalk_domain_id(concept_code=drug_concept_code, vocabulary_oid=drug_concept_codeSystem)`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_concept_code | FIELD | | ``hl7:code`` @code | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_concept_codeSystem | FIELD | | ``hl7:code`` @codeSystem | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_end_date_high | FIELD | | ``../../../hl7:effectiveTime/hl7:high[not(@nullFlavor='UNK')]`` @value [DATE] → priority ('drug_exposure_end_date', 1) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_end_date_low | FIELD | | ``../../../hl7:effectiveTime/hl7:low[not(@nullFlavor='UNK')]`` @value [DATE] → priority ('drug_exposure_end_date', 3) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_end_date_value | FIELD | | ``../../../hl7:effectiveTime`` @value [DATE] → priority ('drug_exposure_end_date', 2) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_end_datetime_high | FIELD | | ``../../../hl7:effectiveTime/hl7:high[not(@nullFlavor='UNK')]`` @value [DATETIME_HIGH] → priority ('drug_exposure_end_datetime', 1) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_end_datetime_low | FIELD | | ``../../../hl7:effectiveTime/hl7:low[not(@nullFlavor='UNK')]`` @value [DATETIME_HIGH] → priority ('drug_exposure_end_datetime', 3) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_end_datetime_value | FIELD | | ``../../../hl7:effectiveTime`` @value [DATETIME_HIGH] → priority ('drug_exposure_end_datetime', 2) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_id_extension | FIELD | | ``../../../hl7:id[not(@nullFlavor="UNK")]`` @extension | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_id_root | FIELD | | ``../../../hl7:id[not (@nullFlavor="UNK")]`` @root | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_start_date_high | FIELD | | ``../../../hl7:effectiveTime/hl7:high`` @value [DATE] → priority ['drug_exposure_start_date', 3] | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_start_date_low | FIELD | | ``../../../hl7:effectiveTime/hl7:low[not(@nullFlavor="UNK")]`` @value [DATE] → priority ('drug_exposure_start_date', 1) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_start_date_value | FIELD | | ``../../../hl7:effectiveTime`` @value [DATE] → priority ('drug_exposure_start_date', 2) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_start_datetime_high | FIELD | | ``../../../hl7:effectiveTime/hl7:high`` @value [DATETIME_LOW] → priority ['drug_exposure_start_datetime', 3] | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_start_datetime_low | FIELD | | ``../../../hl7:effectiveTime/hl7:low[not(@nullFlavor='UNK')]`` @value [DATETIME_LOW] → priority ('drug_exposure_start_datetime', 2) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | drug_exposure_start_datetime_value | FIELD | | ``../../../hl7:effectiveTime`` @value [DATETIME_LOW] → priority ('drug_exposure_start_datetime', 2) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Config type reference --------------------- +-------------+----------------------------------------------------------------+ | config_type | Meaning | +=============+================================================================+ | ROOT | Defines the XPath root element for this config | +-------------+----------------------------------------------------------------+ | FIELD | Extracts an XML attribute value via XPath | +-------------+----------------------------------------------------------------+ | DERIVED | Computed by a Python function from other fields | +-------------+----------------------------------------------------------------+ | HASH | MD5/hash of a set of fields, used as a surrogate key | +-------------+----------------------------------------------------------------+ | FK | Foreign key copied from a joined dataset | +-------------+----------------------------------------------------------------+ | CONSTANT | Fixed literal value written to every row | +-------------+----------------------------------------------------------------+ | PRIORITY | Coalesces the first non-null value from prioritized candidates | +-------------+----------------------------------------------------------------+ | FILENAME | The source XML filename | +-------------+----------------------------------------------------------------+ | None | Not populated (placeholder) | +-------------+----------------------------------------------------------------+