I'm itarating over all enteties of a ressource type like so.
while (query.getLink(IBaseBundle.LINK_NEXT) != null) {
query.getLink("next").setUrl(FhirUtils.replaceBaseUrl(query.getLink("next").getUrl, fhirClient.getServerBase))
query = fhirClient.loadPage().next(query).execute()
resources.addAll(getResourcesFromBundle(query))
}
The issue I'm having is that the entities in the response (ex. Specimen) will not contain the field display it will be null. This field is set by the CodeSystem i've defined in the Implementation Guide, depending on the code value. Just for reference, I'm attaching a screenshot of a exemple Specimen resource.
If the query is performed as so (using search()):
fhirClient.search().forResource(request.type).returnBundle(classOf[Bundle]).execute()
the display field will be present.
Does anyone have any idea on possible solutions or why this is happening?
The display property is not always guaranteed to be present in all FHIR resources. It is an optional property that may or may not be populated depending on the resource type and the server implementation.
If the display property is not present in a resource, you can use other properties e.g. code (if present) to identify and describe the resource or at least make sure your code can handle the scenario when the display doesn't exist e.g.