Contained Resource Missing

110 views
Skip to first unread message

Annie

unread,
Jun 11, 2018, 4:58:28 PM6/11/18
to HAPI FHIR
Hi,

For Observation request found that along with the Contained node basedOn node is also getting eliminated after the below line

decodedString = jsonParser.encodeResourceToString(obsReport);

the contained node is getting maintained till below lines

IParser jsonParser = fhCtxt.newJsonParser();
Observation obsReport = jsonParser.parseResource(Observation.class, decryptedRequest);

But when it is going to jsonParser.encodetoString(obsReport ) contained and basedOn node is getting removed,even when we tried the same in XmlParser could not get the contained and basedOn nodes

Please find the below json structure details before and after encodetoString () 


"resourceType":"Observation",
• "id":"deb53a8c-2667-4659-b938-7197e53b4bf1",
• "contained":[],
• "identifier":[],
• "basedOn":[],
• "status":"final",
• "category":[],
• "code":{},
• "subject":{},
• "effectiveDateTime":"2012-09-17",
• "performer":[],
• "interpretation":{},
• "device":{ 
o "reference":"Device/example"
},
• "component":[]

After encodetoString():


• "resourceType":"Observation",
• "id":"deb53a8c-2667-4659-b938-7197e53b4bf1",
• "identifier":[],
• "status":"final",
• "category":{},
• "code":{},
• "subject":{},
• "effectiveDateTime":"2012-09-17",
• "performer":[],
• "interpretation":{},
• "device":{},
• "component":[]

Thanks,
Annie

James Agnew

unread,
Jun 11, 2018, 6:26:10 PM6/11/18
to anita...@gmail.com, HAPI FHIR
HAPI FHIR should be encoding any of those empty arrays or empty objects in the output. I am unable to reproduce this.

Can you please create a concise code snippet that demonstrates the issue you are having?

Cheers,
James

--
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/08f2b808-0549-4f04-9ae4-6f45067d8f37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

anita kumari

unread,
Jun 12, 2018, 11:34:09 AM6/12/18
to James Agnew, HAPI FHIR
Please find the screenshot






To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.

anita kumari

unread,
Jun 12, 2018, 11:46:57 AM6/12/18
to James Agnew, HAPI FHIR
Please find the sample request (json fhir)

