Skip to content

Commit d238620

Browse files
fix: convert Narratives to XHTML (#83)
* convert strings to xhtml * fix toxhtmltest * update snapshot * update snapshot * some more tests * remove test function * remove some cruft * formatting * reduce number of parsings * update number of validation errors
1 parent 7802306 commit d238620

File tree

11 files changed

+286
-89
lines changed

11 files changed

+286
-89
lines changed

data/Templates/eCR/Resource/_Composition.liquid

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676
{
7777
"status":"generated",
7878
{% if component.section.text -%}
79-
"div": "{{ component.section.text._innerText | clean_string_from_tabs | escape_special_chars }}",
79+
"div": "{{ component.section.text._innerText | to_xhtml | clean_string_from_tabs | escape_special_chars }}",
8080
{% elsif component.section.title._ -%}
81-
"div":"<div xmlns=\"http://www.w3.org/1999/xhtml\">{{ component.section.title._ | escape }}</div>",
81+
"div":{{ component.section.title._ | to_xhtml | clean_string_from_tabs | escape_special_chars }}"",
8282
{% else -%}
83-
"div":"<div xmlns=\"http://www.w3.org/1999/xhtml\">{{ component.section.code.displayName | escape }}</div>",
83+
"div":"{{ component.section.code.displayName | to_xhtml | clean_string_from_tabs | escape_special_chars }}",
8484
{% endif -%}
8585
},
8686
"code":

src/Dibbs.FhirConverterApi.FunctionalTests/__snapshots__/FhirConverterApiFunctionalTests.ConvertToFhir_ReturnsSuccess_WhenValidEicrWithRrProvided.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"title": "Plan of Treatment",
7070
"text": {
7171
"status": "generated",
72-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Initial Case Report Trigger Code Lab Test Order</th><th>Trigger Code</th><th>Trigger Code codeSystem</th><th>RCTC OID</th><th>RCTC Version</th><th>Ordered Date</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>80825-3</td><td>LOINC</td><td>2.16.840.1.114222.4.11.7508</td><td>19/05/2016</td><td>FEB 25, 2025</td></tr></tbody></table>"
72+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Initial Case Report Trigger Code Lab Test Order</th><th>Trigger Code</th><th>Trigger Code codeSystem</th><th>RCTC OID</th><th>RCTC Version</th><th>Ordered Date</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>80825-3</td><td>LOINC</td><td>2.16.840.1.114222.4.11.7508</td><td>19/05/2016</td><td>FEB 25, 2025</td></tr></tbody></table></div>"
7373
},
7474
"code": {
7575
"coding": [
@@ -87,7 +87,7 @@
8787
"title": "Encounters",
8888
"text": {
8989
"status": "generated",
90-
"div": "No information"
90+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No information</div>"
9191
},
9292
"code": {
9393
"coding": [
@@ -105,7 +105,7 @@
105105
"title": "History of Present Illness",
106106
"text": {
107107
"status": "generated",
108-
"div": "No information"
108+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No information</div>"
109109
},
110110
"code": {
111111
"coding": [
@@ -123,7 +123,7 @@
123123
"title": "Medications Administered",
124124
"text": {
125125
"status": "generated",
126-
"div": "No medications administered"
126+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No medications administered</div>"
127127
},
128128
"code": {
129129
"coding": [
@@ -141,7 +141,7 @@
141141
"title": "Problems",
142142
"text": {
143143
"status": "generated",
144-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Concern</th><th>Concern Status</th><th>Date(s)</th></tr></thead><tbody><tr><td>Problem</td><td>active</td><td>FEB 5, 2025</td></tr><tr><td><list><item><table><thead><tr><th>Problem Type</th><th>Problem</th><th>Date(s)</th></tr></thead><tbody><tr><td>Sympton</td><td>Fever</td><td>FEB 5, 2025</td></tr></tbody></table></item></list></td></tr></tbody></table>"
144+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Concern</th><th>Concern Status</th><th>Date(s)</th></tr></thead><tbody><tr><td>Problem</td><td>active</td><td>FEB 5, 2025</td></tr><tr><td><ul><li><table><thead><tr><th>Problem Type</th><th>Problem</th><th>Date(s)</th></tr></thead><tbody><tr><td>Sympton</td><td>Fever</td><td>FEB 5, 2025</td></tr></tbody></table></li></ul></td></tr></tbody></table></div>"
145145
},
146146
"code": {
147147
"coding": [
@@ -169,7 +169,7 @@
169169
"title": "Reason for Visit",
170170
"text": {
171171
"status": "generated",
172-
"div": "No information"
172+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No information</div>"
173173
},
174174
"code": {
175175
"coding": [
@@ -193,7 +193,7 @@
193193
"title": "Results",
194194
"text": {
195195
"status": "generated",
196-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Results Panel</th><th>Date(s)</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>FEB 25, 2025 to FEB 25, 2025</td></tr><tr><td><list><item><table><thead><tr><th>Initial Case Report Trigger Code Result Observation </th><th>Trigger Code</th><th>Trigger Code codeSystem</th><th>RCTC OID</th><th>RCTC Version</th><th>Outcome</th><th>Interpretation</th><th>Date(s)</th><th>Interpretation</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>80825-3</td><td>LOINC</td><td>2.16.840.1.114222.4.11.7508</td><td>19/05/2016</td><td>Positive</td><td>High</td><td>FEB 25, 2025</td><td>Abnormal</td></tr></tbody></table></item></list></td></tr></tbody></table>"
196+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Results Panel</th><th>Date(s)</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>FEB 25, 2025 to FEB 25, 2025</td></tr><tr><td><ul><li><table><thead><tr><th>Initial Case Report Trigger Code Result Observation </th><th>Trigger Code</th><th>Trigger Code codeSystem</th><th>RCTC OID</th><th>RCTC Version</th><th>Outcome</th><th>Interpretation</th><th>Date(s)</th><th>Interpretation</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>80825-3</td><td>LOINC</td><td>2.16.840.1.114222.4.11.7508</td><td>19/05/2016</td><td>Positive</td><td>High</td><td>FEB 25, 2025</td><td>Abnormal</td></tr></tbody></table></li></ul></td></tr></tbody></table></div>"
197197
},
198198
"code": {
199199
"coding": [
@@ -216,7 +216,7 @@
216216
"title": "Social History",
217217
"text": {
218218
"status": "generated",
219-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Birth Sex</th><th>Value</th><th>Date</th></tr></thead><tbody><tr><td>Sex Assigned At Birth</td><td>Male</td><td>1125</td></tr></tbody></table><table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Social History Observation Type</th><th>Value</th><th>Date(s)</th></tr></thead><tbody><tr><td>Employment detail</td><td>Jedi High Council Member, Jedi Temple, Temple District, Galactic City, Coruscant</td><td>1275</td></tr></tbody></table><table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Travel History: Date(s)</th><th>Notes</th><th>Location</th></tr></thead><tbody><tr><td>In the 3 weeks before FEB 5, 2025</td><td>Visited swamp regions</td><td><list><item>Brazil</item></list></td></tr></tbody></table>"
219+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Birth Sex</th><th>Value</th><th>Date</th></tr></thead><tbody><tr><td>Sex Assigned At Birth</td><td>Male</td><td>1125</td></tr></tbody></table><table><thead><tr><th>Social History Observation Type</th><th>Value</th><th>Date(s)</th></tr></thead><tbody><tr><td>Employment detail</td><td>Jedi High Council Member, Jedi Temple, Temple District, Galactic City, Coruscant</td><td>1275</td></tr></tbody></table><table><thead><tr><th>Travel History: Date(s)</th><th>Notes</th><th>Location</th></tr></thead><tbody><tr><td>In the 3 weeks before FEB 5, 2025</td><td>Visited swamp regions</td><td><ul><li>Brazil</li></ul></td></tr></tbody></table></div>"
220220
},
221221
"code": {
222222
"coding": [
@@ -242,7 +242,7 @@
242242
"title": "Vital Signs (Last Filed)",
243243
"text": {
244244
"status": "generated",
245-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Date</th><th>Blood Pressure</th><th>Pulse</th><th>Temperature</th><th>Respiratory Rate</th><th>Height</th><th>Weight</th><th>BMI</th><th>SpO2</th></tr></thead><tbody><tr><td>05/20/2014 7:36pm</td><!-- You can consolidate Systolic and Diastolic in human view if desired but should retain separate references--><td><content ID=\"SystolicBP_2\">120</content>/<content ID=\"DiastolicBP_2\">80</content>mm[Hg] </td><td ID=\"Pulse_2\">80 /min</td><td ID=\"Temp_2\">99.0 F</td><td ID=\"RespRate_2\">18 /min</td><td ID=\"Height_2\">3'7 (43 inches)</td><td ID=\"Weight_2\">39.9 lbs</td><td ID=\"BMI_2\">17.58 kg/m2</td><td ID=\"SPO2_2\">98%</td></tr></tbody></table>"
245+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Date</th><th>Blood Pressure</th><th>Pulse</th><th>Temperature</th><th>Respiratory Rate</th><th>Height</th><th>Weight</th><th>BMI</th><th>SpO2</th></tr></thead><tbody><tr><td>05/20/2014 7:36pm</td><!-- You can consolidate Systolic and Diastolic in human view if desired but should retain separate references--><td><p id=\"SystolicBP_2\">120</p>/<p id=\"DiastolicBP_2\">80</p>mm[Hg] </td><td id=\"Pulse_2\">80 /min</td><td id=\"Temp_2\">99.0 F</td><td id=\"RespRate_2\">18 /min</td><td id=\"Height_2\">3'7 (43 inches)</td><td id=\"Weight_2\">39.9 lbs</td><td id=\"BMI_2\">17.58 kg/m2</td><td id=\"SPO2_2\">98%</td></tr></tbody></table></div>"
246246
},
247247
"code": {
248248
"coding": [

src/Dibbs.FhirConverterApi.FunctionalTests/__snapshots__/FhirConverterApiFunctionalTests.ConvertToFhir_ReturnsSuccess_WhenValidEicrWithoutRrProvided.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"title": "Plan of Treatment",
7070
"text": {
7171
"status": "generated",
72-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Initial Case Report Trigger Code Lab Test Order</th><th>Trigger Code</th><th>Trigger Code codeSystem</th><th>RCTC OID</th><th>RCTC Version</th><th>Ordered Date</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>80825-3</td><td>LOINC</td><td>2.16.840.1.114222.4.11.7508</td><td>19/05/2016</td><td>FEB 25, 2025</td></tr></tbody></table>"
72+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Initial Case Report Trigger Code Lab Test Order</th><th>Trigger Code</th><th>Trigger Code codeSystem</th><th>RCTC OID</th><th>RCTC Version</th><th>Ordered Date</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>80825-3</td><td>LOINC</td><td>2.16.840.1.114222.4.11.7508</td><td>19/05/2016</td><td>FEB 25, 2025</td></tr></tbody></table></div>"
7373
},
7474
"code": {
7575
"coding": [
@@ -87,7 +87,7 @@
8787
"title": "Encounters",
8888
"text": {
8989
"status": "generated",
90-
"div": "No information"
90+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No information</div>"
9191
},
9292
"code": {
9393
"coding": [
@@ -105,7 +105,7 @@
105105
"title": "History of Present Illness",
106106
"text": {
107107
"status": "generated",
108-
"div": "No information"
108+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No information</div>"
109109
},
110110
"code": {
111111
"coding": [
@@ -123,7 +123,7 @@
123123
"title": "Medications Administered",
124124
"text": {
125125
"status": "generated",
126-
"div": "No medications administered"
126+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No medications administered</div>"
127127
},
128128
"code": {
129129
"coding": [
@@ -141,7 +141,7 @@
141141
"title": "Problems",
142142
"text": {
143143
"status": "generated",
144-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Concern</th><th>Concern Status</th><th>Date(s)</th></tr></thead><tbody><tr><td>Problem</td><td>active</td><td>FEB 5, 2025</td></tr><tr><td><list><item><table><thead><tr><th>Problem Type</th><th>Problem</th><th>Date(s)</th></tr></thead><tbody><tr><td>Sympton</td><td>Fever</td><td>FEB 5, 2025</td></tr></tbody></table></item></list></td></tr></tbody></table>"
144+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Concern</th><th>Concern Status</th><th>Date(s)</th></tr></thead><tbody><tr><td>Problem</td><td>active</td><td>FEB 5, 2025</td></tr><tr><td><ul><li><table><thead><tr><th>Problem Type</th><th>Problem</th><th>Date(s)</th></tr></thead><tbody><tr><td>Sympton</td><td>Fever</td><td>FEB 5, 2025</td></tr></tbody></table></li></ul></td></tr></tbody></table></div>"
145145
},
146146
"code": {
147147
"coding": [
@@ -169,7 +169,7 @@
169169
"title": "Reason for Visit",
170170
"text": {
171171
"status": "generated",
172-
"div": "No information"
172+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No information</div>"
173173
},
174174
"code": {
175175
"coding": [
@@ -193,7 +193,7 @@
193193
"title": "Results",
194194
"text": {
195195
"status": "generated",
196-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Results Panel</th><th>Date(s)</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>FEB 25, 2025 to FEB 25, 2025</td></tr><tr><td><list><item><table><thead><tr><th>Initial Case Report Trigger Code Result Observation </th><th>Trigger Code</th><th>Trigger Code codeSystem</th><th>RCTC OID</th><th>RCTC Version</th><th>Outcome</th><th>Interpretation</th><th>Date(s)</th><th>Interpretation</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>80825-3</td><td>LOINC</td><td>2.16.840.1.114222.4.11.7508</td><td>19/05/2016</td><td>Positive</td><td>High</td><td>FEB 25, 2025</td><td>Abnormal</td></tr></tbody></table></item></list></td></tr></tbody></table>"
196+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Results Panel</th><th>Date(s)</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>FEB 25, 2025 to FEB 25, 2025</td></tr><tr><td><ul><li><table><thead><tr><th>Initial Case Report Trigger Code Result Observation </th><th>Trigger Code</th><th>Trigger Code codeSystem</th><th>RCTC OID</th><th>RCTC Version</th><th>Outcome</th><th>Interpretation</th><th>Date(s)</th><th>Interpretation</th></tr></thead><tbody><tr><td>Zika virus envelope (E) gene [Presence] in Serum by Probe and target amplification method</td><td>80825-3</td><td>LOINC</td><td>2.16.840.1.114222.4.11.7508</td><td>19/05/2016</td><td>Positive</td><td>High</td><td>FEB 25, 2025</td><td>Abnormal</td></tr></tbody></table></li></ul></td></tr></tbody></table></div>"
197197
},
198198
"code": {
199199
"coding": [
@@ -216,7 +216,7 @@
216216
"title": "Social History",
217217
"text": {
218218
"status": "generated",
219-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Birth Sex</th><th>Value</th><th>Date</th></tr></thead><tbody><tr><td>Sex Assigned At Birth</td><td>Male</td><td>1125</td></tr></tbody></table><table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Social History Observation Type</th><th>Value</th><th>Date(s)</th></tr></thead><tbody><tr><td>Employment detail</td><td>Jedi High Council Member, Jedi Temple, Temple District, Galactic City, Coruscant</td><td>1275</td></tr></tbody></table><table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Travel History: Date(s)</th><th>Notes</th><th>Location</th></tr></thead><tbody><tr><td>In the 3 weeks before FEB 5, 2025</td><td>Visited swamp regions</td><td><list><item>Brazil</item></list></td></tr></tbody></table>"
219+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Birth Sex</th><th>Value</th><th>Date</th></tr></thead><tbody><tr><td>Sex Assigned At Birth</td><td>Male</td><td>1125</td></tr></tbody></table><table><thead><tr><th>Social History Observation Type</th><th>Value</th><th>Date(s)</th></tr></thead><tbody><tr><td>Employment detail</td><td>Jedi High Council Member, Jedi Temple, Temple District, Galactic City, Coruscant</td><td>1275</td></tr></tbody></table><table><thead><tr><th>Travel History: Date(s)</th><th>Notes</th><th>Location</th></tr></thead><tbody><tr><td>In the 3 weeks before FEB 5, 2025</td><td>Visited swamp regions</td><td><ul><li>Brazil</li></ul></td></tr></tbody></table></div>"
220220
},
221221
"code": {
222222
"coding": [
@@ -242,7 +242,7 @@
242242
"title": "Vital Signs (Last Filed)",
243243
"text": {
244244
"status": "generated",
245-
"div": "<table xmlns=\"urn:hl7-org:v3\"><thead><tr><th>Date</th><th>Blood Pressure</th><th>Pulse</th><th>Temperature</th><th>Respiratory Rate</th><th>Height</th><th>Weight</th><th>BMI</th><th>SpO2</th></tr></thead><tbody><tr><td>05/20/2014 7:36pm</td><!-- You can consolidate Systolic and Diastolic in human view if desired but should retain separate references--><td><content ID=\"SystolicBP_2\">120</content>/<content ID=\"DiastolicBP_2\">80</content>mm[Hg] </td><td ID=\"Pulse_2\">80 /min</td><td ID=\"Temp_2\">99.0 F</td><td ID=\"RespRate_2\">18 /min</td><td ID=\"Height_2\">3'7 (43 inches)</td><td ID=\"Weight_2\">39.9 lbs</td><td ID=\"BMI_2\">17.58 kg/m2</td><td ID=\"SPO2_2\">98%</td></tr></tbody></table>"
245+
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><thead><tr><th>Date</th><th>Blood Pressure</th><th>Pulse</th><th>Temperature</th><th>Respiratory Rate</th><th>Height</th><th>Weight</th><th>BMI</th><th>SpO2</th></tr></thead><tbody><tr><td>05/20/2014 7:36pm</td><!-- You can consolidate Systolic and Diastolic in human view if desired but should retain separate references--><td><p id=\"SystolicBP_2\">120</p>/<p id=\"DiastolicBP_2\">80</p>mm[Hg] </td><td id=\"Pulse_2\">80 /min</td><td id=\"Temp_2\">99.0 F</td><td id=\"RespRate_2\">18 /min</td><td id=\"Height_2\">3'7 (43 inches)</td><td id=\"Weight_2\">39.9 lbs</td><td id=\"BMI_2\">17.58 kg/m2</td><td id=\"SPO2_2\">98%</td></tr></tbody></table></div>"
246246
},
247247
"code": {
248248
"coding": [

0 commit comments

Comments
 (0)