HL7 / fhir-ig-publisher

Source code for the IG publisher
Apache License 2.0
67 stars 55 forks source link

Contained Observations with more than one note will crash the publisher #915

Open JohnMoehrke opened 2 months ago

JohnMoehrke commented 2 months ago

I had reported this in chat. https://chat.fhir.org/#narrow/stream/179252-IG-creation/topic/IG.20publisher.201.2E6.2E11.20crash

When an Observation is contained (e.g. DiagnosticReport containing the Observation) And when the Observation has more than one .note (e.g. note.text) Then the IG publisher will crash

Note multiple notes does not crash the publisher when they are not contained.

Generating Narratives                                                                                (00:00.003 / 00:52.650, 521Mb)
gen narratives                                                                                       (00:00.003 / 00:52.653, 521Mb)
narrative for C:\Users\john.moehrke\git\testMed\fsh-generated\resources\ImplementationGuide-johnmoehrke.testmed.example : johnmoehrke.testmed.example (00:00.002 / 00:52.656, 521Mb)
narrative for C:\Users\john.moehrke\git\testMed\fsh-generated\resources\DiagnosticReport-ex-labReport-2 : ex-labReport-2 (00:00.105 / 00:52.761, 527Mb)
Exception in thread "main" java.lang.Error: Access single value, but value count is 2
        at org.hl7.fhir.r5.renderers.utils.ElementWrappers$PropertyWrapperMetaElement.value(ElementWrappers.java:382)
        at org.hl7.fhir.r5.renderers.DiagnosticReportRenderer.addObservationToTable(DiagnosticReportRenderer.java:464)
        at org.hl7.fhir.r5.renderers.DiagnosticReportRenderer.addObservationToTable(DiagnosticReportRenderer.java:346)
        at org.hl7.fhir.r5.renderers.DiagnosticReportRenderer.buildObservationsTable(DiagnosticReportRenderer.java:239)
        at org.hl7.fhir.r5.renderers.DiagnosticReportRenderer.render(DiagnosticReportRenderer.java:123)
        at org.hl7.fhir.r5.renderers.ResourceRenderer.render(ResourceRenderer.java:121)
        at org.hl7.fhir.igtools.publisher.Publisher.generateNarratives(Publisher.java:2166)
        at org.hl7.fhir.igtools.publisher.Publisher.loadConformance(Publisher.java:5552)
        at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:1188)
        at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:1027)
        at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:12946)
Press any key to continue . . .
JohnMoehrke commented 2 months ago

can be reproduced with testMed IG https://github.com/JohnMoehrke/testMed

The following instance is found in that github, with the second .note commented out to allow the build to succeed.

Instance: ex-labTest-3 InstanceOf: Observation Usage: #inline