Skip to content

Commit

Permalink
Add support for stu3 templates. Included sample data files and update…
Browse files Browse the repository at this point in the history
…d examples accordingly.
  • Loading branch information
chaseastewart committed Jan 31, 2024
1 parent 79b9d53 commit cf3311c
Show file tree
Hide file tree
Showing 291 changed files with 5,970 additions and 225 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--intro-start-->
<p align="center">
<img src="https://github.com/chaseastewart/fhir-converter/blob/main/logo.png?raw=true" width="360" alt="Python FHIR Converter"/>
<img src="https://github.com/chaseastewart/fhir-converter/blob/main/logo.png?raw=true" width="400" alt="Python FHIR Converter"/>
</p>
<p align="center">
<em>Python FHIR converter, fastish, most nuts and bolts included, ready for production</em>
Expand All @@ -25,6 +25,10 @@
<a href="https://black.readthedocs.io/en/stable/index.html" target="_blank">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square" />
</a>
<br>
<a href="https://pepy.tech/project/python-fhir-converter" target="_blank">
<img src="https://static.pepy.tech/badge/python-fhir-converter/month" />
</a>
</p>

---
Expand All @@ -40,8 +44,9 @@ Key features:

Limitations:

* **Only CDA->FHIR** is currently builtin. Additional work is needed to implement the filters, etc to support FHIR->FHIR and HL7v2->FHIR.
* **Python-liquid requires** a comma between parameters. This does not appear to be a restriction with DotLiquid. As a result templates brought to this environment may need commas added.
* **Only CDA->FHIR, STU3->FHIR** are currently builtin. Additional work is needed to implement the filters, etc to support JSON->FHIR, HL7v2->FHIR and FHIR->HL7v2.
* **Comma between parameters**. Python-liquid **requires** a comma between parameters. Templates brought to this environment may need commas added.
* **Variable names when passing variables to a snippet**. Python-liquid **requires** the identifier / variable name. Templates brought to this environment may need changes. See [Resource.liquid](https://github.com/chaseastewart/fhir-converter/blob/main/fhir_converter/templates/stu3/Resource.liquid) as an example of a template that has been updated.

Built on the back of:

Expand Down
103 changes: 103 additions & 0 deletions data/sample/stu3/AllergyIntolerance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"resourceType": "AllergyIntolerance",
"id": "example",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: example</p><p><b>identifier</b>: 49476534</p><p><b>clinicalStatus</b>: active</p><p><b>verificationStatus</b>: confirmed</p><p><b>type</b>: allergy</p><p><b>category</b>: food</p><p><b>criticality</b>: high</p><p><b>code</b>: Cashew nuts <span>(Details : {SNOMED CT code '227493005' = 'Cashew nuts', given as 'Cashew nuts'})</span></p><p><b>patient</b>: <a>Patient/example</a></p><p><b>onset</b>: 01/01/2004</p><p><b>assertedDate</b>: 09/10/2014 2:58:00 PM</p><p><b>recorder</b>: <a>Practitioner/example</a></p><p><b>asserter</b>: <a>Patient/example</a></p><p><b>lastOccurrence</b>: 01/06/2012</p><p><b>note</b>: The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract.</p><blockquote><p><b>reaction</b></p><p><b>substance</b>: cashew nut allergenic extract Injectable Product <span>(Details : {RxNorm code '1160593' = '1160593', given as 'cashew nut allergenic extract Injectable Product'})</span></p><p><b>manifestation</b>: Anaphylactic reaction <span>(Details : {SNOMED CT code '39579001' = 'Anaphylaxis', given as 'Anaphylactic reaction'})</span></p><p><b>description</b>: Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered</p><p><b>onset</b>: 12/06/2012</p><p><b>severity</b>: severe</p><p><b>exposureRoute</b>: Subcutaneous route <span>(Details : {SNOMED CT code '34206005' = 'Subcutaneous route', given as 'Subcutaneous route'})</span></p></blockquote><blockquote><p><b>reaction</b></p><p><b>manifestation</b>: Urticaria <span>(Details : {SNOMED CT code '64305001' = 'Urticaria', given as 'Urticaria'})</span></p><p><b>onset</b>: 01/01/2004</p><p><b>severity</b>: moderate</p><p><b>note</b>: The patient reports that the onset of urticaria was within 15 minutes of eating cashews.</p></blockquote></div>"
},
"identifier": [
{
"system": "http://acme.com/ids/patients/risks",
"value": "49476534"
}
],
"clinicalStatus": "active",
"verificationStatus": "confirmed",
"type": "allergy",
"category": [
"food"
],
"criticality": "high",
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "227493005",
"display": "Cashew nuts"
}
]
},
"patient": {
"reference": "Patient/example"
},
"onsetDateTime": "2004",
"assertedDate": "2014-10-09T11:58:00+08:00",
"recorder": {
"reference": "Practitioner/example"
},
"asserter": {
"reference": "Patient/example"
},
"lastOccurrence": "2012-06",
"note": [
{
"text": "The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract."
}
],
"reaction": [
{
"substance": {
"coding": [
{
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "1160593",
"display": "cashew nut allergenic extract Injectable Product"
}
]
},
"manifestation": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "39579001",
"display": "Anaphylactic reaction"
}
]
}
],
"description": "Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered",
"onset": "2012-06-12",
"severity": "severe",
"exposureRoute": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "34206005",
"display": "Subcutaneous route"
}
]
}
},
{
"manifestation": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "64305001",
"display": "Urticaria"
}
]
}
],
"onset": "2004",
"severity": "moderate",
"note": [
{
"text": "The patient reports that the onset of urticaria was within 15 minutes of eating cashews."
}
]
}
]
}
93 changes: 93 additions & 0 deletions data/sample/stu3/Condition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"resourceType": "Condition",
"id": "f201",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: f201</p><p><b>identifier</b>: 12345</p><p><b>clinicalStatus</b>: resolved</p><p><b>verificationStatus</b>: confirmed</p><p><b>category</b>: Problem <span>(Details : {SNOMED CT code '55607006' = 'Problem', given as 'Problem'}; {http://hl7.org/fhir/condition-category code 'problem-list-item' = 'Problem List Item)</span></p><p><b>severity</b>: Mild <span>(Details : {SNOMED CT code '255604002' = 'Mild', given as 'Mild'})</span></p><p><b>code</b>: Fever <span>(Details : {SNOMED CT code '386661006' = 'Fever', given as 'Fever'})</span></p><p><b>bodySite</b>: Entire body as a whole <span>(Details : {SNOMED CT code '38266002' = 'Body as a whole', given as 'Entire body as a whole'})</span></p><p><b>subject</b>: <a>Roel</a></p><p><b>context</b>: <a>Encounter/f201</a></p><p><b>onset</b>: 02/04/2013</p><p><b>abatement</b>: around April 9, 2013</p><p><b>assertedDate</b>: 04/04/2013</p><p><b>asserter</b>: <a>Practitioner/f201</a></p><h3>Evidences</h3><table><tr><td>-</td><td><b>Code</b></td><td><b>Detail</b></td></tr><tr><td>*</td><td>degrees C <span>(Details : {SNOMED CT code '258710007' = 'degrees C', given as 'degrees C'})</span></td><td><a>Temperature</a></td></tr></table></div>"
},
"identifier": [
{
"value": "12345"
}
],
"clinicalStatus": "resolved",
"verificationStatus": "confirmed",
"category": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "55607006",
"display": "Problem"
},
{
"system": "http://hl7.org/fhir/condition-category",
"code": "problem-list-item"
}
]
}
],
"severity": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "255604002",
"display": "Mild"
}
]
},
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "386661006",
"display": "Fever"
}
]
},
"bodySite": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "38266002",
"display": "Entire body as a whole"
}
]
}
],
"subject": {
"reference": "Patient/f201",
"display": "Roel"
},
"context": {
"reference": "Encounter/f201"
},
"onsetDateTime": "2013-04-02",
"abatementString": "around April 9, 2013",
"assertedDate": "2013-04-04",
"asserter": {
"reference": "Practitioner/f201"
},
"evidence": [
{
"code": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "258710007",
"display": "degrees C"
}
]
}
],
"detail": [
{
"reference": "Observation/f202",
"display": "Temperature"
}
]
}
]
}
88 changes: 88 additions & 0 deletions data/sample/stu3/Encounter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"resourceType": "Encounter",
"id": "f202",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: f202</p><p><b>identifier</b>: Encounter_Roel_20130128 (TEMP)</p><p><b>status</b>: finished</p><p><b>class</b>: ambulatory (Details: http://hl7.org/fhir/v3/ActCode code AMB = 'ambulatory', stated as 'ambulatory')</p><p><b>type</b>: Chemotherapy <span>(Details : {SNOMED CT code '367336001' = 'Chemotherapy', given as 'Chemotherapy'})</span></p><p><b>priority</b>: Urgent <span>(Details : {SNOMED CT code '103391001' = 'Urgency', given as 'Urgent'})</span></p><p><b>subject</b>: <a>Roel</a></p><h3>Participants</h3><table><tr><td>-</td><td><b>Individual</b></td></tr><tr><td>*</td><td><a>Practitioner/f201</a></td></tr></table><p><b>length</b>: 56 minutes<span> (Details: UCUM code min = 'min')</span></p><p><b>reason</b>: The patient is treated for a tumor. <span>(Details )</span></p><h3>Diagnoses</h3><table><tr><td>-</td><td><b>Condition</b></td><td><b>Role</b></td><td><b>Rank</b></td></tr><tr><td>*</td><td>Complications from Roel's TPF chemotherapy on January 28th, 2013</td><td>Admission diagnosis <span>(Details : {http://hl7.org/fhir/diagnosis-role code 'AD' = 'Admission diagnosis', given as 'Admission diagnosis'})</span></td><td>1</td></tr></table><p><b>serviceProvider</b>: <a>Organization/f201</a></p></div>"
},
"identifier": [
{
"use": "temp",
"value": "Encounter_Roel_20130128"
}
],
"status": "finished",
"class": {
"system": "http://hl7.org/fhir/v3/ActCode",
"code": "AMB",
"display": "ambulatory"
},
"type": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "367336001",
"display": "Chemotherapy"
}
]
}
],
"priority": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "103391001",
"display": "Urgent"
}
]
},
"subject": {
"reference": "Patient/f201",
"display": "Roel"
},
"participant": [
{
"individual": {
"reference": "Practitioner/f201"
}
}
],
"length": {
"value": 56,
"unit": "minutes",
"system": "http://unitsofmeasure.org",
"code": "min"
},
"reason": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/encounter-primaryDiagnosis",
"valuePositiveInt": 2
}
],
"text": "The patient is treated for a tumor."
}
],
"diagnosis": [
{
"condition": {
"display": "Complications from Roel's TPF chemotherapy on January 28th, 2013"
},
"role": {
"coding": [
{
"system": "http://hl7.org/fhir/diagnosis-role",
"code": "AD",
"display": "Admission diagnosis"
}
]
},
"rank": 1
}
],
"serviceProvider": {
"reference": "Organization/f201"
}
}
Loading

0 comments on commit cf3311c

Please sign in to comment.