ds_view | R Documentation |
Executes a SQL on FHIR view definition and returns the result as a Spark DataFrame.
ds_view(
ds,
resource,
select = NULL,
constants = NULL,
where = NULL,
json = NULL
)
ds |
The DataSource object containing the data to be queried. |
resource |
A string representing the type of FHIR resource that the view is based upon, e.g. 'Patient' or 'Observation'. |
select |
A list of columns and nested selects to include in the view. Each element should be a list with appropriate structure. |
constants |
An optional list of constants that can be used in FHIRPath expressions. |
where |
An optional list of FHIRPath expressions that can be used to filter the view. |
json |
An optional JSON string representing the view definition, as an alternative to providing the parameters as R objects. |
A Spark DataFrame containing the results of the view.
Pathling documentation - SQL on FHIR
## Not run:
data_source <- pc %>% pathling_read_ndjson(pathling_examples('ndjson'))
data_source %>% ds_view('Patient',
select = list(
list(
column = list(
list(path = 'id', name = 'id'),
list(path = 'gender', name = 'gender'),
list(path = "telecom.where(system='phone').value",
name = 'phone_numbers', collection = TRUE)
)
),
list(
forEach = 'name',
column = list(
list(path = 'use', name = 'name_use'),
list(path = 'family', name = 'family_name')
),
select = list(
list(
forEachOrNull = 'given',
column = list(
list(path = '$this', name = 'given_name')
)
)
)
)
),
where = list(
list(path = "gender = 'male'")
)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.