refs/refs/fhir-to-omop-demo/data/convert/mapping/010-DiagnosticReport-note.sh

lines 14–29 128 lines · sh
1#!/bin/bash
3# Converts FHIR DiagnosticReport resources to OMOPCDM note records.
5source _common.sh
7REPO="https://github.com/barabo/fhir-to-omop-demo"
8FILE="data/convert/mapping/010-DiagnosticReport-note.sh"
10simple_map '
11#--------------------------#-----------------------------#-------------------#
12# FHIR DiagnosticReport # OMOP note # Notes #
13#--------------------------#-----------------------------#-------------------#
14 null, # note_id # REQUIRED #
15 null, # person_id # REQUIRED #
16 null, # note_date # REQUIRED #
17 null, # note_datetime # set the time to midnight if not given
18 null, # note_type_concept_id # REQUIRED #
19 null, # note_class_concept_id # REQUIRED #
20 null, # note_title #
21 null, # note_text # REQUIRED #
22 null, # encoding_concept_id # REQUIRED #
23 null, # language_concept_id # REQUIRED #
24 null, # provider_id #
25 null, # visit_occurrence_id #
26 null, # visit_detail_id #
27 null, # note_source_value #
28 null, # note_event_id #
29 null, # note_event_field_concept_id #
30#--------------------------#-----------------------------#-------------------#
33exit 0
35cat <<NOTES # Everything below is notes.
37# Terminology search:
38https://athena.ohdsi.org/search-terms/terms
40# OMOP CDM 5.4 note TABLE
41https://ohdsi.github.io/CommonDataModel/cdm54.html#note
42CREATE TABLE note (
43 note_id integer NOT NULL PRIMARY KEY,
44 person_id integer NOT NULL REFERENCES PERSON (PERSON_ID),
45 note_date date NOT NULL,
46 note_datetime datetime NULL,
47 note_type_concept_id integer NOT NULL REFERENCES CONCEPT (CONCEPT_ID),
48 note_class_concept_id integer NOT NULL REFERENCES CONCEPT (CONCEPT_ID),
49 note_title TEXT NULL,
50 note_text TEXT NOT NULL,
51 encoding_concept_id integer NOT NULL REFERENCES CONCEPT (CONCEPT_ID),
52 language_concept_id integer NOT NULL REFERENCES CONCEPT (CONCEPT_ID),
53 provider_id integer NULL REFERENCES PROVIDER (PROVIDER_ID),
54 visit_occurrence_id integer NULL REFERENCES VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID),
55 visit_detail_id integer NULL REFERENCES VISIT_DETAIL (VISIT_DETAIL_ID),
56 note_source_value TEXT NULL,
57 note_event_id integer NULL,
58 note_event_field_concept_id integer NULL REFERENCES CONCEPT (CONCEPT_ID)
59);
61# FHIR R4 Example DiagnosticReport Resource
62https://www.hl7.org/fhir/R4B/DiagnosticReport.html
64 "resourceType": "DiagnosticReport",
65 "id": "4220",
66 "meta": {
67 "versionId": "1",
68 "lastUpdated": "2024-06-01T20:19:17.304+00:00",
69 "source": "#8IRCgpLiSxJLv3VD",
70 "profile": [
71 "http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note"
72 ]
73 },
74 "status": "final",
75 "category": [
76 {
77 "coding": [
78 {
79 "system": "http://loinc.org",
80 "code": "34117-2",
81 "display": "History and physical note"
82 },
83 {
84 "system": "http://loinc.org",
85 "code": "51847-2",
86 "display": "Evaluation+Plan note"
87 }
88 ]
89 }
90 ],
91 "code": {
92 "coding": [
93 {
94 "system": "http://loinc.org",
95 "code": "34117-2",
96 "display": "History and physical note"
97 },
98 {
99 "system": "http://loinc.org",
100 "code": "51847-2",
101 "display": "Evaluation+Plan note"
102 }
103 ]
104 },
105 "subject": {
106 "reference": "Patient/4217"
107 },
108 "encounter": {
109 "reference": "Encounter/4218"
110 },
111 "effectiveDateTime": "1959-02-22T06:37:53-05:00",
112 "issued": "1959-02-22T06:37:53.630-05:00",
113 "performer": [
114 {
115 "reference": "Practitioner/2187",
116 "display": "Dr. Douglass930 Windler79"
117 }
118 ],
119 "presentedForm": [
120 {
121 "contentType": "text/plain",
122 "data": "CjE5NTktMDItMjIKCiMgQ2hpZWYgQ29tcGxhaW50Ck5vIGNvbXBsYWludHMuCgojIEhpc3Rvcnkgb2YgUHJlc2VudCBJbGxuZXNzCkh1bWJlcnRvNDgyCiBpcyBhIDM1IHllYXItb2xkIG5vbi1oaXNwYW5pYyB3aGl0ZSBtYWxlLgoKIyBTb2NpYWwgSGlzdG9yeQpQYXRpZW50IGlzIG1hcnJpZWQuIFBhdGllbnQgaXMgYW4gYWN0aXZlIHNtb2tlciBhbmQgaXMgYW4gYWxjb2hvbGljLgogUGF0aWVudCBpZGVudGlmaWVzIGFzIGhldGVyb3NleHVhbC4KClBhdGllbnQgY29tZXMgZnJvbSBhIGhpZ2ggc29jaW9lY29ub21pYyBiYWNrZ3JvdW5kLgogUGF0aWVudCBoYXMgY29tcGxldGVkIHNvbWUgY29sbGVnZSBjb3Vyc2VzLgpQYXRpZW50IGN1cnJlbnRseSBoYXMgSHVtYW5hLgoKIyBBbGxlcmdpZXMKTm8gS25vd24gQWxsZXJnaWVzLgoKIyBNZWRpY2F0aW9ucwpObyBBY3RpdmUgTWVkaWNhdGlvbnMuCgojIEFzc2Vzc21lbnQgYW5kIFBsYW4KUGF0aWVudCBpcyBwcmVzZW50aW5nIHdpdGggYm9keSBtYXNzIGluZGV4IDMwKyAtIG9iZXNpdHkgKGZpbmRpbmcpLiAKCiMjIFBsYW4KCg=="
123 }
124 ]
127NOTES