Table name: visit_detail
Reading from hesin_c.txt
Create a new field ‘record_source_value’ for lookup of visit_detail_id by eid and ins_index.
Every record of hesin episode is a visit_detail record. Episodes are combined into spells (one visit_occurrence record), which are a total continuous stay of a patient in a single hospital from admission to discharge.
Destination Field | Source field | Logic | Comment field |
---|---|---|---|
visit_detail_id | eid ins_index | Concatenate eid and ins_index | |
person_id | eid | ||
visit_occurrence_id | eid spell_index | Lookup vist_occurrence_id by eid and spellindex eid=visit_occurrence.person_id ‘HES-spell_index’=visit_occurrence.record_source_value | |
visit_detail_start_date | epistart | if missing use the admission date “admidate”. If both empty us default date 01/01/1970 | |
visit_detail_start_datetime | epistart | ||
visit_detail_end_date | epiend | if missing use start_date | |
visit_detail_end_datetime | epiend | ||
visit_detail_concept_id | admimeth dsource | Map same as for visit_occurrence | |
visit_detail_source_value | admimeth dsource | “record origin: dsource/admission method: admimeth” | |
visit_detail_type_concept_id | 32827, # ‘EHR encounter record’ | ||
provider_id | This can be retrieved from either hesin.mainspef or hesin.tretspef. Not implemented. | ||
care_site_id | |||
visit_source_concept_id | |||
admitting_source_value | admisorc dsource | “record origin: dsource/admission source: admisorc” | |
admitting_source_concept_id | admisorc dsource | ||
discharge_to_source_value | disdest dsource | “record origin: dsource/discharge destination: disdest | |
discharge_to_concept_id | disdest dsource | ||
preceding_visit_detail_id | |||
visit_detail_parent_id | |||
data_source | dsource | “HES-dsource” |