Skip to main content

Advanced Configuration

Custom Search Parameters

By default searching over Patients searches over the 'name' field. You can add custom search parameters to search over other fields in the Patient resource follwing the SearchParameter specification. An example for a case where search by Hospital ID is implemented is shown below.

Patient FHIR resource
{
"resourceType": "Patient",
"id": "abc",
"meta": {
"versionId": "1",
"lastUpdated": "2023-12-12T00:00:00Z"
},
"identifier": [
{
"use": "official",
"system": "hospital_id",
"value": "123"
}
],
"name": [
{
"use": "official",
"family": "Doe",
"given": [
"John"
]
}
]
}

The search parameter for Hospital ID is defined below:

SearchParameter FHIR resource
{
"resourceType": "SearchParameter",
"id": "b74f2cb3-55c8-578a-a948-145ef7ae170d",
"meta": {
"versionId": "1",
"lastUpdated": "2023-07-05T18:01:00.019+00:00",
"source": "#70f46b35-2c28-49"
},
"title": "Hospital ID",
"status": "active",
"code": "hospital_id",
"base": [ "Patient" ],
"type": "string",
"expression": "Patient.identifier.where(system='hospital_id').value",
"xpathUsage": "normal"
}

The search parameter then allows you to search for patients by their hospital ID. The example is as follows

Search for Patient by Hospital ID
GET /fhir/Patient?hospital_id=123