If you have defined first-class extension, you have to use Aidbox format for the SearchParameter expression. If you use FHIR format, you don't need to create Attribute and the expression path should be in FHIR format.
PUT /Attribute/ServiceRequest.preconditionresourceType:Attributedescription: "The condition or state of the patient, prior or during the diagnostic procedure or test, for example, fasting, at-rest, or post-operative. This captures circumstances that may influence the measured value and have bearing on the interpretation of the result."
resource: {id:ServiceRequest,resourceType:Entity}path: [precondition]id:ServiceRequest.preconditiontype: {id:CodeableConcept,resourceType:Entity}isCollection:trueextensionUrl:"http://hl7.org/fhir/StructureDefinition/servicerequest-precondition"
PUT /SearchParameter/ServiceRequest.preconditionname:preconditiontype:tokenresource: {id:ServiceRequest,resourceType:Entity}expression: [[precondition,coding]]
PUT /SearchParameter/ServiceRequest.preconditionname:preconditiontype:tokenresource: {id:ServiceRequest,resourceType:Entity}expression:- [extension, {url:'http://hl7.org/fhir/StructureDefinition/servicerequest-precondition'},value,CodeableConcept,coding,code]
If you use Zen IG then first-class extensions are generated from zen-schemas. You have to use Aidbox format for the custom SearchParameter expression (check tab #3 in the example above).
Custom SearchParameter with Zen
Most of the Search Parameters from IG work with Zen by default, also you can make a new one.
Assuming you already know how to use configuration projects, let's learn how to create zen search parameter by example:
{ns mainimport #{aidbox.search-parameter.v1 aidbox aidbox.repository.v1} zen-config {...} my-parameter {:zen/tags #{aidbox.search-parameter.v1/search-parameter}:name"brthdt":type:date:resource {:resourceType"Entity":id"Patient"}:expression [["birthDate"]]} patient-repository {:zen/tags #{aidbox.repository.v1/repository}:resourceType"Patient":extra-parameter-sources:all; allow to use SearchParameters from outside of repo:search-parameters #{my-parameter}} repositories {:zen/tags #{aidbox/service}:engine aidbox.repository.v1/engine:repositories #{patient-repository}:load-defaulttrue} box {:zen/tags #{aidbox/system}:config zen-config:services {:repositories repositories}}}
First we import aidbox.search-parameter.v1 and aidbox.repository.v1 namespaces from edn files. These are zen-namespaces we need to make an aidbox/service which name is repositories.
This service is our concept of wrapping resourceType-specific entities, as search parameters, indexes, and more, into one entity, called repository. We will add indexes for search parameters soon.
We have one repository for Patient resourceType: patient-repository. It contains :search-parameters key with new SearchParameter my-parameter.