Vikash Kumar
Vikash Kumar

Reputation: 558

FHIR search by extension

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"
}

Upvotes: 4

Views: 3984

Answers (3)

Matjaz Ladava
Matjaz Ladava

Reputation: 16

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

Upvotes: 0

Mirjam Baltus
Mirjam Baltus

Reputation: 2299

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.

Upvotes: 0

Lloyd McKenzie
Lloyd McKenzie

Reputation: 6793

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.

Upvotes: 1

Related Questions