searchParams: searchParams

Description Usage Arguments Details Examples

Description

An alternative way to specify a query is by creating a searchParams object and pass this to the fhirClient's searchByQuery. The searchParams class has a set of fluent calls to allow you to easily construct more complex queries. Based on the official HL7 FHIR .NET API.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
query <- searchParams$new()

query$select(elements)
query$where(criteria)
query$include(path)
query$orderBy(paramName, sortOrder = "asc")
query$limitTo(count)
query$countOnly()
query$summaryOnly()
query$textOnly()
query$dataOnly()

Arguments

query

A searchParams object that contains all specified search criteria.

elements

Elements defined at the root level in the Resource.

criteria

The search parameters to filter the Resources on. Each given string is a combined key/value pair (separated by '=').

path

Paths to include in the search.

paramName

Name of the parameter to order by.

sortOrder

Direction of the order. Can be asc or desc (ascending and descending).

count

The number of returned Resources per page.

Details

$new() Creates a new searchParams object.

$select() Specify the elements to be returned as part of a Resource.

$where() Specify on which parameters to filter.

$include() Specify the paths to include.

$orderBy() Specify the order to return the results.

$limitTo() Specify how many Resources should be returned in a single page of a Bundle.

$countOnly() Specifiy to just return a count of the matching Resources, without returning the actual matches.

$summaryOnly() Specify to return only those elements marked as "summary" in the base definition of the Resource(s).

$textOnly() Specify to return only the "text" element, the 'id' element, the 'meta' element, and only top-level mandatory elements.

$dataOnly() Specify to remove the text element.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
# Setting up a fhirClient
client <- fhirClient$new("http://vonk.furore.com")

# Creating a new searchParams object
query <- searchParams$new()
query$select(c("name", "birthDate"))$where("given:exact=Peter")$orderBy("family")


peters <- client$searchByQuery(query, "Patient")
# equivalent:
# client$search("Patient", c("_elements=name,birthDate","given:exact=Peter", "_sort=family"))

while(!is.null(bundle)){
   # Do something useful
   peters <- client$continue(peters)
}

## End(Not run)

RonFHIR documentation built on Jan. 11, 2020, 9:36 a.m.