Stream: implementers
Topic: custom search parameter
Marko (Oct 19 2018 at 14:20):
I can't figure out how to create custom search parameter that also includes definition/url in capability statement (I always only have name, type and documentation). Can someone point me into right direction?
Lloyd McKenzie (Oct 19 2018 at 15:02):
Can you rephrase your question? I'm not totally clear on what you're trying to do and where you're running into trouble.
Marko (Oct 19 2018 at 15:12):
Yes, of course. So in my ResourceProvider class I have a search method. There I have defined my search parameter:
public Bundle findMethod(@OptionalParam(name = SP_ENCOUNTER) @Description(formalDefinition = "some description") ReferenceParam refParam) {}
Now this is using encounter as search parameter (SP_ENCOUNTER) that is part of DocumentReference. I can replace that with custom string and use that instead and efectively hava a custom search parameter.
Now the problem is, when I do that I would like do define that parameter a little bit better. What I get out of the box in my capability statement is something like this:
"type": "DocumentReference", "profile": { "reference": "http://hl7.org/fhir/Profile/DocumentReference" }, "interaction": [ { "code": "search-type" } ], "searchParam": [ { "name": "encounter", "type": "reference", "documentation": "some description" },
Now if I use custom parameter its name will be there instead of encounter (and that is ok) but I am looking for a way to include definition (url) as well in that list and I can't find a way to do it (https://www.hl7.org/fhir/capabilitystatement-definitions.html#CapabilityStatement.rest.resource.searchParam.definition)
Lloyd McKenzie (Oct 19 2018 at 15:50):
I'm not understanding what's preventing you from adding searchParam.definition. Is this an issue you're encountering with one of the reference implementations? If so, which one?
Marko (Oct 19 2018 at 16:33):
Can you please give me an example of using searchParam.definition in my code above?
Lloyd McKenzie (Oct 19 2018 at 16:44):
What code above? What reference implementation are you using?
Marko (Oct 19 2018 at 16:49):
My bad. I am using hapi-fhir.
Lloyd McKenzie (Oct 19 2018 at 16:54):
And so the issue is that within the searchParam object, you're not seeing a setter for "definition"? What verion of FHIR are you working with?
Marko (Oct 19 2018 at 17:03):
I am not even sure how to use custom SearchParam which I have defined.
Marko (Oct 19 2018 at 17:04):
SearchParam has a setter for URL which I think in the end maps to definition.
Lloyd McKenzie (Oct 19 2018 at 17:06):
Right. You actually have to host your custom search parameter somewhere in order for it to be referenced by the CapabilityStatement - someone querying the CapabilityStatement will also need to be able to query the Search Parameter.
Brandon Cunningham (May 06 2021 at 14:24):
Morning, Trying to figure out how i can search for the following.
I want to find all Encounters for a specific Location. I am trying a chained query but doesn't seem to work . Example : https://fhirserver.com/Encounter?subject:Location.name=ICU
Michele Mottini (May 06 2021 at 14:52):
The search parameter you want is location
: https://fhirserver.com/Encounter?location.name=ICU (subject
is the patient) - but you have to check if the server implements it and supports chained searches
Last updated: Apr 12 2022 at 19:14 UTC