Skip to content

Latest commit

 

History

History
102 lines (77 loc) · 14.1 KB

lesson.md

File metadata and controls

102 lines (77 loc) · 14.1 KB

FHIR Search Parameters

Definition

  • A search parameter defines a named search item that can be used to search/filter on a FHIR resource.
  • A SearchParameter resource is a FHIR resource that can be used to define/describe a search parameter supported by a given server.

What does SearchParameter resource declare ?

What does SearchParameter resource declare

Default SearchParameter for Patient.gender

Default SearchParameter for Patient.gender

Default Search Parameter Registry :- http://hl7.org/fhir/searchparameter-registry.html.

SearchParameter Types

Type Definition
Number Whole number or decimal
Date/DateTime Date and time parameter formatted as:
  • yyyy-mm-ddThh:mm:ss[Z|(+|-)hh:mm]
String Simple string. Case and accent insensitive. May contain spaces.
URI Uniform Resource Identifier. Example:
Token Used for values that are part of a code system or namespace.
Includes:
  • Coding
  • CodeableConcept
  • Identifier
  • ContactPoint
  • code
Can include both a code system and code value or just a code value.
Examples.
Quantity Used for quantity values that include a numeric value and possibly a unit of measure code.The unit of measure code will include a code value and optionally a code system.
Examples:
Reference Used for values that represent references between resources. For example an Observation resource will normally have a subject element which references a Patient resource for the patient that then Observation relates to.
Can include :
  • ID for a local reference
  • Resource type + ID for a local reference
  • URL for an absolute reference.
Examples:
Composite Used in cases where a single search definition requires two or more values. SearchParameter values appear in the search request as a list of single values joined with a $ character.
Examples: In the above example, the SearchParameter consists of two values, joined by $:
_filter Used to specify a query expression that can be used in a Search operation.
Example:
  • given eq "peter" and birthdate ge 2014-10-10
near Used only with Location resource. Specifies a set of coordinates expressed as coordinates expressed as [latitude]|[longitude]|[distance]|[units]

SearchParameter Modifiers

  • Modifiers may be specified as a suffix to the SearchParameter values and are separated by a colon.
    • Example: gender:missing=true
Parameter Type Operator Description
All Parameter types :missing
  • True or false
  • Resources which are missing the parameter value.
String Parameter :exact Resources which have an exact match for the parameter, including case and character.
Token Parameter :text Matches on text portion of CodeableConcept or Coding element.
Token Parameter :not Match resources that do not have the code value.
Token Parameter :above Match where coding subsumes the search code parameter.
Token Parameter :below Match where coding is subsumed by the search code parameter.
Token Parameter :in Match where coding is in a value set specified by the parameter.
Token Parameter :not-in Match where coding is not in the value set specified by the parameter
Token Parameter :of-type Match where identifier element is of specified type.
Reference Parameter :[type] Specify the name of the resource type for reference
Reference Parameter :identifier Search by identifier rather than literal reference.
Reference Parameter :above Search for references in hierarchy
Reference Parameter :below Search for references in hierarchy
URI Parameter :above Partial matching (e.g. URLs that include a version number)
URI Parameter :below Partial matching

SearchParameter Prefixes

  • Prefixes can be used to vary the type of matching done for ordered parameter types such as number, date and quantity:
    • GET [base]/Observation?_lastUpdated=gt2010-10-01
Operator Description
eq Value in resource matches or is contained in value for parameter
gt Value in resource is greater than value in parameter.
lt Value in resource is less than value parameter.
ge Value in resource is greater than or equal to value in parameter.
le Value in resource is less than or equal to value in parameter.
sa Value in the resource starts after value in parameter.
eb Value in the resource ends before value in parameter.
ap Value in the resource is approximately the same as that in the parameter.

SearchParameter Resource

SearchParameter Resource

Required Elements

Element Name Type Description
url uri Canonical identifier for the resource
name string Computer friendly name for the resource
status code Status of the resource
description markdown Natural language description for the search parameter
code code Code used to reference the search parameter in a search request
base code Resource type(s) that this search parameter applies to
type code The data type for the search parameter value

Optional Elements

Element Name Type Description
expression string FHIRPath expression used to extract an element from a resource.
  • Example: Condition.subject
xpath string XPath expression used to extract an element from a resource.
  • f:Condition/f:subject
multipleOr boolean Whether to allow multiple values (or)
multipleAnd boolean Whether to allow multiple values (and)
comparator code A list of one or more comparators that can be supported by the SearchParameter:
eq | ne | gt | lt | ge | le | sa | eb | ap
modifier code A list of one or more modifiers that can be supported by the SearchParameter:
missing | exact | contains | not | text | in | not-in | below | above | type | identifier | ofType
chain string Names of one or more SearchParameters that will be chained together to form the current SearchParameter.
component BackboneElement Used for composite SearchParameters. Defines each of the components that can be included in the SearchParameter type. Each component includes:
  • definition - a SearchParameter reference which defines this component works.
  • expression - a subexpression that defines how to retrieve the SearchParameter value for the definition from the parent SearchParameter’s value.