R6 Ballot (2nd Draft)

Publish-box (todo)

Searchparameter.shex

FHIR Infrastructure Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: No defined compartments

Raw ShEx

ShEx statement for searchparameter

PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

IMPORT <uri.shex>
IMPORT <code.shex>
IMPORT <string.shex>
IMPORT <Coding.shex>
IMPORT <boolean.shex>
IMPORT <dateTime.shex>
IMPORT <markdown.shex>
IMPORT <canonical.shex>
IMPORT <Identifier.shex>
IMPORT <UsageContext.shex>
IMPORT <ContactDetail.shex>
IMPORT <DomainResource.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>


start=@<SearchParameter> AND {fhir:nodeRole [fhir:treeRoot]}

# Search parameter for a resource
<SearchParameter> EXTENDS @<DomainResource> CLOSED {   

    a [fhir:SearchParameter]?;
    fhir:nodeRole [fhir:treeRoot]?;

    fhir:url @<uri>;                        # Canonical identifier for this 
                                            # search parameter, represented as a 
                                            # URI (globally unique) 
    fhir:identifier @<OneOrMore_Identifier>?;  # Additional identifier for the 
                                            # search parameter (business 
                                            # identifier) 
    fhir:version @<string>?;                # Business version of the search 
                                            # parameter 
    fhir:versionAlgorithm @<string>  OR 
    			@<Coding>  ?;  # How to compare versions
    fhir:name @<string>;                    # Name for this search parameter 
                                            # (computer friendly) 
    fhir:title @<string>?;                  # Name for this search parameter 
                                            # (human friendly) 
    fhir:derivedFrom @<canonical>?;         # Original definition for the search 
                                            # parameter 
    fhir:status @<code> AND
    	{fhir:v @fhirvs:publication-status};  # draft | active | retired | unknown
    fhir:experimental @<boolean>?;          # For testing purposes, not real 
                                            # usage 
    fhir:date @<dateTime>?;                 # Date last changed
    fhir:publisher @<string>?;              # Name of the publisher/steward 
                                            # (organization or individual) 
    fhir:contact @<OneOrMore_ContactDetail>?;  # Contact details for the publisher
    fhir:description @<markdown>;           # Natural language description of 
                                            # the search parameter 
    fhir:useContext @<OneOrMore_UsageContext>?;  # The context that the content is 
                                            # intended to support 
    fhir:jurisdiction @<OneOrMore_CodeableConcept>?;  # Intended jurisdiction for search 
                                            # parameter (if applicable) 
    fhir:purpose @<markdown>?;              # Why this search parameter is 
                                            # defined 
    fhir:copyright @<markdown>?;            # Use and/or publishing restrictions
    fhir:copyrightLabel @<string>?;         # Copyright holder and year(s)
    fhir:code @<code>;                      # Recommended name for parameter in 
                                            # search url 
    fhir:base @<OneOrMore_code> AND
    	{fhir:v @fhirvs:version-independent-all-resource-types};  # The resource type(s) this search 
                                            # parameter applies to 
    fhir:type @<code> AND
    	{fhir:v @fhirvs:search-param-type};  # number | date | string | token | 
                                            # reference | composite | quantity | 
                                            # uri | special 
    fhir:expression @<string>?;             # FHIRPath expression that extracts 
                                            # the values 
    fhir:processingMode @<code> AND
    	{fhir:v @fhirvs:search-processingmode}?;  # normal | phonetic | other
    fhir:constraint @<string>?;             # FHIRPath expression that 
                                            # constraints the usage of this 
                                            # SearchParamete 
    fhir:target @<OneOrMore_code> AND
    	{fhir:v @fhirvs:version-independent-all-resource-types}?;  # Types of resource (if a resource 
                                            # reference) 
    fhir:multipleOr @<boolean>?;            # Allow multiple values per 
                                            # parameter (or) 
    fhir:multipleAnd @<boolean>?;           # Allow multiple parameters (and)
    fhir:comparator @<OneOrMore_code> AND
    	{fhir:v @fhirvs:search-comparator}?;  # eq | ne | gt | lt | ge | le | sa | 
                                            # eb | ap 
    fhir:modifier @<OneOrMore_code> AND
    	{fhir:v @fhirvs:search-modifier-code}?;  # missing | exact | contains | not | 
                                            # text | in | not-in | below | above 
                                            # | type | identifier | of-type | 
                                            # code-text | text-advanced | 
                                            # iterate 
    fhir:chain @<OneOrMore_string>?;        # Chained names supported
    fhir:component @<OneOrMore_SearchParameter.component>?;  # For Composite resources to define 
                                            # the parts 
}  

# For Composite resources to define the parts
<SearchParameter.component> EXTENDS @<BackboneElement> CLOSED {   
    fhir:definition @<canonical>;           # Defines how the part works
    fhir:expression @<string>;              # Subexpression relative to main 
                                            # expression 
}  

#---------------------- Cardinality Types (OneOrMore) -------------------

<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}

<OneOrMore_ContactDetail> CLOSED {
    rdf:first @<ContactDetail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ContactDetail> 
}

<OneOrMore_UsageContext> CLOSED {
    rdf:first @<UsageContext>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_UsageContext> 
}

<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}

<OneOrMore_code> CLOSED {
    rdf:first @<code>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_code> 
}

<OneOrMore_string> CLOSED {
    rdf:first @<string>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_string> 
}

<OneOrMore_SearchParameter.component> CLOSED {
    rdf:first @<SearchParameter.component>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SearchParameter.component> 
}

#---------------------- Value Sets ------------------------

# The lifecycle status of an artifact.
fhirvs:publication-status ["draft" "active" "retired" "unknown"]

# What Search Comparator Codes are supported in search.
fhirvs:search-comparator ["eq" "ne" "gt" "lt" "ge" "le" "sa" "eb" "ap"]

# A supported modifier for a search parameter.
fhirvs:search-modifier-code ["missing" "exact" "contains" "not" "text" "in" "not-in" "below" "above" "type" "identifier" "of-type" "code-text" "text-advanced" "iterate"]

# Data types allowed to be used for search parameters.
fhirvs:search-param-type ["number" "date" "string" "token" "reference" "composite" "quantity" "uri" "special"]

# How a search parameter relates to the set of elements returned by evaluating its expression query.
fhirvs:search-processingmode ["normal" "phonetic" "other"]

# Current and past FHIR resource types (deleted or renamed), including abstract types
fhirvs:version-independent-all-resource-types ["Account" "ActivityDefinition" "ActorDefinition" "AdministrableProductDefinition" "AdverseEvent" "AllergyIntolerance" "Appointment" "AppointmentResponse" "ArtifactAssessment" "AuditEvent" "Basic" "Binary" "BiologicallyDerivedProduct" "BiologicallyDerivedProductDispense" "BodyStructure" "Bundle" "CanonicalResource" "CapabilityStatement" "CarePlan" "CareTeam" "ChargeItem" "ChargeItemDefinition" "Citation" "Claim" "ClaimResponse" "ClinicalImpression" "ClinicalUseDefinition" "CodeSystem" "Communication" "CommunicationRequest" "CompartmentDefinition" "Composition" "ConceptMap" "Condition" "ConditionDefinition" "Consent" "Contract" "Coverage" "CoverageEligibilityRequest" "CoverageEligibilityResponse" "DetectedIssue" "Device" "DeviceAlert" "DeviceAssociation" "DeviceDefinition" "DeviceDispense" "DeviceMetric" "DeviceRequest" "DeviceUsage" "DiagnosticReport" "DocumentReference" "DomainResource" "Encounter" "EncounterHistory" "Endpoint" "EnrollmentRequest" "EnrollmentResponse" "EpisodeOfCare" "EventDefinition" "Evidence" "EvidenceReport" "EvidenceVariable" "ExampleScenario" "ExplanationOfBenefit" "FamilyMemberHistory" "Flag" "FormularyItem" "GenomicStudy" "Goal" "GraphDefinition" "Group" "GuidanceResponse" "HealthcareService" "ImagingSelection" "ImagingStudy" "Immunization" "ImmunizationEvaluation" "ImmunizationRecommendation" "ImplementationGuide" "Ingredient" "InsurancePlan" "InsuranceProduct" "InventoryItem" "InventoryReport" "Invoice" "Library" "Linkage" "List" "Location" "ManufacturedItemDefinition" "Measure" "MeasureReport" "Medication" "MedicationAdministration" "MedicationDispense" "MedicationKnowledge" "MedicationRequest" "MedicationStatement" "MedicinalProductDefinition" "MessageDefinition" "MessageHeader" "MetadataResource" "MolecularDefinition" "MolecularSequence" "NamingSystem" "NutritionIntake" "NutritionOrder" "NutritionProduct" "Observation" "ObservationDefinition" "OperationDefinition" "OperationOutcome" "Organization" "OrganizationAffiliation" "PackagedProductDefinition" "Parameters" "Patient" "PaymentNotice" "PaymentReconciliation" "Permission" "Person" "PlanDefinition" "Practitioner" "PractitionerRole" "Procedure" "Provenance" "Questionnaire" "QuestionnaireResponse" "RegulatedAuthorization" "RelatedPerson" "RequestOrchestration" "Requirements" "ResearchStudy" "ResearchSubject" "Resource" "RiskAssessment" "Schedule" "SearchParameter" "ServiceRequest" "Slot" "Specimen" "SpecimenDefinition" "StructureDefinition" "StructureMap" "Subscription" "SubscriptionStatus" "SubscriptionTopic" "Substance" "SubstanceDefinition" "SubstanceNucleicAcid" "SubstancePolymer" "SubstanceProtein" "SubstanceReferenceInformation" "SubstanceSourceMaterial" "SupplyDelivery" "SupplyRequest" "Task" "TerminologyCapabilities" "TestPlan" "TestReport" "TestScript" "Transport" "ValueSet" "VerificationResult" "VisionPrescription" "BodySite" "CatalogEntry" "Conformance" "DataElement" "DeviceComponent" "DeviceUseRequest" "DeviceUseStatement" "DiagnosticOrder" "DocumentManifest" "EffectEvidenceSynthesis" "EligibilityRequest" "EligibilityResponse" "ExpansionProfile" "ImagingManifest" "ImagingObjectSelection" "Media" "MedicationOrder" "MedicationUsage" "MedicinalProduct" "MedicinalProductAuthorization" "MedicinalProductContraindication" "MedicinalProductIndication" "MedicinalProductIngredient" "MedicinalProductInteraction" "MedicinalProductManufactured" "MedicinalProductPackaged" "MedicinalProductPharmaceutical" "MedicinalProductUndesirableEffect" "Order" "OrderResponse" "ProcedureRequest" "ProcessRequest" "ProcessResponse" "ReferralRequest" "RequestGroup" "ResearchDefinition" "ResearchElementDefinition" "RiskEvidenceSynthesis" "Sequence" "ServiceDefinition" "SubstanceSpecification" "InsuranceProduct"]


Usage note: every effort has been made to ensure that the ShEx files are correct and useful, but they are not a normative part of the specification.