Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE while trying to find StructureDefinition for a resource extensions that is missing. #1027

Closed
bashir2 opened this issue Apr 19, 2024 · 0 comments · Fixed by #1050
Closed
Assignees
Labels
bug Something isn't working P1:must As issue that definitely needs to be implemented in near future.

Comments

@bashir2
Copy link
Collaborator

bashir2 commented Apr 19, 2024

Steps to reproduce (this is the how I found about this issue; it probably can be reproduced directly by FhirEtl and for any other resource type that has a missing extension not just QuestionnaireResponse):

  • Upload a QuestionnaireResponse resource to the source FHIR server with some extensions that are not US-core
  • Replace the resourceList line in application.yaml here with
  resourceList: "QuestionnaireResponse"
  • Then run the controller and do a "Run Full"
java -jar ./target/controller-bundled.jar --server.port=[PORT]

The following exception is thrown; note this only happens when structureDefinitionsClasspath: "/r4-us-core-definitions" is set (which is by default in the above application.yaml). Instead of throwing NPE, we should gracefully handle this case and communicate the issue more clearly:

Caused by: java.lang.NullPointerException: Cannot invoke "org.hl7.fhir.r4.model.StructureDefinition.getSnapshot()" because "this.structureDefinition" is null
        at com.cerner.bunsen.definitions.r4.R4StructureDefinitions$StructureDefinitionWrapper.getSnapshotDefinitions(R4StructureDefinitions.java:71)
        at com.cerner.bunsen.definitions.StructureDefinitions.extensionElementToFields(StructureDefinitions.java:166)
        at com.cerner.bunsen.definitions.StructureDefinitions.elementToFields(StructureDefinitions.java:279)
        at com.cerner.bunsen.definitions.StructureDefinitions.transformChildren(StructureDefinitions.java:423)
        at com.cerner.bunsen.definitions.StructureDefinitions.elementToFields(StructureDefinitions.java:345)
        at com.cerner.bunsen.definitions.StructureDefinitions.transformChildren(StructureDefinitions.java:423)
        at com.cerner.bunsen.definitions.StructureDefinitions.transformRoot(StructureDefinitions.java:583)
        at com.cerner.bunsen.definitions.StructureDefinitions.transform(StructureDefinitions.java:517)
        at com.cerner.bunsen.avro.AvroConverter.visitResource(AvroConverter.java:69)
        at com.cerner.bunsen.avro.AvroConverter.forResource(AvroConverter.java:182)
        at com.cerner.bunsen.avro.AvroConverter.forResources(AvroConverter.java:157)
        at com.google.fhir.analytics.AvroConversionUtil.getConverter(AvroConversionUtil.java:170)
        at com.google.fhir.analytics.AvroConversionUtil.getResourceSchema(AvroConversionUtil.java:202)
        at com.google.fhir.analytics.ParquetUtil.createWriter(ParquetUtil.java:161)
        at com.google.fhir.analytics.ParquetUtil.write(ParquetUtil.java:176)
        at com.google.fhir.analytics.ParquetUtil.writeRecords(ParquetUtil.java:217)
        at com.google.fhir.analytics.FetchSearchPageFn.processBundle(FetchSearchPageFn.java:246)
        at com.google.fhir.analytics.FetchSearchPageFn.processBundle(FetchSearchPageFn.java:237)
        at com.google.fhir.analytics.FetchResources$SearchFn.processElement(FetchResources.java:144)

@bashir2 bashir2 added bug Something isn't working P1:must As issue that definitely needs to be implemented in near future. labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1:must As issue that definitely needs to be implemented in near future.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants