FHIR-Converter icon indicating copy to clipboard operation
FHIR-Converter copied to clipboard

Error Invalid JSON generated: line 154724:16 no viable alternative at input

Open pradsin opened this issue 2 years ago • 2 comments

I am converting ccda data to fhir format. for 50% of the files the utility is giving the following error.

Microsoft.Health.Fhir.Liquid.Converter.Tool.exe : Error Invalid JSON generated: line 154724:16 no viable alternative at input '"entry":[{"fullUrl":"urn:uuid:150de6e5-296a-dac1-7fb6-ba9ad5176863","resource":{"resourceType":"Compo sition","id":"150de6e5-296a-dac1-7fb6-ba9ad5176863","identifier":{"use":"official","value":"af2144b7-e0c5-47e7-9808-24b12f8f922c",},"status":"final","type":{"coding":[{"code":"34133-9","display":"Summarization of Episode Note","system":"http://loinc.org",},],},"date":"2022-06-14T13:26:29+05:30","title":"Clinical Summary","confidentiality":"N","attester":[{"mode":"legal","time":"2022-06-

pradsin avatar Jun 16 '22 08:06 pradsin

This is a sample file which is failing

Blake_Bradford_ZZZZZ006QS.zip

pradsin avatar Jun 16 '22 09:06 pradsin

@hongyh13 can this issue be closed?

irenepjoseph avatar Oct 05 '22 18:10 irenepjoseph

I observed the same problem when converting a Questionnaire from STU3 to R4. The problem at that place was in the temporary generated Response the inital[x] -> valueBoolean and valueDecimal have been written as "unknown".

Had to change the file Questionnaire/_initial.liquid to look like:

{
   {% if msg.initialBoolean != null -%}
  "valueBoolean" : {{msg.initialBoolean}},
  {% endif -%}
  {% if msg.initialDecimal != null -%}
  "valueDecimal" : {{msg.initialDecimal}},
  {% endif -%}
  {% if msg.initialInteger != null -%}
  "valueInteger" : {{msg.initialInteger}},
  {% endif -%}
  {% if msg.initialDate != null -%}
  "valueDate" : "{{msg.initialDate}}",
  {% endif -%}
  {% if msg.initialDateTime != null -%}
  "valueDateTime" : "{{msg.initialDateTime}}",
  {% endif -%}
  {% if msg.initialTime != null -%}
  "valueTime" : "{{msg.initialTime}}",
  {% endif -%}
  {% if msg.initialString != null -%}
  "valueString" : "{{msg.initialString}}",
  {% endif -%}
  {% if msg.initialUri != null -%}
  "valueUri" : "{{msg.initialUri}}",
  {% endif -%}
  {% if msg.initialAttachment != null -%}
  "valueAttachment" : {{msg.initialAttachment | to_json_string | default : '""'}},
  {% endif -%}
  {% if msg.initialCoding != null -%}
  "valueCoding" : {{msg.initialCoding | to_json_string | default : '""'}},
  {% endif -%}
  {% if msg.initialQuantity != null -%}
  "valueQuantity" : {{msg.initialQuantity | to_json_string | default : '""'}},
  {% endif -%}
  {% if msg.initialReference != null -%}
  "valueReference" : {{msg.initialReference | to_json_string | default : '""'}},
  {% endif -%}
  "initial[x]" : "",
}

after the additional "if"s at least this part of the Questionaires rendered fine. "enableWhen"s are another story :-/

MenNoWar avatar Dec 07 '22 14:12 MenNoWar

Hi @pradsin!

You can update the template on your end to fit your data by editing the Observation.liquid file by adding if condition before referenceRange and interpretation attribute: Ex: {% if observationEntry.referenceRange -%} "referenceRange": [ ........... ], {% endif -%} {% if observationEntry.interpretationCode -%} "interpretation": .......... {% endif -%}

Hope that helps!

evachen96 avatar Mar 27 '23 19:03 evachen96