3
votes

How can I search for extension values in FHIR? Is SearchParameter registration necessary for searching for the extension? Any help with an example would be great. I have been trying with my own FHIR server (https://github.com/Microsoft/fhir-server) using mothersMaidenName after SearchParameter registration but it gives all the Patients from the server.

Update

I have this JSON set as Extension for Patient Resource.

{
  "extension": [
    {
      "url": "http://hl7.org/fhir/SearchParameter/patient-extensions-Patient-mothersMaidenName",
      "valueString": "trial"
    }
  ]
}

The SearchParameters registration is done like this (these are from https://www.hl7.org/fhir):

{
  "resourceType": "SearchParameter",
  "id": "e3f10e54-f558-49bb-8732-faee3a4dda8d",
  "url": "http://hl7.org/fhir/SearchParameter/patient-extensions-Patient-mothersMaidenName",
  "version": "3.6.0",
  "name": "mothersMaidenName",
  "status": "draft",
  "experimental": true,
  "code": "mothersMaidenName",
  "base": [
    "Patient"
  ],
  "type": "string",
  "description": "Search based on patient's mother's maiden name",
  "expression": "Patient.extension(http://hl7.org/fhir/SearchParameter/patient-extensions-Patient-mothersMaidenName)",
  "xpathUsage": "normal"
}
3
Hi! Where did you find that SearchParameter definition? It contains an error, so if you send us the link, I can report it to have it fixed. - Mirjam Baltus

3 Answers

1
votes

Two steps are required: first, you need to define a custom SearchParameter that searchs on the element you wish in the way you wish. Second, all relevant servers must be manually changed (i.e. have code written) to support the new search parameter.

0
votes

You still miss the second step that Lloyd mentions: the server should be made aware of the SearchParameter and needs to be implemented to support it. Reading through the MS server documentation, they use a file with all SearchParameters in it. This is read by the server on startup, so the server can support them. So you will need to find it (searchparameters.json) and add your SearchParameter to it, then restart and see if it works.

I'm not sure how to rebuild the search index, so it might only work on newly uploaded resources unless you find out how it's done.

0
votes

We currently don't support search on extensions in our FHIR server. It is on our roadmap. https://github.com/Microsoft/fhir-server/blob/master/docs/Roadmap.md#extensions

Matjaz