DEVICE-from-procedures ====================== *Source file:* ``DEVICE-from-procedures.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.7' or @root='2.16.840.1.113883.10.20.22.2.7.1' or @root='2.16.840.1.113883.10.20.22.2.23']/../hl7:entry/hl7:procedure **Expected OMOP domain:** Device Fields ------ +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Type | Order | Details | +================================================+==========+=======+===============================================================================================================================================================================================================================================================+ | device_exposure_id | HASH | 1 | hash(person_id, provider_id, device_concept_id_code, device_concept_id_codeSystem, device_exposure_start_date, device_exposure_start_datetime, device_exposure_end_date, device_exposure_end_datetime, device_exposure_id_root, device_exposure_id_extension) | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | person_id | FK | 2 | FK → ``person_id`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_concept_id | DERIVED | 3 | ``VT.codemap_xwalk_concept_id(concept_code=device_concept_id_code, vocabulary_oid=device_concept_id_codeSystem)`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_start_date | PRIORITY | 4 | coalesce candidates by priority | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_start_datetime | PRIORITY | 5 | coalesce candidates by priority | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_end_date | PRIORITY | 6 | coalesce candidates by priority | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_end_datetime | PRIORITY | 7 | coalesce candidates by priority | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_type_concept_id | CONSTANT | 8 | ``32817`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unique_device_id | FIELD | 9 | ``hl7:participant/hl7:participantRole/hl7:id[@root='2.16.840.1.113883.3.3719']`` @extension | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | quantity | None | 10 | — | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | provider_id | FK | 11 | FK → ``provider_id`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | visit_occurrence_id | FK | 12 | FK → ``visit_occurrence_id`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | visit_detail_id | None | 13 | — | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_source_value | DERIVED | 14 | ``VT.concat_fields(first_field=device_concept_id_code, second_field=device_concept_id_codeSystem)`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_source_concept_id | DERIVED | 15 | ``VT.codemap_xwalk_source_concept_id(concept_code=device_concept_id_code, vocabulary_oid=device_concept_id_codeSystem)`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | data_partner_id | DERIVED | 20 | ``VT.get_data_partner_id(filename=filename)`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | filename | FILENAME | 100 | source XML filename | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | cfg_name | CONSTANT | 101 | ``DEVICE-from-procedures`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_concept_id_code | FIELD | | ``hl7:participant/hl7:participantRole/hl7:playingDevice/hl7:code`` @code | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_concept_id_codeSystem | FIELD | | ``hl7:participant/hl7:participantRole/hl7:playingDevice/hl7:code`` @codeSystem | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_end_date_procedure_high | FIELD | | ``hl7:effectiveTime/hl7:high[not(@nullFlavor='UNK')]`` @value [DATE] → priority ('device_exposure_end_date', 1) | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_end_datetime_procedure_high | FIELD | | ``hl7:effectiveTime/hl7:high[not(@nullFlavor='UNK')]`` @value [DATETIME_HIGH] → priority ('device_exposure_end_datetime', 1) | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_id_extension | FIELD | | ``hl7:id[not(@nullFlavor="UNK")]`` @extension | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_id_root | FIELD | | ``hl7:id[not(@nullFlavor="UNK")]`` @root | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_start_date_procedure_low | FIELD | | ``hl7:effectiveTime/hl7:low`` @value [DATE] → priority ('device_exposure_start_date', 1) | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_start_date_procedure_value | FIELD | | ``hl7:effectiveTime`` @value [DATE] → priority ('device_exposure_start_date', 2) | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_start_datetime_procedure_low | FIELD | | ``hl7:effectiveTime/hl7:low`` @value [DATETIME_LOW] → priority ('device_exposure_start_datetime', 1) | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | device_exposure_start_datetime_procedure_value | FIELD | | ``hl7:effectiveTime`` @value [DATETIME_LOW] → priority ('device_exposure_start_datetime', 2) | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | domain_id | DERIVED | | ``VT.codemap_xwalk_domain_id(concept_code=device_concept_id_code, vocabulary_oid=device_concept_id_codeSystem)`` | +------------------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 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) | +-------------+----------------------------------------------------------------+