To begin using custom search parameters, enable the FHIR Schema validator engine in Aidbox.
Create a custom search parameter via FHIR API
Let's define a custom search parameter that allows searching Patient resources by a specific extension and its value.
Request
POST /fhir/SearchParameterContent-Type:text/yamlAccept:text/yamlresourceType:SearchParameterid:patient-occupationurl:http://example.org/fhir/SearchParameter/patient-occupationversion:'1.0.0'name:occupationstatus:activedescription:Search patients by occupationcode:occupationbase:- Patienttype:stringexpression:Patient.extension.where(url='http://example.org/fhir/StructureDefinition/occupation').value.as(string)
description:Search patients by occupationexpression:Patient.extension.where(url='http://example.org/fhir/StructureDefinition/occupation').value.as(string)name:occupationtype:stringresourceType:SearchParameterstatus:activeid:patient-occupationurl:http://example.org/fhir/SearchParameter/patient-occupationcode:occupationbase:- Patientversion:1.0.0
Test Search Parameter:
Create Patient resource with required extension:
POST /fhir/Patientcontent-type:text/yamlaccept:text/yamlresourceType:Patientid:example-patientextension:- url:http://example.org/fhir/StructureDefinition/occupationvalueString:Engineername:- family:Doegiven: - Johngender:malebirthDate:'1980-01-01'