Observation

Source file: observation.py

Root XPath

./hl7:component/hl7:structuredBody/hl7:component/hl7:section/hl7:templateId[@root='2.16.840.1.113883.10.20.22.2.3.1'  or @root='2.16.840.1.113883.10.20.22.2.3']/../hl7:entry/hl7:organizer/hl7:component/hl7:observation

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

PRIORITY

4

coalesce candidates by priority

observation_datetime

PRIORITY

5

coalesce candidates by priority

observation_type_concept_id

CONSTANT

6

32827

value_as_number

FIELD

7

hl7:value[@xsi:type="PQ"] @value [FLOAT]

value_as_string

FIELD

8

hl7:value @#text

value_as_concept_id

PRIORITY

9

coalesce candidates by priority

qualifier_concept_id

None

10

unit_concept_id

DERIVED

11

VT.codemap_xwalk_concept_id(concept_code=unit_source_value, vocabulary_oid=unit_codeSystem)

provider_id

None

12

visit_occurrence_id

FK

13

FK → visit_occurrence_id

visit_detail_id

None

14

observation_source_value

DERIVED

15

VT.concat_fields(first_field=observation_concept_code, second_field=observation_concept_codeSystem)

observation_source_concept_id

None

16

unit_source_value

FIELD

17

hl7:value @unit

qualifier_source_value

CONSTANT

18

data_partner_id

DERIVED

20

VT.get_data_partner_id(filename=filename)

filename

FILENAME

100

source XML filename

cfg_name

CONSTANT

101

Observation

domain_id

DERIVED

VT.codemap_xwalk_domain_id(concept_code=observation_concept_code, vocabulary_oid=observation_concept_codeSystem)

observation_concept_code

FIELD

hl7:code @code

observation_concept_codeSystem

FIELD

hl7:code @codeSystem

observation_date_effectiveTime

FIELD

hl7:effectiveTime @value [DATE] → priority [‘observation_date’, 1]

observation_date_high

FIELD

hl7:effectiveTime/hl7:high @value [DATE] → priority [‘observation_date’, 3]

observation_date_low

FIELD

hl7:effectiveTime/hl7:low @value [DATE] → priority [‘observation_date’, 2]

observation_datetime_effectiveTime

FIELD

hl7:effectiveTime @value [DATETIME] → priority [‘observation_datetime’, 1]

observation_datetime_high

FIELD

hl7:effectiveTime/hl7:high @value [DATETIME] → priority [‘observation_datetime’, 3]

observation_datetime_low

FIELD

hl7:effectiveTime/hl7:low @value [DATETIME] → priority [‘observation_datetime’, 2]

observation_id_extension

FIELD

hl7:id[not(@nullFlavor="UNK")] @extension

observation_id_root

FIELD

hl7:id[not(@nullFlavor="UNK")] @root

unit_codeSystem

CONSTANT

http://unitsofmeasure.org

value_as_codeSystem_CD

FIELD

hl7:value[@xsi:type="CD"] @codeSystem

value_as_codeSystem_CE

FIELD

hl7:value[@xsi:type="CE"] @codeSystem

value_as_code_CD

FIELD

hl7:value[@xsi:type="CD"] @code

value_as_code_CE

FIELD

hl7:value[@xsi:type="CE"] @code

value_as_concept_id_CD

DERIVED

VT.codemap_xwalk_concept_id(concept_code=value_as_code_CD, vocabulary_oid=value_as_codeSystem_CD)

value_as_concept_id_CE

DERIVED

VT.codemap_xwalk_concept_id(concept_code=value_as_code_CE, vocabulary_oid=value_as_codeSystem_CE)

value_as_concept_id_na

CONSTANT

0

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)