microsoft / FHIR-Converter

Conversion utility to translate legacy data formats into FHIR
MIT License
404 stars 176 forks source link

valueQuantity.value is being returned as a string #310

Closed castasint closed 2 years ago

castasint commented 3 years ago

I have the below ORU HL7 message. I am trying to convert it into an FHIR bundle using the API (handlebars version). I looked at the handlebars template for an observation resource and it looks correct. If there is a value, the template says to return the value. So, if there is a decimal value like 1.8 it should return 1.8. But, when I checked the response, it is returning "1.8"(string).

Any help that tells me where I should look more to troubleshoot it will be appreciated.

Excerpt from Observation Template

{{#if observationEntry.value.code}} "valueCodeableConcept":{{>DataType/CodeableConcept.hbs code=observationEntry.value}}, {{else if observationEntry.value.value}} "valueQuantity": { "value":{{observationEntry.value.value}}, "unit":"{{observationEntry.value.unit}}", }, {{else}} "valueString":"{{observationEntry.value._}}", {{/if}}

Response

{ "fullUrl": "urn:uuid:b868545e-087c-3860-b4bd-f03e98a344e2", "resource": { "resourceType": "Observation", "id": "b868545e-087c-3860-b4bd-f03e98a344e2", "code": { "coding": [ { "code": "tt-0002-17", "display": "Basophils", "system": "WinPath" } ] }, "valueQuantity": { "value": "0.18", "code": "x10*9/L" }, "status": "final", "effectiveDateTime": "2020-05-08T13:10:30.000Z", "component": [ { "code": { "coding": [ { "code": "tt-0002-17", "display": "Basophils", "system": "WinPath" } ] }, "valueQuantity": { "value": "0.18", "code": "x10*9/L" }, "referenceRange": [ { "text": "[ < 0.21 ]" } ] } ], "subject": { "reference": "Patient/c49bc5d4-72a3-3cb4-9a27-5b4f65794e9d" } }, "request": { "method": "PUT", "url": "Observation/b868545e-087c-3860-b4bd-f03e98a344e2" } },

Sample HL7 Message

MSH|^~\&|SIMHOSP|SFAC|RAPP|RFAC|20200508131030||ORU^R01|557|T|2.5.1|||AL||44|ASCII PID|1|3265861866^^^SIMULATOR MRN^MRN|3265861866^^^SIMULATOR MRN^MRN~8898636334^^^NHSNBR^NHSNMBR||Lloyd^Kieran^Wilfred^^Mr^^CURRENT||19921001000000|M|||117 Kiss Place^^Croydon^^BB32 9BA^GBR^HOME||074 1156 4084^HOME|||||||||A^White - British^^^|||||||| PV1|1|I|OtherWard^MainRoom^Bed 195^Simulated Hospital^^BED^Main Building^4|28b|||C005^Whittingham^Sylvia^^^Dr^^^DRNBR^PRSNL^^^ORGDR|||CAR|||||||||13797039926095492417^^^^visitid||||||||||||||||||||||ARRIVED|||20200508131030|| ORC|RE|1975039636|4232299600||CM||||20200508131030 OBR|1|1975039636|4232299600|us-0002^COMPLETE BLOOD COUNT^WinPath^^||20200508131030|20200508131030|||||||20200508131030||||||||20200508131030|||F||1 OBX|1|NM|tt-0002-17^Basophils^WinPath^^||1.0|x10*9/L|[ < 0.21 ]||||F|||20200508131030|| OBX|2|NM|tt-0002-13^Monocytes^WinPath^^||0.38|x10*9/L|[ 0.2 - 1.0 ]||||F|||20200508131030|| OBX|3|NM|tt-0002-06^Platelet Count^WinPath^^||366.25|x10*9/L|[ 150 - 450 ]||||F|||20200508131030|| NTE|0||Sauce transportation warmth laparoscope bustle torso breakpoint inch cherry| OBX|4|NM|tt-0002-10^Lymphocytes per^WinPath^^||20|PERCENT|||||F|||20200508131030|| OBX|5|NM|tt-0002-15^Eosinophils^WinPath^^||0.21|x10*9/L|[ 0.04 - 0.40 ]||||F|||20200508131030|| NTE|0||Cracker roadway home| NTE|1||Ram margin meteor grade rock jute boot| OBX|6|NM|tt-0002-02^Red Cell Count^WinPath^^||4.44|x10*12/L|[ 4.2 - 6.0 ]||||F|||20200508131030|| NTE|0||Brook witch zipper kitchen bolt shorts bother volume guarantee| OBX|7|NM|tt-0002-11^Lymphocytes^WinPath^^||3.54|x10*9/L|[ 1.1 - 4.0 ]||||F|||20200508131030|| NTE|0||Metal coinsurance| OBX|8|NM|tt-0002-14^Eosinophils per^WinPath^^||20|PERCENT|||||F|||20200508131030|| OBX|9|NM|tt-0002-03^Haematocrit^WinPath^^||0.45||[ 0.38 - 0.52 ]||||F|||20200508131030|| OBX|10|NM|tt-0002-07^White Cell Count^WinPath^^||6.59|x10*9/L|[ 4.0 - 11.0 ]||||F|||20200508131030|| NTE|0||Cot zampone pantology disadvantage block sheet| OBX|11|NM|tt-0002-04^Mean Cell Volume^WinPath^^||81.54|fL|[ 80 - 98 ]||||F|||20200508131030|| OBX|12|NM|tt-0002-01^Haemoglobin^WinPath^^||163.75|g/L|[ 135 - 180 ]||||F|||20200508131030|| NTE|0||Landform university trouble go tonight pop terracotta| OBX|13|NM|tt-0002-09^Neutrophils^WinPath^^||2.40|x10*9/L|[ 2.0 - 7.5 ]||||F|||20200508131030|| NTE|0||Pike jasmine repeat| OBX|14|NM|tt-0002-12^Monocytes per^WinPath^^||20|PERCENT|||||F|||20200508131030|| NTE|0||Relish duck insect district orange thongs mud| OBX|15|NM|tt-0002-16^Basophils per^WinPath^^||20|PERCENT|||||F|||20200508131030|| OBX|16|NM|tt-0002-08^Neutrophils per^WinPath^^||20|PERCENT|||||F|||20200508131030|| NTE|0||Bridge sphere chateau| OBX|17|NM|tt-0002-05^Mean Cell Haemoglobin^WinPath^^||29.94|pg|[ 27 - 35 ]||||F|||20200508131030||

ginalee-dotcom commented 2 years ago

@castasint Yes it is something we would like to fix in the template generation tool. For dotliquid templates, we developed a new String filter to_double which you can use in the template to have the output display the numerical values as decimals instead of String. We have also been manually regenerating a lot of dotliquid templates to fix this issue.

We might add this fix to Handlebars templates later, but not anytime soon - as we plan to minimize our support for Handlebars and focus on improving dotliquid. If using dotliquid works for you as well, we encourage you to try out our latest tool on our dotliquid branch.

ginalee-dotcom commented 2 years ago

Fixed in liquid templates as mentioned in the comment above. Reference for the to_double String filter is here. Won't fix in Handlebars anytime soon, so closing this Issue for now. Please re-open if you have additional questions, thanks!