fhir-data-pipes icon indicating copy to clipboard operation
fhir-data-pipes copied to clipboard

`text` field is lost when the Hapi object is converted to `Avro`

Open chandrashekar-s opened this issue 10 months ago • 4 comments

During conversion from HAPI to Avro, the text field is lost in the converted Avro object. This needs to be debugged. In general, all the fields should be copied to Avro object, so that when the Avro object is converted back to Hapi, it is equavalient to the original HAPI object.

chandrashekar-s avatar Apr 04 '24 12:04 chandrashekar-s

Original Hapi object

{
  "resourceType": "Patient",
  "id": "example",
  "meta": {
    "profile": [
      "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
    ]
  },
  "text": {
    "status": "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative</b></p><p><b>id</b>: example</p><p><b>meta</b>: </p><p><b>identifier</b>: Medical Record Number: 1032702 (USUAL)</p><p><b>active</b>: true</p><p><b>name</b>: Amy V. Shaw , Amy V. Baxter </p><p><b>telecom</b>: ph: 555-555-5555(HOME), [email protected]</p><p><b>gender</b>: female</p><p><b>birthDate</b>: 1987-02-20</p><p><b>address</b>: </p><ul><li>49 Meadow St Mounds OK 74047 US </li><li>183 Mountain View St Mounds OK 74048 US </li></ul></div>"
  }
}  

when the above hapi object is converted to Avro and then reconverted back to HAPI again, the div field under the text is lost.

Reconverted HAPI object from Avro

{
  "resourceType": "Patient",
  "id": "example",
  "meta": {
    "profile": [
      "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
    ]
  },
  "text": {
    "status": "generated"
  }
}  

chandrashekar-s avatar Apr 04 '24 12:04 chandrashekar-s

I debugged this and the root cause seems to be in the core HAPI code. I have filed this issue to follow-up with that team.

bashir2 avatar Jul 05 '24 22:07 bashir2

The filed issue is fixed and a new release has been done; we should probably just update a dependency.

bashir2 avatar Sep 17 '24 14:09 bashir2

The filed issue is fixed and a new release has been done; we should probably just update a dependency.

We get the updated artifacts (e.g., ca.uhn.hapi.fhir:org.hl7.fhir.r4) through hapi-fhir-structures-* artifact dependencies. The core issues seems to be fixed on org.hl7.fhir.r4:6.3.19 (and later) according to release notes. The current latest hapi-fhir-structures-* releases (7.4.0) are not caught up to 6.3.19 yet.

bashir2 avatar Sep 18 '24 18:09 bashir2