FHIR Chat · Custom Search Across Resource Types · implementers

Stream: implementers

Topic: Custom Search Across Resource Types


view this post on Zulip Andrew Broadbent (Aug 10 2017 at 16:59):

Hey all, is there a way to author a single search parameter which performs the same search on different resource types?

E.g. I have an extension which references an organisation, where the organisation acts as the custodians for the data. The data can in theory be any resource type which can have extensions added to them.

It looks like you can set the 'base' property of SearchParameter to be multiple things. Is the best way to just list all resource types? If so, what would the search expression look like? All the examples I've seen so far are scoped to a single resource type, so the expression usually looks like this: Basic.extension('url').

The documentation has a section on it under 'SearchParameter on Extensions':
https://www.hl7.org/fhir/searchparameter.html#srch

Where it states that multiple resource searches should use the base 'DomainResource', and that the xpath should be set to the extension url. However it doesn't say what you're supposed to do with the expression. If you omit the expression (in HAPI at least), the server returns an error.

view this post on Zulip Grahame Grieve (Aug 10 2017 at 21:25):

use a FHIRPath expression. Here's an example:

view this post on Zulip Grahame Grieve (Aug 10 2017 at 21:27):

FamilyMemberHistory.condition.code | DeviceRequest.code.as(CodeableConcept) | AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Procedure.code | List.code | ProcedureRequest.code | Observation.code | DiagnosticReport.code | Condition.code

view this post on Zulip Grahame Grieve (Aug 10 2017 at 21:27):

see http://hl7.org/fhir/searchparameter-registry.html

view this post on Zulip Andrew Broadbent (Aug 11 2017 at 09:42):

@Grahame Grieve Thanks for your response.

Sorry but I'm having a little trouble understanding your example, do you mean that string would be the value of the 'expression' node? I've just tried uploading the following, but I get an error that 'All paths in a single SearchParameter must match the same resource type'.

<SearchParameter xmlns="http://hl7.org/fhir">
<name value="Annotation"/>
<status value="active"/>
<code value="annotation"/>
<base value="DomainResource"/>
<type value="reference"/>
<expression value="Basic.extension('http://www.elabdev.org/StructureDefinition/AnnotationRef')|Patient.extension('http://www.elabdev.org/StructureDefinition/AnnotationRef')"/>
<xpathUsage value="normal"/>
</SearchParameter>

view this post on Zulip Grahame Grieve (Aug 11 2017 at 11:33):

@James Agnew - this looks like an issue in HAPI one way or another

view this post on Zulip James Agnew (Aug 11 2017 at 12:23):

Agreed.

@Andrew Broadbent can you file a bug in the HAPI FHIR issue tracker about this?

view this post on Zulip Andrew Broadbent (Aug 11 2017 at 12:23):

@James Agnew Sure no problem.


Last updated: Apr 12 2022 at 19:14 UTC