ehealthplatformstandards / laboResultVisualization

1 stars 5 forks source link

Thymeleaf problems with HAPIFHIR 6.6.1 #28

Closed bdc-ehealth closed 1 year ago

bdc-ehealth commented 1 year ago

Bart Decuypere: Hi, we are implementing automatic narrative generation, and after an upgrade from 6.2.5 to a later version (6.4.4 and also 6.6.1), we see that the automatic narrative generation is no longer functioning for R4. (https://hapifhir.io/hapi-fhir/docs/model/narrative_generation.html)

This line, which should be generating the narrative, is only returning an empty Narrative: https://github.com/hapifhir/org.hl7.fhir.core/blob/ff44e50fc3d66b6c795aa8f2802efd0384265575/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/DomainResource.java#L99

We have set our narrative generator on the context, as indicated on (https://hapifhir.io/hapi-fhir/docs/model/narrative_generation.html)

Bart Decuypere: If you need more information from me to be able to help me, please say so! Additional info can be found here: https://chat.fhir.org/#narrow/stream/179167-hapi/topic/upgrade.20hapi-fhir-base.20trouble

Bart Decuypere: I further debugged this issue, and the problem is here: https://github.com/hapifhir/hapi-fhir/blob/73d6997d214c23f54c2acf66bd6bbd54092609e2/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative2/NarrativeTemplateManifest.java#L269

It is no longer possible to assign a template to a resource only, if that resource has a profile assigned to it. The code should be changed to:

.filter(t -> theProfiles.isEmpty() || t.getAppliesToProfiles().isEmpty() || t.getAppliesToProfiles().stream().anyMatch(theProfiles::contains)) In that way, if the properties file does not contain a profile, and the resource does, the template will still apply for the resource. This is the intended behaviour, I think.

Bart Decuypere: And the bug was introduced by @James Agnew on Jan 24 of this year: https://github.com/hapifhir/hapi-fhir/pull/4438 .

bdc-ehealth commented 1 year ago

As a workaround, I updated narrative.properties, but the functionality is not completely identical: see remark above.