FHIR Chat · fhir.parser.DataFormatException when searching for o · hapi

Stream: hapi

Topic: fhir.parser.DataFormatException when searching for o


view this post on Zulip Allan Bro Hansen (Jan 16 2017 at 13:36):

For Fhir 2.2, DSTU2
We have a named query returning a bundle of Patient and WalkInQueueItems. WalkInQueueItem is our own FHIR domain resources, and not a dstu2-ressource (surprise...).

In end-2-end test we test this by calling:
FhirContext ctx = FhirContext.forDstu2();
ctx.setParserErrorHandler(new NoLoggingErrorHandler());
client = ctx.newRestfulGenericClient("http://" + getUrl());
client.search()
.byUrl("Patient?_query=activeQueueItems")
.where(<someClientParam))
.returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class)
.execute();
(we are not happy about the byUrl-part, would have loved a "withQuery(String)"-possibility)

This results in the following error:
Caused by: ca.uhn.fhir.parser.DataFormatException: DataFormatException at [[row,col {unknown-source}]: [1,893]]: Unknown resource name "WalkInQueueItem" (this name is not known in FHIR version "DSTU2")
at ca.uhn.fhir.parser.XmlParser.doXmlLoop(XmlParser.java:277)
at ca.uhn.fhir.parser.XmlParser.parseResource(XmlParser.java:1051)
at ca.uhn.fhir.parser.XmlParser.doParseResource(XmlParser.java:188)
at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:644)
at ca.uhn.fhir.rest.client.BaseClient$ResourceResponseHandler.invokeClient(BaseClient.java:488)
at ca.uhn.fhir.rest.client.BaseClient$ResourceResponseHandler.invokeClient(BaseClient.java:440)
at ca.uhn.fhir.rest.client.BaseClient.invokeClient(BaseClient.java:320)
... 33 more

I have tried with a extension of a DSTU2-ressource(location) in stead of WalkInQueueItem: same error
I have tried with a standard DSTU2-ressource (appointment) in stead of WalkInQueueItem: no error

Seems to be a bug? Any workarounds?

view this post on Zulip Jens Villadsen (Jan 18 2017 at 09:21):

Most of the samples on http://hapifhir.io/doc_extensions.html assumes that the extended resource is defined as a class that is registered in the context using annotations. Is your server exposed somewhere?

view this post on Zulip Allan Bro Hansen (Jan 18 2017 at 09:40):

We extend the dstu2 hapi classes.
E.g extending Location:
@ResourceDef(name = "ArrivalLocation")
public class FhirArrivalLocation extends Location
Eg. extending baseResource:
@ResourceDef(name = "WalkInQueueItem")
public class FhirWalkInQueueItem extends BaseResource

view this post on Zulip Allan Bro Hansen (Jan 18 2017 at 09:49):

@James Agnew : any input on this?

view this post on Zulip Allan Bro Hansen (Jan 18 2017 at 16:38):

Hi
I needed to register the ressources:
ctx.registerCustomTypes(Arrays.asList(FhirWalkInQueueItem.class));
and it works :-)

view this post on Zulip Jens Villadsen (Jan 19 2017 at 09:37):

Great ;)


Last updated: Apr 12 2022 at 19:14 UTC