Stream: implementers
Topic: searching for logical references
Jens Villadsen (Dec 11 2018 at 13:26):
Whats the syntax for searching for a patient that has a 'logical reference' link where the search criteria would be the logical link. Is that possible?
Ewout Kramer (Dec 11 2018 at 13:47):
https://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_item_id=14103
Ewout Kramer (Dec 11 2018 at 13:48):
"Will clearly define that chaining, reverse chaining and include are only defined to work for references using canonical or Reference.reference. "
Ewout Kramer (Dec 11 2018 at 13:49):
"Will add a ":identifier" modifier for reference searches that allows specifying the value to match on in Reference.identifier."
Ewout Kramer (Dec 11 2018 at 13:49):
Now, we just have to find out where that text ended up in the spec...
Ewout Kramer (Dec 11 2018 at 13:49):
http://build.fhir.org/search.html#reference, search for "References are also allowed to have an identifier"
Jens Villadsen (Dec 11 2018 at 15:18):
So if my resource looks like:
{ "resourceType": "Patient", "id": "1", "identifier": [ { "system": "a", "value": "b" } ], "link": [ { "other": { "identifier": { "system": "a", "value": "c" } }, "type": "replaced-by" } ] }
... it should be possible to find it using '/Patient?link:identifier=a|c' ?
Ewout Kramer (Dec 11 2018 at 16:06):
I think that's correct.
Jens Villadsen (Dec 12 2018 at 11:26):
@James Agnew is that supposed to work out of the box in HAPI JPA? Because it doesn't ... :(
Lloyd McKenzie (Dec 12 2018 at 15:07):
the identifier qualifier is pretty new, so probably not widely supported yet.
Jens Villadsen (Dec 12 2018 at 15:08):
it never hurts to ask ;)
Flemming Jørgensen (Feb 06 2019 at 05:21):
With version 3.6.0 I have verified that you can simply post a SearchParameter with the expression Patient.link.other.identifier and voila!
Michael Christensen (Mar 19 2019 at 10:09):
With version 3.6.0 I have verified that you can simply post a SearchParameter with the expression Patient.link.other.identifier and voila!
@Flemming Jørgensen: Am trying to construct such a search against the hapi.fhir.org/baseR4 server, but am not succeeding. How exactly should your search url look to make this work?
Michael Christensen (Mar 19 2019 at 10:21):
@Jens Villadsen, did you ever find a way for doing such searches?
Flemming Jørgensen (Mar 19 2019 at 10:25):
@Michael Christensen Given a SearchParameter named patientLink the search would be like this: baseUrl/Patient?patientLink=<system>|<value>
We are currently on hapi version 3.7.0 but only using STU3
Michael Christensen (Mar 19 2019 at 11:32):
@Flemming Jørgensen: Thanks, but I can't seem to make this work in our case. For instance we have a PractitionerRole (at http://hapi.fhir.org/baseR4/PractitionerRole/12512):
{ "resourceType": "PractitionerRole", "id": "12512", "meta": { "versionId": "1", "lastUpdated": "2019-03-19T09:57:41.936+00:00" }, "identifier": [ { "system": "urn:ietf:rfc:3986", "value": "79bd3605-e5f7-49ff-b813-06befb9c036b" } ], "active": true, "period": { "start": "2017-02-01" }, "practitioner": { "type": "Practitioner", "identifier": { "system": "https://stps.dk/da/sundhedsprofessionelle-og-myndigheder/autorisationsregister/autorisationsid/", "value": "55GT7" } }, "organization": { "type": "Organization", "identifier": { "system": "urn:oid:1.2.208.176.1.1", "value": "453191000016003" } } }
And I try to search for http://hapi.fhir.org/baseR4/PractitionerRole?organization=urn:oid:1.2.208.176.1.1|453191000016003, but the resulting Bundle is empty. Have also tried http://hapi.fhir.org/baseR4/PractitionerRole?organization.identifier=urn:oid:1.2.208.176.1.1|453191000016003 with the same result. I am probably missing something obvious here, but I just can't get my head around it.
By the way, we're on FHIR R4.
Flemming Jørgensen (Mar 19 2019 at 11:53):
I would say that the correct search would be: http://hapi.fhir.org/baseR4/PractitionerRole?organization:identifier=urn:oid:1.2.208.176.1.1|453191000016003 with a ":" instead of ".". However it doesn't work. I have created a custom SearchParameter :
{ "resourceType": "SearchParameter", "url": "http://test.dk/SearchParameter/PractitionerRole", "name": "PractitionerRole organization identifier", "status": "active", "code": "organizationLink", "base": [ "PractitionerRole" ], "type": "token", "description": "Search parameter that basically fixes organization:identifier search param not working", "expression": "PractitionerRole.organization.identifier", "xpathUsage": "normal" }
and now you can find it like this: http://hapi.fhir.org/baseR4/PractitionerRole?organizationLink=urn:oid:1.2.208.176.1.1|453191000016003
This is a workaround I know
Michael Christensen (Mar 19 2019 at 12:05):
Yeah, I also did try previously with the "organization:identifier" search with no luck. However, your solution with the custom SearchParameter is very clever. I will try to use that until the ":identifier" stuff gets implemented in HAPI.
Thanks!
Jens Villadsen (Mar 19 2019 at 12:34):
@Michael Christensen SearchParameters are indeed very powerful
Last updated: Apr 12 2022 at 19:14 UTC