Search
Search API for FHIR resources
Aidbox provides a Search API for all stored resources. Aidbox Search API is a superset of the FHIR Search API.
There are two versions of API, which differ by the resources format:
    search by /[resourceType] returns results in Aidbox Format​
    search by /fhir/[resourceType] returns data in FHIR Format
All data is stored and searched in Aidbox Format and converted on the fly to FHIR on FHIR endpoints!
A base search request is composed of the list of pairs param = value:
FHIR format
Aidbox format
1
GET [base]/fhir/[resourceType]?param=value&param=value&...
Copied!
1
GET [base]/[resourceType]?param=value&param=value&...
Copied!
Where param can be one of:
Simple search by patient name:
FHIR format
Aidbox format
1
GET /fhir/Patient?name=Max&_elements=id, birthDAte
Copied!
1
GET /Patient?name=Max&_elements=id, birthDAte
Copied!

Special Parameters

Parameter
Type
Description
​_id​
FHIR
Search and sort by resource id
​_lastUpdated​
FHIR
Search and sort by resource last modification date
​_text​
FHIR
Full text search by resource narrative
​_content​
FHIR
Full text search by resource content
​_ilike​
​
ILIKE search by resource content
​_elements​
FHIR+
Include or exclude specific resource elements
​_summary​
FHIR
Include only summary elements
​_list​
FHIR
Search resources included into specific List
​_sort​
FHIR
Sort search results
​_total​
FHIR
Turn on/off total count
​_include​
FHIR
Include referenced resources into result
​_revinclude​
FHIR
Include into result resources, which reference searched resources
​_explain​
​
See query execution plan
​_result​
​
Change result format

Search Parameters

Search defined in terms of "search parameters". SearchParameter is a meta-resource, which describes which part of the resource it is and how you can make it searchable.
Search parameter can be one of the following types:
Type
Description
​number​
Search parameter SHALL be a number (a whole number, or a decimal).
​date​
Search parameter is on a date/time. The date format is the standard XML format, though other formats may be supported.
​string​
Search parameter is a simple string, like a name part. Search is case-insensitive and accent-insensitive. May match just the start of a string. String parameters may contain spaces.
​token​
Search parameter on a coded element or identifier. May be used to search through the text, displayname, code and code/codesystem (for codes) and label, system and key (for identifier). Its value is either a string or a pair of namespace and value, separated by a "|", depending on the modifier used.
​reference​
A reference to another resource.
​composite​
A composite search parameter that combines a search on two values together.
​quantity​
A search parameter that searches on a quantity.
​uri​
A search parameter that searches on a URI (RFC 3986).
Depending on the value type, different modifiers can be applied.

Common

    :missing
    :text β€” case insensitive, partial match of text & data associated with search parameter.
FHIR format
Aidbox format
1
GET /fhir/Entity?description:missing=true
2
// For gender:missing=true,
3
// server will return all resources that
4
// don't have a value for the gender parameter.
Copied!
1
GET /Entity?description:missing=true
2
// For gender:missing=true,
3
// server will return all resources that
4
// don't have a value for the gender parameter.
Copied!
FHIR format
Aidbox format
1
// Search for any patient with [email protected] email
2
GET /fhir/Patient?email:text=[email protected].com
3
​
4
// Search for any patient with gmail or icloud email
5
GET /fhir/Patient?email:text=GMail.com,ICloud.com
6
​
7
// Search for any patient which have "fhir" in any of their contact info
8
GET /fhir/Patient?telecom:text=fhir
Copied!
1
// Search for any patient with [email protected] email
2
GET /Patient?email:text=[email protected].com
3
​
4
// Search for any patient with gmail or icloud email
5
GET /Patient?email:text=GMail.com,ICloud.com
6
​
7
// Search for any patient which have "fhir" in any of their contact info
8
GET /Patient?telecom:text=fhir
Copied!

Strings

    :exact β€” no partial matches, case sensitive;
    :contains β€” case insensitive, partial match at start or end.
Default behavior is case insensitive, partial match at start.
FHIR format
Aidbox format
1
GET /fhir/Patient?name:exact=Alex
Copied!
1
GET /Patient?name:exact=Alex
Copied!

Token

    :not β€” reverses the code matching: returns all resources that do not have a matching item.
    :i β€” case insensitive, exact match of text associated with token or token itself.
    :in β€” the search parameter is a URI (relative or absolute) that identifies a value set, and the search parameter tests whether the coding is in the specified value set.
FHIR format
Aidbox format
1
//Search for any patient with a gender that does not have the code "male"
2
//Note that for :not, the search does not return any resources that have a gen
3
GET /fhir/Patient?gender:not=male
Copied!
1
//Search for any patient with a gender that does not have the code "male"
2
//Note that for :not, the search does not return any resources that have a gen
3
GET /Patient?gender:not=male
Copied!
FHIR format
Aidbox format
1
// Search for patient with email which is [email protected]
2
GET /fhir/Patient?email:i=[email protected].baz
3
// Note: this search won't find patient with emails like:
Copied!
1
// Search for patient with email which is [email protected]
2
GET /Patient?email:i=[email protected].baz
3
// Note: this search won't find patient with emails like:
Copied!
FHIR format
Aidbox format
1
//Search for any condition that is in the institutions list of cardiac conditions
2
//Note: you must have Concept with valueset defined
3
​
4
GET /fhir/Condition?code:in=/ValueSet/cardiac-conditions
Copied!
1
//Search for any condition that is in the institutions list of cardiac conditions
2
//Note: you must have Concept with valueset defined
3
​
4
GET /Condition?code:in=/ValueSet/cardiac-conditions
Copied!

Reference

Reference describes the relationship between resources. Following options are available for filtering by reference:
Π‘oded element or identifier
FHIR format
Aidbox format
1
GET /fhir/Patient?gender=female
Copied!
1
GET /Patient?gender=female
Copied!
1
[parameter]=[id]
Copied!
1
[parameter]=[type]/[id]
Copied!
For example, let's find all encounters related to a specified patient:
FHIR format
Aidbox format
1
GET /fhir/Encounter?subject=patientid
Copied!
1
GET /Encounter?subject=patientid
Copied!
FHIR format
Aidbox format
1
GET /fhir/Encounter?subject=Patient/patientid
Copied!
1
GET /Encounter?subject=Patient/patientid
Copied!

Prefixes

For Numbers, Dates, and Quantities (will be supported), we can use the following conditionals in a search:
    eq - equal (default)
    ne - non-equal
    lt - less than
    le - less or equal
    gt - greater than
    ge - greater or equal
FHIR format
Aidbox format
1
GET /fhir/Patient?birthdate=gt1986-04-28
Copied!
1
GET /Patient?birthdate=gt1986-04-28
Copied!
Want to know more about Aidbox, FHIR, and search? Join our community chat .
Last modified 6mo ago