Stream: implementers
Topic: Searching by extension value
Andrew Broadbent (Dec 08 2016 at 16:06):
Hi all, I'm currently looking into filtering our searching on a HAPI backend. Most of our data consists of custom resource types which I have implemented as profiles on Basic via adding extension to them. I'm just wondering what the form of the url would be to search for resources which have an extension of a given value.
Andrew Broadbent (Dec 08 2016 at 16:08):
As an example. I have a profile which captures instances of cars passing through speed traps. It defines that it has the extension 'speed' which contains 'valueFloat' and the extension 'registration' which contains 'valueString'. How would I search for all resources where speed is greater than 30.0 in HAPI?
Lloyd McKenzie (Dec 08 2016 at 16:17):
You would define your own SearchParameter instances and declare that you support those in your Conformance / CapabilityStatement
Andrew Broadbent (Dec 08 2016 at 16:55):
Are SearchParameters something defined in the fhir spec, or are they just part of HAPI? I can't seem to find anything in the documentation specifically showing how to declare them. I was also wondering if defining and using them is something that can be done in data/through the rest api, or does it require specific implementation and recompiling the backend? The issue I'm having is that we're trying to create a system where end users can effectively define their own resource type, as we can't possibly know all the different kinds of data that they will input.
Lloyd McKenzie (Dec 08 2016 at 17:01):
SearchParameter is a resource like any other. If you have a question about how custom search parameters are supported by HAPI, that's probably best asked on the HAPI stream
Andrew Broadbent (Dec 08 2016 at 17:07):
Ok no problem. Is the HAPI stream hosted somewhere else? Their site links to here, and there's only 3 streams listed here.
Josh Mandel (Dec 08 2016 at 18:20):
You may need to click on the settings gear in the left-hand streams list, where you should see HAPI.
Grahame Grieve (Dec 08 2016 at 19:15):
you should also look at the example in the spec for this:
Grahame Grieve (Dec 08 2016 at 19:16):
http://build.fhir.org/searchparameter-example-extension.html
Grahame Grieve (Dec 08 2016 at 19:19):
p.s. "a profile which captures instances of cars passing through speed traps" - doesn't really sound much like healthcare to me? Is this a side use, or is your primary application outside healthcare? and if so, why use FHIR?
Andrew Broadbent (Dec 09 2016 at 09:51):
Thanks I'll take a look. As for the example; it was just the simplest example I could think of that I knew wouldn't be related to any of the existing profiles. The problem that I have is that I'm trying to port a legacy system and it's data to forge. In that system users can develop analogue to resource types within there data; i.e. one user creates a type called 'Patient' and then all other users try to map their patient data on to that type.
Andrew Broadbent (Dec 09 2016 at 09:53):
I'm having difficulty using the existing fhir analogues to our types because there is large number of them in the legacy system, and I can't linearly map the values, so developing a script to do it requires a lot of special cases. My work around has been to develop a profile on basic for each of our types, and emulate the ability to create your own resource types. I just wanted to avoid people suggesting that I use the existing resource types as, although I intend to, the first pass will be done in this more clunky way as a proof of concept.
Xin Liu (Jul 03 2017 at 19:35):
I wonder if we are able to search resource by providing extension value in the GET url endpoint.
Grahame Grieve (Jul 03 2017 at 19:51):
see http://hl7.org/fhir/searchparameter.html#srch
Xin Liu (Jul 05 2017 at 17:26):
Thank you so much for your reply. But do you have a realistic example so that I can know better. For example if I want to search all the Observation resource with gene name TPMT, and this gene name is stored in the observation-geneticsGene profile extension. What will the url endpoint look like by using the Restful GET.
Lloyd McKenzie (Jul 05 2017 at 18:33):
To search by an extension, you'll need to define a custom SearchParameter and declare it in your CapabilityStatement. The name of that parameter is up to you. So your query would look like this:
. . .
GET [base]/Observation?some-custom-search-name=TPMT
. . .
Lloyd McKenzie (Jul 05 2017 at 18:33):
(Assuming that gene name is a string or that the code system is fixed)
Eric Haas (Jul 05 2017 at 20:25):
There is an example in USCore for a search parameter on the Patient extension Race here
Eric Haas (Jul 05 2017 at 20:30):
(Which I should update to include the fhirpath) GF#13605
Grahame Grieve (Jul 06 2017 at 09:15):
there is no single answer right now for that extension because we do not define a common search parameter for it
Xin Liu (Jul 06 2017 at 15:56):
I am using the SearchParamDefinition class to create the customer parameter, and there are some example to show how to use to to create the parameter for the resource field, but I cannot get an example for creating the extension parameter. I wonder if I can include the extension.url within the SearchParamDefinition class. If so, where should I place the url to? should I put into the path field of the class?
Lloyd McKenzie (Jul 06 2017 at 16:17):
That would be in the xpath
Xin Liu (Jul 06 2017 at 16:26):
But SearchParamDefinition only have path method, not the xpath. I wonder what format that should look like.
Lloyd McKenzie (Jul 06 2017 at 16:46):
Are you using STU3? I see it clearly here: http://hl7.org/fhir/searchparameter.html#resource
Eric Haas (Jul 06 2017 at 16:48):
is in current build too?
Last updated: Apr 12 2022 at 19:14 UTC