11:26:49,135 INFO [ca.uhn.fhir.util.VersionUtil] (http-localhost/127.0.0.1:8443-2) HAPI FHIR version is: 3.2.0
11:26:49,160 INFO [ca.uhn.fhir.context.FhirContext] (http-localhost/127.0.0.1:8443-2) Creating new FHIR context for FHIR version [DSTU2]
11:26:59,912 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'deviceIdentifier' found while parsing
11:26:59,914 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'name' found while parsing
11:26:59,917 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'expirationDate' found while parsing
11:26:59,921 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'subject' found while parsing
11:26:59,922 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'taken' found while parsing
11:26:59,923 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'text' found while parsing
11:26:59,927 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'sequence' found while parsing
11:26:59,928 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'patientInstruction' found while parsing
11:26:59,930 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'doseQuantity' found while parsing
11:26:59,933 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'basedOn' found while parsing
11:26:59,940 WARN [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'interpretation' found while parsing
I am running the below code for parsing:
FhirContext fhCtxt = FhirContext.forDstu2();
IParser jsonParser = fhCtxt.newJsonParser();
DiagnosticReport report = jsonParser.parseResource(DiagnosticReport.class, decryptedRequest);
String resourceType = report.getResourceName();
if (DIAGNOSTIC_REPORT.equalsIgnoreCase(resourceType)) {
String decodedString = jsonParser.encodeResourceToString(report);
JSONObject decodedJSON = new JSONObject(decodedString);
But after String decodedString = jsonParser.encodeResourceToString(report); line I am seeing the errors for unknown elements found while parsing.
The JSON fhir input string is:
{\"resourceType\":\"Observation\",\"id\":\"as123\",\"text\":{\"status\":\"generated\"},\"contained\":[{\"resourceType\":\"Patient\",\"id\":\"12357899\",\"active\":true,\"gender\":\"male\",\"birthDate\":\"2006-10-12\"},{\"resourceType\":\"Device\",\"id\":\"f001\",\"identifier\":[{\"value\":\"12345\"}],\"type\":{\"coding\":[{\"code\":\"25062003\",\"display\":\"xyz, device\"}]},\"status\":\"active\",\"manufactureDate\":\"2015-08-08\"},{\"resourceType\":\"MedicationStatement\",\"id\":\"med006\",\"dateAsserted\":\"2014-02-22\",\"status\":\"Active\",\"effectiveDateTime\":\"2014-02-01\",\"dosage\":[{\"text\":\"5ml three times daily\",\"asNeededBoolean\":false,\"route\":{\"coding\":[{\"system\":\"http:snomed.infosct\",\"code\":\"260548002\",\"display\":\"Oral\"}]},\"maxDosePerPeriod\":{\"numerator\":{\"value\":3},\"denominator\":{\"value\":1,\"system\":\"http:unitsofmeasure.org\",\"code\":\"d\"}}}]}],\"status\":\"final\",\"category\":{\"coding\":[{\"code\":\"survey\",\"display\":\"Survey\"}],\"text\":\"Survey\"},\"code\":{\"coding\":[{\"code\":\"9272-6\",\"display\":\"1 minute Apgar Score\"},{\"code\":\"169895004\",\"display\":\"Apgar at 1 minute\"}],\"text\":\"1 minute Apgar Score\"},\"subject\":{\"reference\":\"#12357899\"},\"effectiveDateTime\":\"2016-05-18T22:33:22Z\",\"performer\":[{\"reference\":\"Practitionerexample\"}],\"valueQuantity\":{\"value\":0,\"code\":\"{score}\"},\"device\":{\"reference\":\"#f001\"},\"related\":[{\"type\":\"has-member\",\"target\":{\"reference\":\"#med006\"}}],\"component\":[{\"code\":{\"coding\":[{\"code\":\"32406-1\",\"display\":\"1 minute Apgar Color\"},{\"code\":\"249227004\",\"display\":\"Apgar color score\"}],\"text\":\"Apgar color score\"},\"valueCodeableConcept\":{\"coding\":[{\"extension\":[{\"url\":\"\",\"valueDecimal\":0}],\"code\":\"LA6722-8\",\"display\":\"The baby's whole body is completely bluish-gray or pale\"},{\"code\":\"0\"}],\"text\":\"0. The baby's whole body is completely bluish-gray or pale\"}},{\"code\":{\"coding\":[{\"code\":\"32407-9\",\"display\":\"1 minute Apgar Heart Rate\"},{\"code\":\"249223000\",\"display\":\"Apgar heart rate score\"}],\"text\":\"Apgar respiratory effort score\"},\"valueCodeableConcept\":{\"coding\":[{\"extension\":[{\"url\":\"\",\"valueDecimal\":0}],\"code\":\"LA6716-0\",\"display\":\"No heart rate\"},{\"code\":\"0\"}],\"text\":\"0. No heart rate\"}},{\"code\":{\"coding\":[{\"system\":\"g\",\"code\":\"32409-5\",\"display\":\"1 minute Apgar Reflex Irritability\"},{\"code\":\"249226008\",\"display\":\"Apgar response to stimulus score\"}],\"text\":\"Apgar response to stimulus score\"},\"valueCodeableConcept\":{\"coding\":[{\"extension\":[{\"url\":\"\",\"valueDecimal\":0}],\"code\":\"LA6719-4\",\"display\":\"No response to airways being suctioned\"},{\"code\":\"0\"}],\"text\":\"0. No response to airways being suctioned\"}},{\"code\":{\"coding\":[{\"code\":\"32408-7\",\"display\":\"1 minute Apgar Muscle Tone\"},{\"code\":\"249225007\",\"display\":\"Apgar muscle tone score\"}],\"text\":\"Apgar muscle tone score\"},\"valueCodeableConcept\":{\"coding\":[{\"extension\":[{\"url\":\"\",\"valueDecimal\":0}],\"code\":\"LA6713-7\",\"display\":\"Limp; no movement\"},{\"code\":\"0\"}],\"text\":\"0. Limp; no movement\"}},{\"code\":{\"coding\":[{\"code\":\"32410-3\",\"display\":\"1 minute Apgar Respiratory effort\"},{\"code\":\"249224006\",\"display\":\"Apgar respiratory effort score\"}],\"text\":\"Apgar respiratory effort score\"},\"valueCodeableConcept\":{\"coding\":[{\"extension\":[{\"url\":\"\",\"valueDecimal\":0}],\"code\":\"LA6725-1\",\"display\":\"Not breathing\"},{\"code\":\"0\"}],\"text\":\"0. Not breathing\"}}]}
Thanks!
--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/295a7484-2407-4955-b166-b129f6200dde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/44bd6c69-d44e-49b2-87cc-11a59ce6707b%40googlegroups.com.