Observation_social_history_pregnancy ==================================== *Source file:* ``observation_social_history_pregnancy.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.17']/../hl7:entry/hl7:observation/hl7:templateId[@root='2.16.840.1.113883.10.20.15.3.8']/.. **Expected OMOP domain:** Observation Fields ------ +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Type | Order | Details | +====================================+==========+=======+=========================================================================================================================================================================================================================================================+ | observation_id | HASH | 1 | hash(person_id, provider_id, observation_concept_code, observation_concept_codeSystem, observation_date, observation_datetime, value_as_string, value_as_number, value_as_concept_id, observation_id_extension, observation_id_root, unit_source_value) | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | person_id | FK | 2 | FK → ``person_id`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_concept_id | DERIVED | 3 | ``VT.codemap_xwalk_concept_id(concept_code=observation_concept_code, vocabulary_oid=observation_concept_codeSystem)`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_date | FIELD | 4 | ``hl7:effectiveTime/hl7:value`` @value [DATE] | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_datetime | PRIORITY | 5 | coalesce candidates by priority | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_type_concept_id | CONSTANT | 6 | ``32035`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | value_as_number | None | 7 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | value_as_string | None | 8 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | value_as_concept_id | DERIVED | 9 | ``VT.codemap_xwalk_concept_id(concept_code=value_as_code, vocabulary_oid=value_as_codeSystem)`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | qualifier_concept_id | None | 10 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unit_concept_id | None | 11 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | provider_id | None | 12 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | visit_occurrence_id | FK | 13 | FK → ``visit_occurrence_id`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | visit_detail_id | None | 14 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_source_value | FIELD | 15 | ``hl7:code`` @code | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_source_concept_id | None | 16 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unit_source_value | None | 17 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | qualifier_source_value | None | 18 | — | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | data_partner_id | DERIVED | 22 | ``VT.get_data_partner_id(filename=filename)`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | filename | FILENAME | 100 | source XML filename | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | cfg_name | CONSTANT | 101 | ``Observation_social_history_pregnancy`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | domain_id | DERIVED | | ``VT.codemap_xwalk_domain_id(concept_code=observation_concept_code, vocabulary_oid=observation_concept_codeSystem)`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_concept_code | CONSTANT | | ``289908002`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_concept_codeSystem | CONSTANT | | ``2.16.840.1.113883.6.96`` | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_datetime_effectiveTime | FIELD | | ``hl7:effectiveTime`` @value [DATETIME_LOW] → priority ['observation_datetime', 1] | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_datetime_high | FIELD | | ``hl7:effectiveTime/hl7:high`` @value [DATETIME_HIGH] → priority ['observation_datetime', 3] | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_datetime_low | FIELD | | ``hl7:effectiveTime/hl7:low`` @value [DATETIME_LOW] → priority ['observation_datetime', 2] | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_id_extension | FIELD | | ``hl7:id[not(@nullFlavor="UNK")]`` @extension | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | observation_id_root | FIELD | | ``hl7:id[not(@nullFlavor="UNK")]`` @root | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | value_as_code | FIELD | | ``hl7:value`` @code | +------------------------------------+----------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | value_as_codeSystem | FIELD | | ``hl7:value`` @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) | +-------------+----------------------------------------------------------------+