FHIR Chat · Error in DiagnosticReport Narrative Generation · IG creation

Stream: IG creation

Topic: Error in DiagnosticReport Narrative Generation


view this post on Zulip Andy Stevens (Aug 10 2021 at 14:43):

When generating an example DiagnosticReport resource for my IG, I get the following error:

java.lang.NullPointerException: Cannot invoke "org.hl7.fhir.r5.model.DataType.isPrimitive()" because "type" is null
    at org.hl7.fhir.r5.renderers.DataRenderer.render(DataRenderer.java:361)
    at org.hl7.fhir.r5.renderers.PatientRenderer.describe(PatientRenderer.java:198)
    at org.hl7.fhir.r5.renderers.PatientRenderer.describe(PatientRenderer.java:170)
    at org.hl7.fhir.r5.renderers.DiagnosticReportRenderer.generatePatientSummary(DiagnosticReportRenderer.java:182)
    at org.hl7.fhir.r5.renderers.DiagnosticReportRenderer.populateSubjectSummary(DiagnosticReportRenderer.java:176)
    at org.hl7.fhir.r5.renderers.DiagnosticReportRenderer.render(DiagnosticReportRenderer.java:67)
    at org.hl7.fhir.r5.renderers.ResourceRenderer.render(ResourceRenderer.java:84)
    at org.hl7.fhir.igtools.publisher.Publisher.generateNarratives(Publisher.java:1176)
    at org.hl7.fhir.igtools.publisher.Publisher.loadConformance(Publisher.java:3912)
    at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:893)
    at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:748)
    at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:8566)

My example resource is this:

{
  "resourceType": "DiagnosticReport",
  "id": "HAICA-TC-Lab-DiagnosticReport",
  "meta": {
    "profile": [
      "http://cbsig.chai.gatech.edu/StructureDefinition/cbs-lab-diagnosticreport"
    ]
  },
  "category": [
    {
      "coding": [
        {
          "code": "LAB",
          "system": "http://terminology.hl7.org/CodeSystem/v2-0074"
        }
      ]
    }
  ],
  "status": "final",
  "code": {
    "coding": [
      {
        "code": "85069-3",
        "system": "http://loinc.org"
      }
    ]
  },
  "subject": {
    "reference": "Patient/HAICA-TC-Patient"
  },
  "specimen": [
    {
      "reference": "Specimen/HAICA-TC-Specimen"
    }
  ],
  "result": [
    {
      "reference": "Observation/HAICA-TC-Lab-Observation"
    }
  ]
}

It has something to do with the subject element but we cant figure out why theres an issue

view this post on Zulip Lloyd McKenzie (Aug 10 2021 at 15:06):

@Mark Iantorno

view this post on Zulip Mark Iantorno (Aug 10 2021 at 16:56):

what resource is "Patient/HAICA-TC-Patient" referring to

view this post on Zulip Mark Iantorno (Aug 10 2021 at 16:56):

Does it have a type

view this post on Zulip Andy Stevens (Aug 10 2021 at 17:13):

@Mark Iantorno This is the Patient resource it references:

{
  "resourceType": "Patient",
  "id": "HAICA-TC-Patient",
  "meta": {
    "profile": [
      "http://cbsig.chai.gatech.edu/StructureDefinition/cbs-patient"
    ]
  },
  "extension": [
    {
      "extension": [
        {
          "url": "ombCategory",
          "valueCoding": {
            "code": "2106-3",
            "system": "urn:oid:2.16.840.1.113883.6.238",
            "display": "White"
          }
        },
        {
          "url": "detailed",
          "valueCoding": {
            "code": "2135-2",
            "system": "urn:oid:2.16.840.1.113883.6.238",
            "display": "Hispanic or Latino"
          }
        },
        {
          "url": "text",
          "valueString": "Mixed"
        }
      ],
      "url": "http://cbsig.chai.gatech.edu/StructureDefinition/cbs-race"
    },
    {
      "extension": [
        {
          "url": "ombCategory",
          "valueCoding": {
            "code": "2186-5",
            "system": "http://terminology.hl7.org/CodeSystem/v2-0005"
          }
        },
        {
          "url": "text",
          "valueString": "Not Hispanic or Latino"
        }
      ],
      "url": "http://cbsig.chai.gatech.edu/StructureDefinition/cbs-ethnicity"
    },
    {
      "url": "http://cbsig.chai.gatech.edu/StructureDefinition/cbs-birthsex",
      "valueCodeableConcept": {
        "coding": [
          {
            "code": "F",
            "system": "http://terminology.hl7.org/CodeSystem/v2-0001"
          }
        ]
      }
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/patient-birthPlace",
      "valueAddress": {
        "country": "USA"
      }
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/patient-genderIdentity",
      "valueCodeableConcept": {
        "coding": [
          {
            "code": "female",
            "system": "http://hl7.org/fhir/gender-identity"
          }
        ]
      }
    }
  ],
  "address": [
    {
      "use": "Address-at-Diagnosis",
      "district": "Cobb",
      "state": "Georgia",
      "postalCode": "30126"
    },
    {
      "use": "Usual-Residence",
      "country": "USA"
    }
  ],
  "identifier": [
    {
      "type": {
        "coding": [
          {
            "code": "Local-Record-ID",
            "system": "http://cbsig.chai.gatech.edu/CodeSystem/cbs-temp-code-system",
            "display": "Local Record ID"
          }
        ],
        "text": "Local Record ID"
      },
      "system": "urn:temp:national-reporting-jurisdiction:48",
      "value": "C_auris_02"
    },
    {
      "type": {
        "coding": [
          {
            "code": "Local-Subject-ID",
            "system": "http://cbsig.chai.gatech.edu/CodeSystem/cbs-temp-code-system",
            "display": "Local Subject ID"
          }
        ],
        "text": "Local Subject ID"
      },
      "system": "urn:temp:national-reporting-jurisdiction:48",
      "value": "C_auris_PAT_02"
    }
  ],
  "gender": "female",
  "birthDate": "1940-01-01"
}

