hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
1.94k stars 1.3k forks source link

Observation Resource - org.hl7.fhir.r4.model.Period datatype Issue for Travel-History #6016

Closed sumanathenahealth closed 1 week ago

sumanathenahealth commented 1 week ago

As Travel-History is one the type for OBSERVATION resource , Facing below exception , when we pass Period datatype for Obseravation.effective[x] in case of Travel-History for OBSERVATION resource

org.hl7.fhir.exceptions.FHIRException: Type mismatch: the type DateTimeType was expected, but org.hl7.fhir.r4.model.Period was encountered at org.hl7.fhir.r4.model.Observation.getEffectiveDateTimeType(Observation.java:2034) ~[org.hl7.fhir.r4-4.2.0.jar:?] at com.gehcit.fhir.r4.text.NarrativeModelFactory$24.getDates(NarrativeModelFactory.java:1033) ~[fhir-r4-api-0.0.1-SNAPSHOT.jar:?] at com.gehcit.fhir.r4.text.NarrativeTableViewGenerator.getBody(NarrativeTableViewGenerator.java:81) ~[fhir-r4-api-0.0.1-SNAPSHOT.jar:?] at com.gehcit.fhir.r4.text.NarrativeTableViewGenerator.getHtml(NarrativeTableViewGenerator.java:45) ~[fhir-r4-api-0.0.1-SNAPSHOT.jar:?] at com.gehcit.fhir.r4.text.NarrativeViewGenerator.populateResourceNarrative(NarrativeViewGenerator.java:29) ~[fhir-r4-api-0.0.1-SNAPSHOT.jar:?] at ca.uhn.fhir.parser.JsonParser.encodeCompositeElementChildrenToStreamWriter(JsonParser.java:394) ~[hapi-fhir-base-4.2.0.jar:?]

To Reproduce Steps to reproduce the behavior:

  1. Pass period datatype for Observation.effective[x]

Expected behavior Expected behavior is hapi-fhir library , should not through the exception as per hl7 specification https://www.hl7.org/fhir/us/ecr/StructureDefinition-us-ph-travel-history.html

Screenshots hl7 Specification:

image

Environment (please complete the following information):

Additional context As per hl7 specification Obseravation.effective[x] should support dateTime, Period, Timing, instant data-types But when we use Period type which is applicable for travel-history , we are facing above mentioned exception

jamesagnew commented 1 week ago