Skip to content

Commit cc9f835

Browse files
Merge pull request #14 from beda-software/demo-prepare-updates
Save resources code as text
2 parents c9d3824 + b1cb2ed commit cc9f835

File tree

2 files changed

+191
-383
lines changed

2 files changed

+191
-383
lines changed

resources/seeds/Mapping/curated-ips.yaml

Lines changed: 74 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ body:
1313
- immunizationsSummary: "{{ %QuestionnaireResponse.answers('immunizations-summary') }}"
1414
- proceduresSummary: "{{ %QuestionnaireResponse.answers('procedures-summary') }}"
1515
- problemsSummary: "{{ %QuestionnaireResponse.answers('problems-summary') }}"
16-
- proceduresIDs: "{[ %QuestionnaireResponse.answers('procedure-id') ]}"
1716
- problemItems: "{[ %QuestionnaireResponse.item.where(linkId='ips-section').item.where(linkId='problems-section').item.where(linkId='problems') ]}"
1817
- allergiesItems: "{[ %QuestionnaireResponse.item.where(linkId='ips-section').item.where(linkId='allergies-section').item.where(linkId='allergies') ]}"
1918
- medicationsItems: "{[ %QuestionnaireResponse.item.where(linkId='ips-section').item.where(linkId='medications-section').item.where(linkId='medications') ]}"
@@ -56,7 +55,7 @@ body:
5655
"{% if %problemsSummary.exists() %}":
5756
div: "{{ %problemsSummary }}"
5857
"{% else %}":
59-
div: "No problems found"
58+
div: "No summary provided"
6059
"{% if %problemItems.count() > 0 %}":
6160
entry:
6261
"{% for index, problemItem in %problemItems %}":
@@ -82,7 +81,7 @@ body:
8281
"{% if %allergiesSummary.exists() %}":
8382
div: "{{ %allergiesSummary }}"
8483
"{% else %}":
85-
div: "No allergies found"
84+
div: "No summary provided"
8685
"{% if %allergiesItems.count() > 0 %}":
8786
entry:
8887
"{% for index, allergyItem in %allergiesItems %}":
@@ -108,7 +107,7 @@ body:
108107
"{% if %medicationsSummary.exists() %}":
109108
div: "{{ %medicationsSummary }}"
110109
"{% else %}":
111-
div: "No medications found"
110+
div: "No summary provided"
112111
"{% if %medicationsItems.count() > 0 %}":
113112
entry:
114113
"{% for index, medicationItem in %medicationsItems %}":
@@ -134,7 +133,7 @@ body:
134133
"{% if %immunizationsSummary.exists() %}":
135134
div: "{{ %immunizationsSummary }}"
136135
"{% else %}":
137-
div: "No immunizations found"
136+
div: "No summary provided"
138137
"{% if %immunizationsItems.count() > 0 %}":
139138
entry:
140139
"{% for index, immunizationItem in %immunizationsItems %}":
@@ -160,7 +159,7 @@ body:
160159
"{% if %proceduresSummary.exists() %}":
161160
div: "{{ %proceduresSummary }}"
162161
"{% else %}":
163-
div: "No procedures found"
162+
div: "No summary provided"
164163
"{% if %proceduresItems.count() > 0 %}":
165164
entry:
166165
"{% for index, procedureItem in %proceduresItems %}":
@@ -179,15 +178,20 @@ body:
179178
- "{% for index, problemItem in %problemItems %}":
180179
"{% assign %}":
181180
- problemId: "{{ %problemItem.item.where(linkId='condition-id').answer.valueString }}"
182-
- problemCode: "{{ %problemItem.item.where(linkId.startsWith('condition-code')).answer.valueCoding }}"
181+
- problemCodeAnswer: "{{ %problemItem.item.where(linkId='condition-code').answer }}"
182+
- problemCode: "{{ %problemCodeAnswer.valueCoding | %problemCodeAnswer.valueString }}"
183183
- problemClinicalStatus: "{{ %problemItem.item.where(linkId.startsWith('condition-clinical-status')).answer.valueCoding }}"
184184
- problemVerificationStatus: "{{ %problemItem.item.where(linkId.startsWith('condition-verification-status')).answer.valueCoding }}"
185185
- problemCategory: "{[ %problemItem.item.where(linkId.startsWith('condition-category')).answer.valueCoding ]}"
186-
"{% if %problemId.empty() and %problemCode.exists() %}":
187-
fullUrl: "urn:uuid:Condition-{{ %index }}"
186+
"{% if %problemCode.exists() %}":
187+
fullUrl: "urn:uuid:Condition-{{ %problemId | %index }}"
188188
request:
189-
method: POST
190-
url: /Condition
189+
"{% if %problemId.exists() %}":
190+
method: PUT
191+
url: /Condition/{{ %problemId }}
192+
"{% else %}":
193+
method: POST
194+
url: /Condition
191195
resource:
192196
resourceType: Condition
193197
meta:
@@ -197,8 +201,11 @@ body:
197201
coding:
198202
- "{{ %problemClinicalStatus }}"
199203
code:
200-
coding:
201-
- "{{ %problemCode }}"
204+
"{% if %problemCode is String %}":
205+
text: "{{ %problemCode }}"
206+
"{% else %}":
207+
coding:
208+
- "{{ %problemCode }}"
202209
verificationStatus:
203210
coding:
204211
- "{{ %problemVerificationStatus }}"
@@ -210,19 +217,24 @@ body:
210217
reference: "Patient/{{ %patientId }}"
211218
text:
212219
status: generated
213-
div: "<div xmlns='http://www.w3.org/1999/xhtml'><p><b>Generated Narrative</b></p><p><b>identifier</b>: id: urn:uuid:Condition-{{%index}}</p><p><b>clinicalStatus</b>: <span title='Codes: {http://terminology.hl7.org/CodeSystem/condition-clinical {{%problemClinicalStatus.code}}}'>{{%problemClinicalStatus.display}}</span></p><p><b>code</b>: <span title='Codes: {http://snomed.info/sct {{%problemCode.code}} }'>{{%problemCode.display}}</span></p><p><b>subject</b>: <a href='#Patient_{{%patientId}}'>See above (Patient/{{%patientId}})</a></p></div>"
220+
div: "<div xmlns='http://www.w3.org/1999/xhtml'><p><b>Generated Narrative</b></p><p><b>identifier</b>: id: urn:uuid:Condition-{{%index}}</p><p><b>clinicalStatus</b>: <span title='Codes: {http://terminology.hl7.org/CodeSystem/condition-clinical {{%problemClinicalStatus.code}}}'>{{%problemClinicalStatus.display}}</span></p><p><b>code</b>: <span title='Diagnosis}'>{{%problemCode.display | %problemCode}}</span></p><p><b>subject</b>: <a href='#Patient_{{%patientId}}'>See above (Patient/{{%patientId}})</a></p></div>"
214221
- "{% for index, allergyItem in %allergiesItems %}":
215222
"{% assign %}":
216223
- allergyId: "{{ %allergyItem.item.where(linkId='allergy-id').answer.valueString }}"
217-
- allergyCode: "{{ %allergyItem.item.where(linkId.startsWith('allergy-code')).answer.valueCoding }}"
224+
- allergyCodeAnswer: "{{ %allergyItem.item.where(linkId='allergy-code').answer }}"
225+
- allergyCode: "{{ %allergyCodeAnswer.valueCoding | %allergyCodeAnswer.valueString }}"
218226
- allergyClinicalStatus: "{{ %allergyItem.item.where(linkId.startsWith('allergy-clinical-status')).answer.valueCoding }}"
219227
- allergyVerificationStatus: "{{ %allergyItem.item.where(linkId.startsWith('allergy-verification-status')).answer.valueCoding }}"
220228
- allergyCategory: "{[ %allergyItem.item.where(linkId.startsWith('allergy-category')).answer.valueCoding.code ]}"
221-
"{% if %allergyId.empty() and %allergyCode.exists() %}":
229+
"{% if %allergyCode.exists() %}":
222230
fullUrl: "urn:uuid:AllergyIntolerance-{{ %index }}"
223231
request:
224-
method: POST
225-
url: /AllergyIntolerance
232+
"{% if %allergyId.exists() %}":
233+
method: PUT
234+
url: /AllergyIntolerance/{{ %allergyId }}
235+
"{% else %}":
236+
method: POST
237+
url: /AllergyIntolerance
226238
resource:
227239
resourceType: AllergyIntolerance
228240
meta:
@@ -232,8 +244,11 @@ body:
232244
coding:
233245
- "{{ %allergyClinicalStatus }}"
234246
code:
235-
coding:
236-
- "{{ %allergyCode }}"
247+
"{% if %allergyCode is String %}":
248+
text: "{{ %allergyCode }}"
249+
"{% else %}":
250+
coding:
251+
- "{{ %allergyCode }}"
237252
verificationStatus:
238253
coding:
239254
- "{{ %allergyVerificationStatus }}"
@@ -242,19 +257,23 @@ body:
242257
reference: "Patient/{{ %patientId }}"
243258
text:
244259
status: generated
245-
div: "<div xmlns='http://www.w3.org/1999/xhtml'><p><b>Generated Narrative</b></p><p><b>identifier</b>: id: urn:uuid:AllergyIntolerance-{{%index}}</p><p><b>clinicalStatus</b>: <span title='Codes: {http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical {{%allergyClinicalStatus.code}}}'>{{%allergyClinicalStatus.display}}</span></p><p><b>code</b>: <span title='Codes: {http://snomed.info/sct {{%allergyCode.code}} }'>{{%allergyCode.display}}</span></p><p><b>subject</b>: <a href='#Patient_{{%patientId}}'>See above (Patient/{{%patientId}})</a></p></div>"
260+
div: "<div xmlns='http://www.w3.org/1999/xhtml'><p><b>Generated Narrative</b></p><p><b>identifier</b>: id: urn:uuid:AllergyIntolerance-{{%index}}</p><p><b>clinicalStatus</b>: <span title='Codes: {http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical {{%allergyClinicalStatus.code}}}'>{{%allergyClinicalStatus.display}}</span></p><p><b>code</b>: <span title='Allergy or Intolerance}'>{{%allergyCode.display | %allergyCode}}</span></p><p><b>subject</b>: <a href='#Patient_{{%patientId}}'>See above (Patient/{{%patientId}})</a></p></div>"
246261
- "{% for index, medicationItem in %medicationsItems %}":
247262
"{% assign %}":
248-
- medicationId: "{{ %medicationItem.item.where(linkId='medication-statement-id').answer.valueString }}"
263+
- medicationStatementId: "{{ %medicationItem.item.where(linkId='medication-statement-id').answer.valueString }}"
249264
- medicationReference: "{{ %medicationItem.item.where(linkId.startsWith('medication-medication')).answer.valueReference }}"
250265
- medicationStatus: "{{ %medicationItem.item.where(linkId.startsWith('medication-status')).answer.valueCoding.code }}"
251266
- medicationStatusReason: "{[ %medicationItem.item.where(linkId.startsWith('medication-status-reason')).answer.valueCoding.code ]}"
252267
- medicationEffectiveDateTime: "{{ %medicationItem.item.where(linkId.startsWith('medication-effective-datetime')).answer.valueDateTime }}"
253-
"{% if %medicationId.empty() and %medicationReference.exists() %}":
268+
"{% if %medicationReference.exists() %}":
254269
fullUrl: "urn:uuid:MedicationStatement-{{ %index }}"
255270
request:
256-
method: POST
257-
url: /MedicationStatement
271+
"{% if %medicationStatementId.exists() %}":
272+
method: PUT
273+
url: /MedicationStatement/{{ %medicationStatementId }}
274+
"{% else %}":
275+
method: POST
276+
url: /MedicationStatement
258277
resource:
259278
resourceType: MedicationStatement
260279
meta:
@@ -278,41 +297,54 @@ body:
278297
- "{% for index, immunizationItem in %immunizationsItems %}":
279298
"{% assign %}":
280299
- immunizationId: "{{ %immunizationItem.item.where(linkId='immunization-id').answer.valueString }}"
281-
- immunizationVaccineCode: "{{ %immunizationItem.item.where(linkId.startsWith('immunization-vaccine-code')).answer.valueCoding }}"
300+
- immunizationVaccineCodeAnswer: "{{ %immunizationItem.item.where(linkId='immunization-vaccine-code').answer }}"
301+
- immunizationVaccineCode: "{{ %immunizationVaccineCodeAnswer.valueCoding | %immunizationVaccineCodeAnswer.valueString }}"
282302
- immunizationStatus: "{{ %immunizationItem.item.where(linkId.startsWith('immunization-status')).answer.valueCoding.code }}"
283303
- immunizationDate: "{{ %immunizationItem.item.where(linkId.startsWith('immunization-occurrence-datetime')).answer.valueDateTime }}"
284-
"{% if %immunizationId.empty() and %immunizationVaccineCode.exists() %}":
304+
"{% if %immunizationVaccineCode.exists() %}":
285305
fullUrl: "urn:uuid:Immunization-{{ %index }}"
286306
request:
287-
method: POST
288-
url: /Immunization
307+
"{% if %immunizationId.exists() %}":
308+
method: PUT
309+
url: /Immunization/{{ %immunizationId }}
310+
"{% else %}":
311+
method: POST
312+
url: /Immunization
289313
resource:
290314
resourceType: Immunization
291315
meta:
292316
profile:
293317
- "http://hl7.org/fhir/uv/ips/StructureDefinition/Immunization-uv-ips"
294318
status: "{{ %immunizationStatus }}"
295319
vaccineCode:
296-
coding:
297-
- "{{ %immunizationVaccineCode }}"
320+
"{% if %immunizationVaccineCode is String %}":
321+
text: "{{ %immunizationVaccineCode }}"
322+
"{% else %}":
323+
coding:
324+
- "{{ %immunizationVaccineCode }}"
298325
occurrenceDateTime: "{{ %immunizationDate }}"
299326
patient:
300327
reference: "Patient/{{ %patientId }}"
301328
"{% if %immunizationDate.exists() %}":
302329
text:
303330
status: generated
304-
div: "<div xmlns='http://www.w3.org/1999/xhtml'><p><b>Generated Narrative</b></p><p><b>identifier</b>: id: urn:uuid:Immunization-{{%index}}</p><p><b>status</b>: <span title='Codes: {http://terminology.hl7.org/CodeSystem/immunization-status {{%immunizationStatus}}}'>{{%immunizationStatus}}</span></p><p><b>vaccineCode</b>: <span title='Codes: {http://snomed.info/sct {{%immunizationVaccineCode.code}} }'>{{%immunizationVaccineCode.display}}</span></p><p><b>occurrenceDateTime</b>: {{%immunizationDate}}</p><p><b>subject</b>: <a href='#Patient_{{%patientId}}'>See above (Patient/{{%patientId}})</a></p></div>"
331+
div: "<div xmlns='http://www.w3.org/1999/xhtml'><p><b>Generated Narrative</b></p><p><b>identifier</b>: id: urn:uuid:Immunization-{{%index}}</p><p><b>status</b>: <span title='Codes: {http://terminology.hl7.org/CodeSystem/immunization-status {{%immunizationStatus}}}'>{{%immunizationStatus}}</span></p><p><b>vaccine</b>: <span title='Vaccine}'>{{%immunizationVaccineCode.display | %immunizationVaccineCode}}</span></p><p><b>occurrenceDateTime</b>: {{%immunizationDate}}</p><p><b>subject</b>: <a href='#Patient_{{%patientId}}'>See above (Patient/{{%patientId}})</a></p></div>"
305332
- "{% for index, procedureItem in %proceduresItems %}":
306333
"{% assign %}":
307334
- procedureId: "{{ %procedureItem.item.where(linkId='procedure-id').answer.valueString }}"
308-
- procedureCode: "{{ %procedureItem.item.where(linkId.startsWith('procedure-code')).answer.valueCoding }}"
335+
- procedureCodeAnswer: "{{ %procedureItem.item.where(linkId='procedure-code').answer }}"
336+
- procedureCode: "{{ %procedureCodeAnswer.valueCoding | %procedureCodeAnswer.valueString }}"
309337
- procedureStatus: "{{ %procedureItem.item.where(linkId.startsWith('procedure-status')).answer.valueCoding.code }}"
310338
- procedurePerformedDateTime: "{{ %procedureItem.item.where(linkId.startsWith('procedure-performed-datetime')).answer.valueDateTime }}"
311-
"{% if %procedureId.empty() and %procedureCode.exists() %}":
339+
"{% if %procedureCode.exists() %}":
312340
fullUrl: "urn:uuid:Procedure-{{ %index }}"
313341
request:
314-
method: POST
315-
url: /Procedure
342+
"{% if %procedureId.exists() %}":
343+
method: PUT
344+
url: /Procedure/{{ %procedureId }}
345+
"{% else %}":
346+
method: POST
347+
url: /Procedure
316348
resource:
317349
resourceType: Procedure
318350
meta:
@@ -321,10 +353,13 @@ body:
321353
status: "{{ %procedureStatus }}"
322354
performedDateTime: "{{ %procedurePerformedDateTime }}"
323355
code:
324-
coding:
325-
- "{{ %procedureCode }}"
356+
"{% if %procedureCode is String %}":
357+
text: "{{ %procedureCode }}"
358+
"{% else %}":
359+
coding:
360+
- "{{ %procedureCode }}"
326361
subject:
327362
reference: "Patient/{{ %patientId }}"
328363
text:
329364
status: generated
330-
div: "<div xmlns='http://www.w3.org/1999/xhtml'><p><b>Generated Narrative</b></p><p><b>identifier</b>: id: urn:uuid:Procedure-{{%index}}</p><p><b>status</b>: <span title='Codes: {http://terminology.hl7.org/CodeSystem/procedure-status {{%procedureStatus}}}'>{{%procedureStatus}}</span></p><p><b>code</b>: <span title='Codes: {http://snomed.info/sct {{%procedureCode.code}} }'>{{%procedureCode.display}}</span></p><p><b>subject</b>: <a href='#Patient_{{%patientId}}'>See above (Patient/{{%patientId}})</a></p></div>"
365+
div: "<div xmlns='http://www.w3.org/1999/xhtml'><p><b>Generated Narrative</b></p><p><b>identifier</b>: id: urn:uuid:Procedure-{{%index}}</p><p><b>status</b>: <span title='Codes: {http://terminology.hl7.org/CodeSystem/procedure-status {{%procedureStatus}}}'>{{%procedureStatus}}</span></p><p><b>code</b>: <span title='Procedure}'>{{%procedureCode.display | %procedureCode}}</span></p><p><b>subject</b>: <a href='#Patient_{{%patientId}}'>See above (Patient/{{%patientId}})</a></p></div>"

0 commit comments

Comments
 (0)