(which works fine when being referenced in other examples)

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:01):

So, looking at the code you have provided, this is occuring because the describe method is trying to pull a HumanName from the patient object, which I think is a mandatory field, and there is not one.

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:03):

So it pulls human name, it gets null, and then it passes that null to render, and when it can't find a match, it ends up at the last cases of the if statement

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:04):

 else if (type.isPrimitive()) {
      x.tx(type.primitiveValue());
    } else {
      x.tx("No display for "+type.fhirType());
    }

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:04):

and type.isPrimative() throws a NPE

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:05):

Is it intentional to not define a HumanName field for that Patient? @Andy Stevens

view this post on Zulip Andy Stevens (Aug 11 2021 at 14:13):

@Mark Iantorno Our application is for public health case reporting, so the patient resources are not going to have names as part of the case reporting workflow. Is this an issue with DiagnosticReport specifically? Because this error only happens when I have that example resource in our input.

view this post on Zulip Lloyd McKenzie (Aug 11 2021 at 14:15):

We should certainly update the publisher to handle the situation of the name being omitted.

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:18):

Is there a current version of the IG i can look at online?

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:25):

@Andy Stevens

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:27):

Like, I would like to see the differential table for the patient resource in this IG

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:27):

does it define HumanName as a non-mandatory field?

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:28):

What is the cardinality and is there a flag for that field?

view this post on Zulip Andy Stevens (Aug 11 2021 at 14:33):

Heres our current IG: http://cbsig.chai.gatech.edu/index.html
It doesnt have that set of examples that is causing the issue, but all of the profiles involved are published on there

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:34):

So that's a big dead link for me

view this post on Zulip Andy Stevens (Aug 11 2021 at 14:34):

name is originally a 0..* cardinality and we added a MS flag in case there ever will be a name (our sponsors like options), but still 0..*

view this post on Zulip Andy Stevens (Aug 11 2021 at 14:35):

oh sorry I completely forgot that its currently behind a VPN for us. Heres the differential table for the patient:
Screen-Shot-2021-08-11-at-10.35.07-AM.png

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:36):

okay

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:36):

So, please open an issue in github: https://github.com/hapifhir/org.hl7.fhir.core/issues (the files for this are located in the core project)

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:37):

include all the details you provided above with the differential table screenshot

view this post on Zulip Mark Iantorno (Aug 11 2021 at 14:39):

tag me in the github issue once you've created it @Andy Stevens

view this post on Zulip Andy Stevens (Aug 11 2021 at 14:48):

ok issue has been created

view this post on Zulip Richard Stanley (Aug 13 2021 at 01:55):

I also see a strange error in DiagnosticReport gen:

Generating Narratives                                                            (00:23.0711)
Publishing Content Failed: Cannot invoke "org.hl7.fhir.r5.renderers.utils.BaseWrappers$PropertyWrapper.hasValues()" because "t" is null (00:24.0535)
                                                                                 (00:24.0535)
Use -? to get command line help                                                  (00:24.0536)
                                                                                 (00:24.0537)
Stack Dump (for debugging):                                                      (00:24.0537)
java.lang.NullPointerException: Cannot invoke "org.hl7.fhir.r5.renderers.utils.BaseWrappers$PropertyWrapper.hasValues()" because "t" is null
    at org.hl7.fhir.r5.renderers.DiagnosticReportRenderer.fetchObservations(DiagnosticReportRenderer.java:194)
    at org.hl7.fhir.r5.renderers.DiagnosticReportRenderer.render(DiagnosticReportRenderer.java:123)
    at org.hl7.fhir.r5.renderers.ResourceRenderer.render(ResourceRenderer.java:84)
    at org.hl7.fhir.igtools.publisher.Publisher.generateNarratives(Publisher.java:1176)
    at org.hl7.fhir.igtools.publisher.Publisher.loadConformance(Publisher.java:3912)
    at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:893)
    at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:748)
    at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:8566)

view this post on Zulip Lloyd McKenzie (Aug 13 2021 at 01:56):

@Mark Iantorno

view this post on Zulip Mark Iantorno (Aug 13 2021 at 13:38):

This is a different issue, and should probably go in a different thread. The only thing in common is that you are both encountering issues with the same data type. Can you start a new thread with details on how you reproduced this, with all the inputs please.

view this post on Zulip Mark Iantorno (Aug 13 2021 at 13:38):

@Richard Stanley


Last updated: Apr 12 2022 at 19:14 UTC