You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Java Spring Boot application using spring-boot-starter-parent version 3.4.1, and employing HAPI FHIR libraries at version 7.6.1 on a Windows 11 PC using Java 17.
This screenshot illustrates that mr.getMedicationReference().getReference() is #medication-MBS-Test1-1, and that the contained resource, available at mr.getContained().get(0), also has an id of #medication-MBS-Test1-1. They both are prepended with a #.
However, the source JSON that is used to build these objects is not the same. This is a screenshot showing the id element on the contained Medication resource, which as we can see does not include a # prefix:
So, somewhere between ingesting the resource and processing it, a # is getting prepended onto the contained resource's id field. At least, that's what appears to be happening.
As such, when logic gets into getContained(reference), that logic in there is not expecting the contained resource's id to have a # prefix already on it, which it dutifully appends to perform a string match. But it really shouldn't do that in this case, and is causing the call to always return null:
Finally, here's the state of things after returning from the call to getContained(reference):
To Reproduce
Steps to reproduce the behavior:
Import these FHIR resources into a sandbox of your choice:
Attempt to retrieve the contained Medication from the MedicationRequest resource using medicationRequest.getContained(medicationRequest.getMedicationReference().getReference())
Expected behavior
The call to getContained(reference) should return the referenced resource.
Screenshots
See above
Environment (please complete the following information):
HAPI FHIR: Version 7.6.1
OS: Windows 11
Browser: Firefox 134
Java: OpenJDK 17
Additional context
None
The text was updated successfully, but these errors were encountered:
Describe the bug
Java Spring Boot application using spring-boot-starter-parent version 3.4.1, and employing HAPI FHIR libraries at version 7.6.1 on a Windows 11 PC using Java 17.
Testing ability to retrieve a contained resource, but calls to DomainResource.getContained(reference) are failing when they should not.
This screenshot illustrates that mr.getMedicationReference().getReference() is
#medication-MBS-Test1-1
, and that the contained resource, available at mr.getContained().get(0), also has an id of#medication-MBS-Test1-1
. They both are prepended with a#
.However, the source JSON that is used to build these objects is not the same. This is a screenshot showing the id element on the contained Medication resource, which as we can see does not include a
#
prefix:So, somewhere between ingesting the resource and processing it, a
#
is getting prepended onto the contained resource's id field. At least, that's what appears to be happening.As such, when logic gets into getContained(reference), that logic in there is not expecting the contained resource's id to have a
#
prefix already on it, which it dutifully appends to perform a string match. But it really shouldn't do that in this case, and is causing the call to always return null:Finally, here's the state of things after returning from the call to getContained(reference):
To Reproduce
Steps to reproduce the behavior:
MBS-Test1-Patient.json
MBS-Test1-MedicationRequestWithContainedMedication.json
Expected behavior
The call to getContained(reference) should return the referenced resource.
Screenshots
See above
Environment (please complete the following information):
Additional context
None
The text was updated successfully, but these errors were encountered: