Stream: implementers
Topic: Create SearchParameter
Sophie Chen (Aug 02 2017 at 15:04):
I want to create an example of Search Parameter but failed. How should I deal with the elements "expression, xpath, and xpathUsage"?
Eric Haas (Aug 02 2017 at 15:50):
see my example here: http://build.fhir.org/ig/HL7/US-Core/SearchParameter-us-core-race.xml.html
does that help or are you asking for something more specific?
Sophie Chen (Aug 02 2017 at 16:58):
Thank you! Have you tried searching the Patient Resource with a certain race using the RESTful GET? Now I am trying to do something like search all the Observation resource with gene name TPMT, and this gene name is stored in the observation-geneticsGene profile extension. I am not clear about the url endpoint.
Sophie Chen (Aug 02 2017 at 16:59):
Thank you! Have you tried searching the Patient Resource with a certain race using the RESTful GET? Now I am trying to do something like search all the Observation resource with gene name TPMT, and this gene name is stored in the observation-geneticsGene profile extension. I am not clear about the url endpoint.
Eric Haas (Aug 02 2017 at 17:09):
the url for that extension is http://hl7.org/fhir/StructureDefinition/observation-geneticsGene
to create a search parameter would be a token
type and to search for code ( to search for string in display would use the :text
modifier. ) See the search page in the spec: http://build.fhir.org/search.html#token
Eric Haas (Aug 02 2017 at 17:24):
"Have you tried searching the Patient Resource with a certain race using the RESTful GET?" I haven't since I don't know which servers support it. Been meaning to get my own server up for a long time.
Sophie Chen (Aug 02 2017 at 17:29):
You can just search it on any browser. Below is a url that can get response.
http://fhirtest.uhn.ca/baseDstu3/Observation?_id=test-dstu3-1232-respiratoryrate
Sophie Chen (Aug 02 2017 at 17:30):
Sophie Chen: You can just search it on any browser. Below is a url that can get response.
http://fhirtest.uhn.ca/baseDstu3/Observation?_id=test-dstu3-1232-respiratoryrate
Sophie Chen (Aug 02 2017 at 17:51):
"I haven't since I don't know which servers support it. Been meaning to get my own server up for a long time."
It won't take too much time. I can never thank you too much if you are willing to have a try and give me some advice.
Lloyd McKenzie (Aug 02 2017 at 20:18):
Note that support for search criteria tends to require hand-coding within the server, so defining the custom SearchParameter instance merely says "this is what behavior should happen and this is how you declare support for it". There generally isn't a run-time way for servers to automatically add support for new SearchParameters
Xin Liu (Aug 03 2017 at 16:04):
Is that means there are no way to create the customer parameter directly from any of the HAPI FHIR server interface? the only way to create the customer search parameter is adding in coding way?
Lloyd McKenzie (Aug 03 2017 at 16:22):
It's possible that someone might come up with a way to automatically support a custom search parameter just by consuming the SearchParameter definition, but that's not the behavior of any of the existing test servers and it's certainly not an expectation. Also, not all servers will support all of the standard search parameters. In general, there will need to be some degree of agreement within a sharing community about what search parameters and capabilities will be supported.
cfischer (Sep 14 2021 at 10:32):
Hi, i want to create a SearchParamter for the extension humanname-own-name, but i am struggling with the url and the value i need to enter there. I work on a local Server from Firely. So far my SearchParameter looks like this:
<SearchParameter>
<url value="" />
<name value="prefix" />
<status value="draft" />
<description value="SearchParameter for human-own-name"/>
<code value="humanname-own-prefix" />
<base value="Patient" />
<type value= "string" />
<expression value="Patient.name.extension.where(http://hl7.org/fhir/StructureDefinition/humanname-own-name).value" />
</SearchParameter>
Can anybody help me and explain, what url is needed?
Lloyd McKenzie (Sep 15 2021 at 04:23):
For the URL, it's a question of where the 'official' version is going to live. Are you going to host it yourself? Are you going to put it in some registry?
Also, note that your expression is flawed. It should be:
Patient.name.extension.where(url='http://hl7.org/fhir/StructureDefinition/humanname-own-name').value
Though I believe you can also use:
Patient.name.extension('http://hl7.org/fhir/StructureDefinition/humanname-own-name').value
cfischer (Sep 17 2021 at 12:26):
Thanks for the answer. I am currently writing my Bachelor thesis about Fhir and wanted to create a SearchParameter for it. I was not planning to put it in a registry, since the parameter is to be created for testing only.
Lloyd McKenzie (Sep 17 2021 at 13:36):
In theory, you could use urn:uuid:[some guid]
cfischer (Sep 17 2021 at 15:10):
I was able to successfully create the search parameter. After that, i wanted to re-index my resources for this search parameter, but i get this response: "The search parameter Patient.prefix was not found so it will not be reindexed. There might have been an issue at its import. Check for other warnings."
Lloyd McKenzie (Sep 17 2021 at 16:48):
That you'll have to follow up with the server you're using. There are specific streams here for many of the common base servers.
Last updated: Apr 12 2022 at 19:14 UTC