{
  "resourceType": "Observation",
  "id": "1442525252",
  "text": {
    "status": "generated"
},
"contained":[
{
  "resourceType": "Patient",
  "id": "VIJJU-KAUDM",
  "birthDate": "2006-10-12",
  "gender": "male",
  "active": true
},
{
  "resourceType": "Device",
  "udi": {
    "deviceIdentifier": "A9999XYZ100T0474",
    "name": "xyz MDI"
  },
  "status": "active",
  "type": {
  "coding": [
      {
        "system": "https://www.xyz.com/",
        "code": "86184003",
        "display": "xyz Health"
      }
    ],
    "text": "abccc"
  },
  "manufacturer": "xyz Health",
  "model": "AB 45-J",
  "manufactureDate": "2013-02-01",
  "expirationDate": "2014-02-01",
  "patient": {
    "reference": "Patient/123"
  },
  "note": [
    {
      "authorReference": {
        "reference": "Practitioner/xcda-author"
      },
      "time": "2015-06-28T14:03:32+10:00",
      "text": "QA Checked"
    }
  ]
},
{
  "resourceType": "MedicationStatement",
  "id": "example006",
  "status": "Active",
  "medicationCodeableConcept": {
    "coding": [
      {
        "system": "http://snomed.info/sct",
        "code": "27658006",
        "display": "xyz Medication"
      }
    ]
  },
  "effectiveDateTime": "2014-02-01",
  "dateAsserted": "2014-02-22",
  "subject": {  
    "reference": "Patient/pat1",
    "display": "Tom Holden"
  },
  "taken": "n",
  "note": [
    {
      "text": "Patient indicates he missed the occasional dose"
    }
  ],
  "dosage": [
    {
      "sequence": 1,
      "text": "5ml three times daily",
  "patientInstruction": "Regimen:Take one to two tablets every four to six hours as needed for rib pain",
      "asNeededBoolean": false,
      "route": {
        "coding": [
          {
            "system": "http://snomed.info/sct",
            "code": "260548002",
            "display": "Oral"
          }
        ]
      },
      "doseQuantity": {
        "value": 5,
        "unit": "mL"
      }
    }
  ]
}

],
  "identifier": [
    {
"use":"official",
      "value": "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281"
    },
{
      "type": {
        "coding": [
          {
            "system": "http://hl7.org/fhir/identifier-type",
            "code": "SNO"
          }
        ],
        "text": "Serial Number"
      },
      "value": "AMID-342135-8464"
    }
  
  ],
  "basedOn": [
    {
      "identifier": {
        "system": "https://acme.org/identifiers",
        "value": "1234"
      }
    }
  ],
  "status": "final",
  "category": [
    {
      "coding": [
        {
          "system": "http://hl7.org/fhir/observation-category",
          "code": "xyz Readings",
          "display": "xyz Readings"
        }
      ]
    }
  ],
  "code": {
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "85354-9",
        "display": " xyz "
      }
    ],
    "text": " xyz"
  },
  "subject": {
    "reference": "Patient/123"
  },
  "effectiveDateTime": "2012-09-17",
  "performer": [
    {
      "reference": "Practitioner/xyz"
    }
  ],
  "interpretation": {
    "coding": [
      {
        "system": "https://www.xyz.com/",
        "code": "86184003",
        "display": "In Control"
      }
    ],
    "text": "In Control"
  },
  "device": {
    "reference": "Device/example"
  },
  "component": [
    {
      "code": {
        "coding": [
          {
            "system": "https://www.xyz.com/",
            "code": "8462-4",
            "display": "xyz Med"
          }
        ]
      },
      "valueQuantity": {
        "value": 60,
        "unit": "mmHg",
        "system": "http://unitsofmeasure.org",
        "code": "mm[Hg]"
      },
      "interpretation": {
        "coding": [
          {
            "system": "http://hl7.org/fhir/v2/0078",
            "code": "N",
            "display": "In Control"
          }
        ],
        "text": "In Control"
      }
    }
  ]
}

James Agnew

unread,
Jun 12, 2018, 6:03:57 PM6/12/18
to anita...@gmail.com, HAPI FHIR
Hi Anita,

Unfortunatly I am unable to run a code screenshot, so that is not really useful.

Please see our guide to getting help. If you can narrow your issue down to a small snippet of code that shows only the issue you are having and removes anything unrelated, you will greatly improve the chances of getting a solution.

Cheers,
James

To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.

Annie

unread,
Jun 21, 2018, 8:03:26 PM6/21/18
to HAPI FHIR
Hi James,

I am seeing "Unknown Element" found while parsing using HAPI library. Can you please suggest on the fix?

Console log:

 

04:24:44,994 INFO  [ca.uhn.fhir.context.FhirContext] (http-localhost/127.0.0.1:8443-2) Creating new FHIR context for FHIR version [DSTU2]

04:24:46,891 WARN  [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'expirationDate' found while parsing

04:24:46,891 WARN  [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'subject' found while parsing

04:24:46,891 WARN  [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'taken' found while parsing

04:24:46,892 WARN  [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'partOf' found while parsing

04:24:46,892 WARN  [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'sequence' found while parsing

04:24:46,892 WARN  [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'doseQuantity' found while parsing

04:24:46,893 WARN  [ca.uhn.fhir.parser.LenientErrorHandler] (http-localhost/127.0.0.1:8443-2) Unknown element 'basedOn' found while parsing


Thanks!

Reply all
Reply to author
Forward
0 new messages