-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathPatient.yml
407 lines (373 loc) · 10.7 KB
/
Patient.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
#
# (C) Copyright IBM Corp. 2020, 2022
#
# SPDX-License-Identifier: Apache-2.0
#
resourceType: Patient
# Represents data that needs to be extracted for a Patient Resource in FHIR
# reference: https://www.hl7.org/fhir/patient.html
id:
type: STRING
valueOf: "GeneralUtils.generateResourceId()"
expressionType: JEXL
identifier_1:
valueOf: datatype/Identifier_SystemID
generateList: true
expressionType: resource
specs: PID.3
vars:
assignerSystem: String, PID.3.4
# When the Coverage.subscriber from IN1.17 is NOT self use PID.19 for SSN identifier
identifier_2a:
condition: $valueIn NOT_NULL && $subscriberValue NOT_EQUALS SEL
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
vars:
valueIn: CLEAN_SSN, PID.19 # subscriber SSN
subscriberValue: String, IN1.17.1 # subscriber relationship
constants:
system: http://terminology.hl7.org/CodeSystem/v2-0203
code: SS
display: Social Security number
# There is no text for PID.19
# When IN1.17 is empty and the Coverage.subscriber from IN2.72 is NOT self use PID.19 for SSN identifier
identifier_2b:
condition: $valueIn NOT_NULL && $valueIN117 NULL && $subscriberValue NOT_EQUALS 01
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
vars:
valueIn: CLEAN_SSN, PID.19 # subscriber SSN
subscriberValue: String, IN2.72 # subscriber relationship
valueIN117: IN1.17.1
constants:
system: http://terminology.hl7.org/CodeSystem/v2-0203
code: SS
display: Social Security number
# There is no text for PID.19
# When IN1.17 and IN2.72 are both empty use PID.19 for SSN identifier
# (Required edge case because NOT_EQUALS is not the same as NULL)
identifier_2c:
condition: $valueIn NOT_NULL && $valueIN117 NULL && $valueIN272 NULL
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
vars:
valueIn: CLEAN_SSN, PID.19 # subscriber SSN
valueIN272: String, IN2.72 # subscriber relationship
valueIN117: IN1.17.1
constants:
system: http://terminology.hl7.org/CodeSystem/v2-0203
code: SS
display: Social Security number
# There is no text for PID.19
# When the Coverage.subscriber from IN1.17 IS self use PID.19 / IN2.2 for SSN identifier
identifier_2d:
condition: $valueIn NOT_NULL && $subscriberValue EQUALS SEL
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
vars:
valueIn: CLEAN_SSN, PID.19 | IN2.2 # subscriber SSN
subscriberValue: String, IN1.17 # subscriber relationship
constants:
system: http://terminology.hl7.org/CodeSystem/v2-0203
code: SS
display: Social Security number
# There is no text for PID.19
# When IN1.17 is empty and the Coverage.subscriber from IN2.72 IS self use PID.19 / IN2.2 for SSN identifier
identifier_2e:
condition: $valueIn NOT_NULL && $valueIN117 NULL && $subscriberValue EQUALS 01
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
vars:
valueIn: CLEAN_SSN, PID.19 | IN2.2 # subscriber SSN
valueIN117: IN1.17.1
subscriberValue: String, IN2.72 # subscriber relationship
constants:
system: http://terminology.hl7.org/CodeSystem/v2-0203
code: SS
display: Social Security number
# There is no text for PID.19
identifier_3:
condition: $valueIn NOT_NULL
valueOf: datatype/Identifier_var
generateList: true
# There is no authority for PID.20
expressionType: resource
# Gets the Driver's license from PID.20, formats and adds it as an ID
vars:
valueIn: String, PID.20.1
constants:
system: http://terminology.hl7.org/CodeSystem/v2-0203
code: DL
display: Driver's license number
# There is no text for PID.20
identifier_4:
condition: $mrgIdentifier NOT_NULL
valueOf: datatype/Identifier_SystemID
generateList: true
expressionType: resource
specs: MRG.1
constants:
use: old
mrgIdentifier: MRG.1
# Add the old MR # from the MRG segment
# identifier_5a and _5b are two parts to complex logic
# Only include IN1.49 as an identifier when the subscriber is not self AND a relatedPerson is created
identifier_5a:
condition: $valueIn NOT_NULL && $subscriberValue NOT_EQUALS SEL && $createRelatedPerson EQUALS TRUE
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
specs: IN1.49
vars:
valueIn: String, IN1.49.1
systemCX: IN1.49.4
code: IN1.49.5
subscriberValue: String, IN1.17.1 # subscriber relationship
createRelatedPerson: RELATED_PERSON_NEEDED_IN117, IN1.17
constants:
system: http://terminology.hl7.org/CodeSystem/v2-0203
identifier_5b:
condition: $valueIn NOT_NULL && $valueIN117 NULL && $subscriberValue NOT_EQUALS 01 && $createRelatedPerson EQUALS TRUE
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
specs: IN1.49
vars:
valueIn: String, IN1.49.1
systemCX: IN1.49.4
code: IN1.49.5
subscriberValue: String, IN2.72 # subscriber relationship
createRelatedPerson: RELATED_PERSON_NEEDED_IN272, IN2.72
valueIN117: IN1.17.1
constants:
system: http://terminology.hl7.org/CodeSystem/v2-0203
# identifier_6a and _6b are two parts to complex logic
# Only include when the subscriber is self, uses IN1.17
identifier_6a:
condition: $valueIn NOT_NULL && $valueIN117 EQUALS SEL
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
vars:
valueIn: IN2.61 | IN1.36
valueIN117: String, IN1.17.1 # subscriber relationship
# No systemCX set for this identifier
constants:
system: "http://terminology.hl7.org/CodeSystem/v2-0203"
code: "MB"
display: "Member Number"
# Only include when the subscriber is self
# IN2.72 only gets used if IN1.17 priority is empty (see identifier_6a)
identifier_6b:
condition: $valueIn NOT_NULL && $valueIN117 NULL && $valueIN272 EQUALS 01
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
vars:
valueIn: IN2.61 | IN1.36
valueIN117: IN1.17.1
valueIN272: String, IN2.72 # subscriber relationship
# No systemCX set for this identifier
constants:
system: "http://terminology.hl7.org/CodeSystem/v2-0203"
code: "MB"
display: "Member Number"
identifier_7:
condition: $valueIn NOT_NULL
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
vars:
valueIn: IN2.8
# No systemCX set for this identifier
constants:
system: "http://terminology.hl7.org/CodeSystem/v2-0203"
code: "MA"
display: "Patient Medicaid number"
identifier_8:
condition: $valueIn NOT_NULL
valueOf: datatype/Identifier_var
generateList: true
expressionType: resource
vars:
valueIn: IN2.6
# No systemCX set for this identifier
constants:
system: "http://terminology.hl7.org/CodeSystem/v2-0203"
code: "MC"
display: "Patient's Medicare number"
name:
valueOf: datatype/HumanName
generateList: true
expressionType: resource
specs: PID.5
gender:
type: ADMINISTRATIVE_GENDER
valueOf: PID.8
expressionType: HL7Spec
address:
valueOf: datatype/Address
generateList: true
expressionType: resource
specs: PID.11
vars:
# Used in Address to create district for patient address
# In future, they could be processed in a DataValueResolver.
distPatientCounty: String, PID.12
distAddressCountyParish: String, PID.11.9
distPatient: PID
telecom_1:
condition: $pid14 NOT_NULL
valueOf: datatype/ContactPoint
generateList: true
expressionType: resource
specs: PID.14
vars:
pid14: PID.14
constants:
use: work
telecom_2:
condition: $pid13 NOT_NULL
valueOf: datatype/ContactPoint
generateList: true
expressionType: resource
specs: PID.13
vars:
pid13: PID.13
constants:
use: home
# The yaml is processed in reverse order, therefore
# Put the PID.13 last in yaml so it is first to be processed
birthDate:
type: DATE
valueOf: PID.7
expressionType: HL7Spec
multipleBirthBoolean_1:
condition: $multBool NOT_NULL && $multInt NULL
type: BOOLEAN
valueOf: PID.24
expressionType: HL7Spec
vars:
multBool: PID.24
multInt: PID.25
multipleBirthBoolean_2:
condition: $multBool EQUALS N
type: BOOLEAN
valueOf: PID.24
expressionType: HL7Spec
vars:
multBool: String, PID.24
multInt: PID.25
multipleBirthInteger_1:
condition: $multBool NULL && $multInt NOT_NULL
type: INTEGER
valueOf: PID.25
expressionType: HL7Spec
vars:
multBool: String, PID.24
multInt: PID.25
multipleBirthInteger_2:
condition: $multBool EQUALS Y && $multInt NOT_NULL
type: INTEGER
valueOf: PID.25
expressionType: HL7Spec
vars:
multBool: String, PID.24
multInt: PID.25
deceasedBoolean:
condition: $deceasedBool NOT_NULL && $deceasedDateTime NULL
type: BOOLEAN
valueOf: PID.30
expressionType: HL7Spec
vars:
deceasedBool: PID.30
deceasedDateTime: PID.29
deceasedDateTime:
condition: $dateTimeIn NOT_NULL
type: STRING
valueOf: "GeneralUtils.dateTimeWithZoneId(dateTimeIn,ZONEID)"
expressionType: JEXL
vars:
dateTimeIn: PID.29
maritalStatus:
valueOf: datatype/CodeableConcept
expressionType: resource
condition: $coding NOT_NULL
vars:
coding: MARITAL_STATUS, PID.16
text: String, PID.16.2
generalPractitioner:
condition: $practitionerVal NOT_NULL
valueOf: resource/Practitioner
generateList: true
expressionType: reference
specs: PD1.4
vars:
practitionerVal: PD1.4
extension:
generateList: true
expressionType: nested
expressions:
- condition: $value NOT_NULL
valueOf: extension/Extension
expressionType: resource
vars:
value: String, PID.6.1
constants:
KEY_NAME_SUFFIX: String
urlValue: mothersMaidenName
- expressionType: nested
expressionsMap:
url:
type: SYSTEM_URL
value: "religion"
valueCodeableConcept:
valueOf: datatype/CodeableConcept
expressionType: resource
condition: $coding NOT_NULL
vars:
coding: RELIGIOUS_AFFILIATION_CC, PID.17
text: String, PID.17.2
- expressionType: nested
specs: PID.10
generateList: true
expressionsMap:
url:
type: SYSTEM_URL
value: "race"
valueCodeableConcept:
valueOf: datatype/CodeableConcept
expressionType: resource
specs: CWE
communication:
condition: $language NOT_NULL
valueOf: secondary/Communication
expressionType: resource
vars:
language: PID.15
active:
condition: $mrgSegment NOT_NULL
type: BOOLEAN
valueOf: true
vars:
mrgSegment: MRG
link:
generateList: true
evaluateLater: true
expressionType: nested
condition: $mrgSegment NOT_NULL
vars:
mrgSegment: MRG
expressionsMap:
type:
type: STRING
valueOf: "replaces"
other:
required: true
valueOf: resource/PatientMRG
expressionType: reference