FHIR Chat · querying copied profile · hapi

Stream: hapi

Topic: querying copied profile


view this post on Zulip Georg Fette (Dec 07 2018 at 08:47):

I copied the class Patient in the dst3 model package to a new class named Patient2. I renamed all mentions of "Patient" in that class to "Patient2". I added the new profile to the list of profiles in the resource "fhirversion.properties". I compiled everything and started a cli-server. I can now store a Patient2 in the server and retrieve all stored Patient2s with "client.search().forResource(Patient2.class).execute();". When I contrain the search with a where, however, I do not get any results. There seems to be a detail which I missed, to be able to search for new profile classes. Could somebody give me a hint ?

view this post on Zulip Patrick Werner (Dec 07 2018 at 13:20):

Hi Georg, i tried to reproduce your issue and didn't had one.

view this post on Zulip Patrick Werner (Dec 07 2018 at 13:22):

How i did it:
- created Patient2
- added Patient2 to: Fhirversion.properties
- extended enum ResourceType by Patient2

view this post on Zulip Patrick Werner (Dec 07 2018 at 13:25):

on the client side:

 ctx = FhirContext.forDstu3();
        String serverBase = "http://localhost:8080/baseDstu3";
        client = ctx.newRestfulGenericClient(serverBase);
        ctx.registerCustomType(Patient2.class);

        Bundle results = client.search().forResource(Patient2.class).where(Patient2.NAME.matches().value("Chalmers"))
                .returnBundle(Bundle.class).execute();

view this post on Zulip Georg Fette (Dec 07 2018 at 19:17):

ah, thank you. You hinted me to the first mistake I made:
I forgot to extend the enum ResourceType and so the Patient2 still returned ResourceType.Patient
The seconds mistake I made was that I forgot the method fhirType(). Without this method the parts of the resource are not indexed in the tables "hfj_spidx_token" and "hfj_spidx_string" in the database.
Now everything works like a charm.
Thanks a lot


Last updated: Apr 12 2022 at 19:14 UTC