Skip to main content

ViewDefinition

ResourceSQL on FHIR

A ViewDefinition represents a tabular projection of a FHIR resource, where the columns and inclusion criteria are defined by FHIRPath expressions.

Tested supportFull test results →
Backends
PostgreSQLElasticsearch
Interactions
CreateReadUpdatePatchDelete
Search
0 of 0 parameters tested

Structure​

ElementCard.TypeDescription
resourceRequired
1..1codeFHIR resource for the ViewDefinitionBinding (required): resource-types
profile
0..*canonical(StructureDefinition)FHIR profiles that this view definition was intended to be executed against
fhirVersion
0..*codeFHIR version(s) of the resource for the ViewDefinitionBinding (required): FHIR-version
constant
0..*BackboneElementConstant that can be used in FHIRPath expressions
nameRequired
1..1stringName of constant (referred to in FHIRPath as %[name])
value[x]Required
1..1base64Binary | boolean | canonical | code | date | dateTime | decimal | id | instant | integer | oid | string | positiveInt | time | unsignedInt | uri | url | uuidValue of constant
selectRequired
1..*BackboneElementA collection of columns and nested selects to include in the view.
column
0..*BackboneElementA column to be produced in the resulting table.
pathRequired
1..1stringFHIRPath expression that creates a column and defines its content
nameRequired
1..1stringColumn name produced in the output
description
0..1markdownDescription of the column
collection
0..1booleanIndicates whether the column may have multiple values.
type
0..1uriA FHIR StructureDefinition URI for the column's type.
tag
0..*BackboneElementAdditional metadata describing the column
nameRequired
1..1stringName of tag
valueRequired
1..1stringValue of tag
select
0..*Same as ViewDefinition.selectNested select relative to a parent expression.
forEach
0..1stringA FHIRPath expression to retrieve the parent element(s) used in the containing select. The default is effectively `$this`.
forEachOrNull
0..1stringSame as forEach, but will produce a row with null values if the collection is empty.
repeat
0..*stringFHIRPath expressions to recursively select from.
unionAll
0..*Same as ViewDefinition.selectCreates a union of all rows in the given selection structures.
where
0..*BackboneElementA series of zero or more FHIRPath constraints to filter resources for the view.
pathRequired
1..1stringA FHIRPath expression defining a filter condition
description
0..1stringA human-readable description of the above where constraint.

Σ in _summary results · ?! modifier element · 1.. required · inherited elements in grey

Search parameters​

Query with GET [base]/ViewDefinition?[parameter]=[value]. Type decides which modifiers and prefixes apply, see search features.

ViewDefinition defines no search parameters of its own; the common parameters below apply.

PG: PostgreSQL, ES: Elasticsearch. passes its TestScript checks, fails, not tested yet.

Common parameters on every resource (8)
_haste-health-authorreference

The author of the resource

_idtoken

Logical id of this artifact

_lastUpdateddate

When the resource version last changed

_profileuri

Profiles this resource claims to conform to

_securitytoken

Security Labels applied to this resource

_sourceuri

Identifies where the resource comes from

_tagtoken

Tags applied to this resource

_typetoken

Derived from the R4B Definition

Operations​

Invoke with POST [base]/ViewDefinition/$[name] on the type, or POST [base]/ViewDefinition/[id]/$[name] on one resource, sending a Parameters resource as the body. See invoke-type and invoke-instance.

$viewdefinition-run

SystemTypeInstance

ViewDefinition Run

Execute a view definition against supplied or server data.

POST [base]/$viewdefinition-runPOST [base]/ViewDefinition/$viewdefinition-runPOST [base]/ViewDefinition/[id]/$viewdefinition-run
Parameters: 10 in, 1 out
NameCard.TypeDescription
In
_format0..1code

Output format for the result (for example json, ndjson, csv, parquet). Optional; if omitted, the server returns ndjson by default.

Binding: extensible OutputFormatCodes
header0..1boolean

Include CSV headers (default true). Applies only when csv output is requested.

viewReference0..1Reference

Reference to a ViewDefinition stored on the server.

viewResource0..1ViewDefinition(ViewDefinition)

Inline ViewDefinition resource to execute.

patient0..1Reference

Restrict execution to the specified patient.

group0..*Reference

Restrict execution to members of the given group(s).

source0..1string

External data source to use (for example a URI or bucket name).

resource0..*Resource

FHIR resources to transform instead of using server data.

_limit0..1integer

Maximum number of rows to return.

_since0..1instant

Include only resources modified after this instant.

Out
return1..1Binary

Transformed data encoded in the requested output format.