SQL on FHIR
2.1.0-pre - release
SQL on FHIR - Local Development build (v2.1.0-pre) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions
Official URL: https://sql-on-fhir.org/ig/StructureDefinition/ViewDefinition | Version: 2.1.0-pre | |||
Draft as of 2025-01-16 | Computable Name: ViewDefinition |
A ViewDefinition represents a tabular projection of a FHIR resource, where the columns and inclusion criteria are defined by FHIRPath expressions.
It is the central piece of the View Layer and represents a tabular projection of FHIR resources with the columns and filtering criteria defined by FHIRPath expressions. The logical model is described below.
Each ViewDefinition instance is tied to a single FHIR resource type, such as Patient or Observation. It will then create zero or more rows for each resource instance. Examples include simple tabular views of patients, unrolling patient addresses into an address table, views of certain types of observations, and so on.
Each ViewDefinition instance has a select that specifies the content and names for the columns in the view. The content for each column is defined with FHIRPath expressions that return specific data elements from the FHIR resources.
The ViewDefinition may include one or more where clauses that may be used to further limit, or filter, the resources included in the view. For instance, users may have different views for blood pressure observations or other observation types.
The ViewDefinition may include one or more constants, which are simply values that can be reused in FHIRPath expressions.
A View Runner implementation can execute a ViewDefinition and return the results as a table that can be used for further processing using the user's chosen tech stack. See System Layers for details.
ViewDefinitions may be profiled to meet specific needs. For instance, the Shareable View Definition profile adds constraints for ViewDefinitions intended to be shared between systems. Implementers may create their own ViewDefinition profiles for further specialized needs.
Usage:
Description of Profiles, Differentials, Snapshots and how the different presentations work.
Name | Flags | Card. | Type | Description & Constraints | ||||
---|---|---|---|---|---|---|---|---|
ViewDefinition | C | 1..1 | CanonicalResource | Elements defined in Ancestors:id, meta, implicitRules, language, text, contained, extension, modifierExtension, url, identifier, version, versionAlgorithm[x], name, title, status, experimental, date, publisher, contact, description, useContext, jurisdiction, purpose, copyright, copyrightLabel View Definition cnl-0: Name should be usable as an identifier for the module by machine processing applications such as code generation dom-2: If the resource is contained in another resource, it SHALL NOT contain nested Resources dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated dom-5: If a resource is contained in another resource, it SHALL NOT have a security label dom-6: A resource should have narrative for robust management | ||||
id | Σ | 0..1 | id | Logical id of this artifact | ||||
meta | Σ | 0..1 | Meta | Metadata about the resource ele-1: All FHIR elements must have a @value or children | ||||
implicitRules | ?!Σ | 0..1 | uri | A set of rules under which this content was created ele-1: All FHIR elements must have a @value or children | ||||
language | 0..1 | code | Language of the resource content Binding: AllLanguages (required): IETF language tag for a human language
ele-1: All FHIR elements must have a @value or children | |||||
text | 0..1 | Narrative | Text summary of the resource, for human interpretation ele-1: All FHIR elements must have a @value or children | |||||
contained | 0..* | Resource | Contained, inline Resources | |||||
extension | 0..* | Extension | Additional content defined by implementations ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
url | ΣC | 0..1 | uri | Canonical identifier for this {{title}}, represented as an absolute URI (globally unique) cnl-1: URL should not contain | or # - these characters make processing canonical references problematic ele-1: All FHIR elements must have a @value or children | ||||
identifier | Σ | 0..* | Identifier | Additional identifier for the {{title}} ele-1: All FHIR elements must have a @value or children | ||||
version | Σ | 0..1 | string | Business version of the {{title}} ele-1: All FHIR elements must have a @value or children | ||||
versionAlgorithm[x] | Σ | 0..1 | How to compare versions Binding: VersionAlgorithm (extensible) ele-1: All FHIR elements must have a @value or children | |||||
versionAlgorithmString | string | |||||||
versionAlgorithmCoding | Coding | |||||||
name | ΣC | 0..1 | string | Name for this {{title}} (computer friendly) ele-1: All FHIR elements must have a @value or children sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
title | Σ | 0..1 | string | Name for this {{title}} (human friendly) ele-1: All FHIR elements must have a @value or children | ||||
status | ?!Σ | 1..1 | code | draft | active | retired | unknown Binding: PublicationStatus (required): The lifecycle status of an artifact. ele-1: All FHIR elements must have a @value or children | ||||
experimental | Σ | 0..1 | boolean | For testing purposes, not real usage ele-1: All FHIR elements must have a @value or children | ||||
date | Σ | 0..1 | dateTime | Date last changed ele-1: All FHIR elements must have a @value or children | ||||
publisher | Σ | 0..1 | string | Name of the publisher/steward (organization or individual) ele-1: All FHIR elements must have a @value or children | ||||
contact | Σ | 0..* | ContactDetail | Contact details for the publisher ele-1: All FHIR elements must have a @value or children | ||||
description | 0..1 | markdown | Natural language description of the {{title}} ele-1: All FHIR elements must have a @value or children | |||||
useContext | Σ | 0..* | UsageContext | The context that the content is intended to support ele-1: All FHIR elements must have a @value or children | ||||
jurisdiction | Σ | 0..* | CodeableConcept | Intended jurisdiction for {{title}} (if applicable) Binding: JurisdictionValueSet (extensible): Countries and regions within which this artifact is targeted for use. ele-1: All FHIR elements must have a @value or children | ||||
purpose | 0..1 | markdown | Why this {{title}} is defined ele-1: All FHIR elements must have a @value or children | |||||
copyright | 0..1 | markdown | Use and/or publishing restrictions ele-1: All FHIR elements must have a @value or children | |||||
copyrightLabel | 0..1 | string | Copyright holder and year(s) ele-1: All FHIR elements must have a @value or children | |||||
resource | 1..1 | code | FHIR resource for the ViewDefinition Binding: ResourceType (required) | |||||
profile | 0..* | canonical(StructureDefinition) | FHIR profiles that this view definition was intended to be executed against | |||||
fhirVersion | 0..* | code | FHIR version(s) of the resource for the ViewDefinition Binding: FHIRVersion (required) | |||||
constant | 0..* | BackboneElement | Constant that can be used in FHIRPath expressions ele-1: All FHIR elements must have a @value or children | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
name | C | 1..1 | string | Name of constant (referred to in FHIRPath as %[name]) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
value[x] | 1..1 | Value of constant | ||||||
valueBase64Binary | base64Binary | |||||||
valueBoolean | boolean | |||||||
valueCanonical | canonical(Any) | |||||||
valueCode | code | |||||||
valueDate | date | |||||||
valueDateTime | dateTime | |||||||
valueDecimal | decimal | |||||||
valueId | id | |||||||
valueInstant | instant | |||||||
valueInteger | integer | |||||||
valueInteger64 | integer64 | |||||||
valueOid | oid | |||||||
valueString | string | |||||||
valuePositiveInt | positiveInt | |||||||
valueTime | time | |||||||
valueUnsignedInt | unsignedInt | |||||||
valueUri | uri | |||||||
valueUrl | url | |||||||
valueUuid | uuid | |||||||
select | C | 1..* | BackboneElement | A collection of columns and nested selects to include in the view. sql-expressions: Can only have at most one of `forEach` or `forEachOrNull`. ele-1: All FHIR elements must have a @value or children | ||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
column | 0..* | BackboneElement | A column to be produced in the resulting table. ele-1: All FHIR elements must have a @value or children | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
path | 1..1 | string | FHIRPath expression that creates a column and defines its content | |||||
name | C | 1..1 | string | Column name produced in the output sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
description | 0..1 | markdown | Description of the column | |||||
collection | 0..1 | boolean | Indicates whether the column may have multiple values. | |||||
type | 0..1 | uri | A FHIR StructureDefinition URI for the column's type. | |||||
tag | 0..* | BackboneElement | Additional metadata describing the column ele-1: All FHIR elements must have a @value or children | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
name | 1..1 | string | Name of tag | |||||
value | 1..1 | string | Value of tag | |||||
select | 0..* | See select | Nested select relative to a parent expression. | |||||
(Choice of one) | 0..1 | |||||||
forEach | 0..1 | string | A FHIRPath expression to retrieve the parent element(s) used in the containing select. The default is effectively `$this`. | |||||
forEachOrNull | 0..1 | string | Same as forEach, but will produce a row with null values if the collection is empty. | |||||
unionAll | 0..* | See select | Creates a union of all rows in the given selection structures. | |||||
where | 0..* | BackboneElement | A series of zero or more FHIRPath constraints to filter resources for the view. ele-1: All FHIR elements must have a @value or children | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
path | 1..1 | string | A FHIRPath expression defining a filter condition | |||||
description | 0..1 | string | A human-readable description of the above where constraint. | |||||
Documentation for this format |
Path | Conformance | ValueSet | URI |
ViewDefinition.language | required | AllLanguageshttp://hl7.org/fhir/ValueSet/all-languages|5.0.0 from the FHIR Standard | |
ViewDefinition.versionAlgorithm[x] | extensible | VersionAlgorithmhttp://hl7.org/fhir/ValueSet/version-algorithm from the FHIR Standard | |
ViewDefinition.status | required | PublicationStatushttp://hl7.org/fhir/ValueSet/publication-status|5.0.0 from the FHIR Standard | |
ViewDefinition.jurisdiction | extensible | JurisdictionValueSethttp://hl7.org/fhir/ValueSet/jurisdiction from the FHIR Standard | |
ViewDefinition.resource | required | ResourceTypehttp://hl7.org/fhir/ValueSet/resource-types from the FHIR Standard | |
ViewDefinition.fhirVersion | required | FHIRVersionhttp://hl7.org/fhir/ValueSet/FHIR-version from the FHIR Standard |
Id | Grade | Path(s) | Details | Requirements |
cnl-0 | warning | ViewDefinition | Name should be usable as an identifier for the module by machine processing applications such as code generation : name.exists() implies name.matches('^[A-Z]([A-Za-z0-9_]){1,254}$') | |
cnl-1 | warning | ViewDefinition.url | URL should not contain | or # - these characters make processing canonical references problematic : exists() implies matches('^[^|# ]+$') | |
dom-2 | error | ViewDefinition | If the resource is contained in another resource, it SHALL NOT contain nested Resources : contained.contained.empty() | |
dom-3 | error | ViewDefinition | If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource : contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().ofType(canonical) | %resource.descendants().ofType(uri) | %resource.descendants().ofType(url))) or descendants().where(reference = '#').exists() or descendants().where(ofType(canonical) = '#').exists() or descendants().where(ofType(canonical) = '#').exists()).not()).trace('unmatched', id).empty() | |
dom-4 | error | ViewDefinition | If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated : contained.meta.versionId.empty() and contained.meta.lastUpdated.empty() | |
dom-5 | error | ViewDefinition | If a resource is contained in another resource, it SHALL NOT have a security label : contained.meta.security.empty() | |
dom-6 | best practice | ViewDefinition | A resource should have narrative for robust management : text.`div`.exists() | |
ele-1 | error | **ALL** elements | All FHIR elements must have a @value or children : hasValue() or (children().count() > id.count()) | |
ext-1 | error | **ALL** extensions | Must have either extensions or value[x], not both : extension.exists() != value.exists() | |
sql-expressions | error | ViewDefinition.select | Can only have at most one of `forEach` or `forEachOrNull`. : (forEach | forEachOrNull).count() <= 1 | |
sql-name | error | ViewDefinition.name, ViewDefinition.constant.name, ViewDefinition.select.column.name | Name is limited to letters, numbers, or underscores and cannot start with an
underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$
This makes it usable as table names in a wide variety of databases. : empty() or matches('^[A-Za-z][A-Za-z0-9_]*$') |
This structure is derived from CanonicalResource
Name | Flags | Card. | Type | Description & Constraints |
---|---|---|---|---|
ViewDefinition | 1..1 | CanonicalResource | Elements defined in Ancestors:id, meta, implicitRules, language, text, contained, extension, modifierExtension, url, identifier, version, versionAlgorithm[x], name, title, status, experimental, date, publisher, contact, description, useContext, jurisdiction, purpose, copyright, copyrightLabel View Definition | |
name | C | 0..1 | string | Name for this {{title}} (computer friendly) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. |
resource | 1..1 | code | FHIR resource for the ViewDefinition Binding: ResourceType (required) | |
profile | 0..* | canonical(StructureDefinition) | FHIR profiles that this view definition was intended to be executed against | |
fhirVersion | 0..* | code | FHIR version(s) of the resource for the ViewDefinition Binding: FHIRVersion (required) | |
constant | 0..* | BackboneElement | Constant that can be used in FHIRPath expressions | |
name | C | 1..1 | string | Name of constant (referred to in FHIRPath as %[name]) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. |
value[x] | 1..1 | Value of constant | ||
valueBase64Binary | base64Binary | |||
valueBoolean | boolean | |||
valueCanonical | canonical(Any) | |||
valueCode | code | |||
valueDate | date | |||
valueDateTime | dateTime | |||
valueDecimal | decimal | |||
valueId | id | |||
valueInstant | instant | |||
valueInteger | integer | |||
valueInteger64 | integer64 | |||
valueOid | oid | |||
valueString | string | |||
valuePositiveInt | positiveInt | |||
valueTime | time | |||
valueUnsignedInt | unsignedInt | |||
valueUri | uri | |||
valueUrl | url | |||
valueUuid | uuid | |||
select | C | 1..* | BackboneElement | A collection of columns and nested selects to include in the view. sql-expressions: Can only have at most one of `forEach` or `forEachOrNull`. |
column | 0..* | BackboneElement | A column to be produced in the resulting table. | |
path | 1..1 | string | FHIRPath expression that creates a column and defines its content | |
name | C | 1..1 | string | Column name produced in the output sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. |
description | 0..1 | markdown | Description of the column | |
collection | 0..1 | boolean | Indicates whether the column may have multiple values. | |
type | 0..1 | uri | A FHIR StructureDefinition URI for the column's type. | |
tag | 0..* | BackboneElement | Additional metadata describing the column | |
name | 1..1 | string | Name of tag | |
value | 1..1 | string | Value of tag | |
select | 0..* | See select | Nested select relative to a parent expression. | |
(Choice of one) | 0..1 | |||
forEach | 0..1 | string | A FHIRPath expression to retrieve the parent element(s) used in the containing select. The default is effectively `$this`. | |
forEachOrNull | 0..1 | string | Same as forEach, but will produce a row with null values if the collection is empty. | |
unionAll | 0..* | See select | Creates a union of all rows in the given selection structures. | |
where | 0..* | BackboneElement | A series of zero or more FHIRPath constraints to filter resources for the view. | |
path | 1..1 | string | A FHIRPath expression defining a filter condition | |
description | 0..1 | string | A human-readable description of the above where constraint. | |
Documentation for this format |
Path | Conformance | ValueSet | URI |
ViewDefinition.resource | required | ResourceTypehttp://hl7.org/fhir/ValueSet/resource-types from the FHIR Standard | |
ViewDefinition.fhirVersion | required | FHIRVersionhttp://hl7.org/fhir/ValueSet/FHIR-version from the FHIR Standard |
Id | Grade | Path(s) | Details | Requirements |
sql-expressions | error | ViewDefinition.select | Can only have at most one of `forEach` or `forEachOrNull`. : (forEach | forEachOrNull).count() <= 1 | |
sql-name | error | ViewDefinition.name, ViewDefinition.constant.name, ViewDefinition.select.column.name | Name is limited to letters, numbers, or underscores and cannot start with an
underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$
This makes it usable as table names in a wide variety of databases. : empty() or matches('^[A-Za-z][A-Za-z0-9_]*$') |
Name | Flags | Card. | Type | Description & Constraints | ||||
---|---|---|---|---|---|---|---|---|
ViewDefinition | C | 1..1 | CanonicalResource | Elements defined in Ancestors:id, meta, implicitRules, language, text, contained, extension, modifierExtension, url, identifier, version, versionAlgorithm[x], name, title, status, experimental, date, publisher, contact, description, useContext, jurisdiction, purpose, copyright, copyrightLabel View Definition | ||||
id | Σ | 0..1 | id | Logical id of this artifact | ||||
meta | Σ | 0..1 | Meta | Metadata about the resource | ||||
implicitRules | ?!Σ | 0..1 | uri | A set of rules under which this content was created | ||||
language | 0..1 | code | Language of the resource content Binding: AllLanguages (required): IETF language tag for a human language
| |||||
text | 0..1 | Narrative | Text summary of the resource, for human interpretation | |||||
contained | 0..* | Resource | Contained, inline Resources | |||||
extension | 0..* | Extension | Additional content defined by implementations | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored | ||||
url | ΣC | 0..1 | uri | Canonical identifier for this {{title}}, represented as an absolute URI (globally unique) | ||||
identifier | Σ | 0..* | Identifier | Additional identifier for the {{title}} | ||||
version | Σ | 0..1 | string | Business version of the {{title}} | ||||
versionAlgorithm[x] | Σ | 0..1 | How to compare versions Binding: VersionAlgorithm (extensible) | |||||
versionAlgorithmString | string | |||||||
versionAlgorithmCoding | Coding | |||||||
name | ΣC | 0..1 | string | Name for this {{title}} (computer friendly) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
title | Σ | 0..1 | string | Name for this {{title}} (human friendly) | ||||
status | ?!Σ | 1..1 | code | draft | active | retired | unknown Binding: PublicationStatus (required): The lifecycle status of an artifact. | ||||
experimental | Σ | 0..1 | boolean | For testing purposes, not real usage | ||||
date | Σ | 0..1 | dateTime | Date last changed | ||||
publisher | Σ | 0..1 | string | Name of the publisher/steward (organization or individual) | ||||
contact | Σ | 0..* | ContactDetail | Contact details for the publisher | ||||
description | 0..1 | markdown | Natural language description of the {{title}} | |||||
useContext | Σ | 0..* | UsageContext | The context that the content is intended to support | ||||
jurisdiction | Σ | 0..* | CodeableConcept | Intended jurisdiction for {{title}} (if applicable) Binding: JurisdictionValueSet (extensible): Countries and regions within which this artifact is targeted for use. | ||||
purpose | 0..1 | markdown | Why this {{title}} is defined | |||||
copyright | 0..1 | markdown | Use and/or publishing restrictions | |||||
copyrightLabel | 0..1 | string | Copyright holder and year(s) | |||||
resource | 1..1 | code | FHIR resource for the ViewDefinition Binding: ResourceType (required) | |||||
profile | 0..* | canonical(StructureDefinition) | FHIR profiles that this view definition was intended to be executed against | |||||
fhirVersion | 0..* | code | FHIR version(s) of the resource for the ViewDefinition Binding: FHIRVersion (required) | |||||
constant | 0..* | BackboneElement | Constant that can be used in FHIRPath expressions | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
name | C | 1..1 | string | Name of constant (referred to in FHIRPath as %[name]) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
value[x] | 1..1 | Value of constant | ||||||
valueBase64Binary | base64Binary | |||||||
valueBoolean | boolean | |||||||
valueCanonical | canonical(Any) | |||||||
valueCode | code | |||||||
valueDate | date | |||||||
valueDateTime | dateTime | |||||||
valueDecimal | decimal | |||||||
valueId | id | |||||||
valueInstant | instant | |||||||
valueInteger | integer | |||||||
valueInteger64 | integer64 | |||||||
valueOid | oid | |||||||
valueString | string | |||||||
valuePositiveInt | positiveInt | |||||||
valueTime | time | |||||||
valueUnsignedInt | unsignedInt | |||||||
valueUri | uri | |||||||
valueUrl | url | |||||||
valueUuid | uuid | |||||||
select | C | 1..* | BackboneElement | A collection of columns and nested selects to include in the view. sql-expressions: Can only have at most one of `forEach` or `forEachOrNull`. | ||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
column | 0..* | BackboneElement | A column to be produced in the resulting table. | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
path | 1..1 | string | FHIRPath expression that creates a column and defines its content | |||||
name | C | 1..1 | string | Column name produced in the output sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
description | 0..1 | markdown | Description of the column | |||||
collection | 0..1 | boolean | Indicates whether the column may have multiple values. | |||||
type | 0..1 | uri | A FHIR StructureDefinition URI for the column's type. | |||||
tag | 0..* | BackboneElement | Additional metadata describing the column | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
name | 1..1 | string | Name of tag | |||||
value | 1..1 | string | Value of tag | |||||
select | 0..* | See select | Nested select relative to a parent expression. | |||||
(Choice of one) | 0..1 | |||||||
forEach | 0..1 | string | A FHIRPath expression to retrieve the parent element(s) used in the containing select. The default is effectively `$this`. | |||||
forEachOrNull | 0..1 | string | Same as forEach, but will produce a row with null values if the collection is empty. | |||||
unionAll | 0..* | See select | Creates a union of all rows in the given selection structures. | |||||
where | 0..* | BackboneElement | A series of zero or more FHIRPath constraints to filter resources for the view. | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
path | 1..1 | string | A FHIRPath expression defining a filter condition | |||||
description | 0..1 | string | A human-readable description of the above where constraint. | |||||
Documentation for this format |
Path | Conformance | ValueSet | URI |
ViewDefinition.language | required | AllLanguageshttp://hl7.org/fhir/ValueSet/all-languages|5.0.0 from the FHIR Standard | |
ViewDefinition.versionAlgorithm[x] | extensible | VersionAlgorithmhttp://hl7.org/fhir/ValueSet/version-algorithm from the FHIR Standard | |
ViewDefinition.status | required | PublicationStatushttp://hl7.org/fhir/ValueSet/publication-status|5.0.0 from the FHIR Standard | |
ViewDefinition.jurisdiction | extensible | JurisdictionValueSethttp://hl7.org/fhir/ValueSet/jurisdiction from the FHIR Standard | |
ViewDefinition.resource | required | ResourceTypehttp://hl7.org/fhir/ValueSet/resource-types from the FHIR Standard | |
ViewDefinition.fhirVersion | required | FHIRVersionhttp://hl7.org/fhir/ValueSet/FHIR-version from the FHIR Standard |
Id | Grade | Path(s) | Details | Requirements |
cnl-0 | warning | ViewDefinition | Name should be usable as an identifier for the module by machine processing applications such as code generation : name.exists() implies name.matches('^[A-Z]([A-Za-z0-9_]){1,254}$') | |
cnl-1 | warning | ViewDefinition.url | URL should not contain | or # - these characters make processing canonical references problematic : exists() implies matches('^[^|# ]+$') | |
dom-2 | error | ViewDefinition | If the resource is contained in another resource, it SHALL NOT contain nested Resources : contained.contained.empty() | |
dom-3 | error | ViewDefinition | If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource : contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().ofType(canonical) | %resource.descendants().ofType(uri) | %resource.descendants().ofType(url))) or descendants().where(reference = '#').exists() or descendants().where(ofType(canonical) = '#').exists() or descendants().where(ofType(canonical) = '#').exists()).not()).trace('unmatched', id).empty() | |
dom-4 | error | ViewDefinition | If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated : contained.meta.versionId.empty() and contained.meta.lastUpdated.empty() | |
dom-5 | error | ViewDefinition | If a resource is contained in another resource, it SHALL NOT have a security label : contained.meta.security.empty() | |
dom-6 | best practice | ViewDefinition | A resource should have narrative for robust management : text.`div`.exists() | |
ele-1 | error | **ALL** elements | All FHIR elements must have a @value or children : hasValue() or (children().count() > id.count()) | |
ext-1 | error | **ALL** extensions | Must have either extensions or value[x], not both : extension.exists() != value.exists() | |
sql-expressions | error | ViewDefinition.select | Can only have at most one of `forEach` or `forEachOrNull`. : (forEach | forEachOrNull).count() <= 1 | |
sql-name | error | ViewDefinition.name, ViewDefinition.constant.name, ViewDefinition.select.column.name | Name is limited to letters, numbers, or underscores and cannot start with an
underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$
This makes it usable as table names in a wide variety of databases. : empty() or matches('^[A-Za-z][A-Za-z0-9_]*$') |
This structure is derived from CanonicalResource
Key Elements View
Name | Flags | Card. | Type | Description & Constraints | ||||
---|---|---|---|---|---|---|---|---|
ViewDefinition | C | 1..1 | CanonicalResource | Elements defined in Ancestors:id, meta, implicitRules, language, text, contained, extension, modifierExtension, url, identifier, version, versionAlgorithm[x], name, title, status, experimental, date, publisher, contact, description, useContext, jurisdiction, purpose, copyright, copyrightLabel View Definition cnl-0: Name should be usable as an identifier for the module by machine processing applications such as code generation dom-2: If the resource is contained in another resource, it SHALL NOT contain nested Resources dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated dom-5: If a resource is contained in another resource, it SHALL NOT have a security label dom-6: A resource should have narrative for robust management | ||||
id | Σ | 0..1 | id | Logical id of this artifact | ||||
meta | Σ | 0..1 | Meta | Metadata about the resource ele-1: All FHIR elements must have a @value or children | ||||
implicitRules | ?!Σ | 0..1 | uri | A set of rules under which this content was created ele-1: All FHIR elements must have a @value or children | ||||
language | 0..1 | code | Language of the resource content Binding: AllLanguages (required): IETF language tag for a human language
ele-1: All FHIR elements must have a @value or children | |||||
text | 0..1 | Narrative | Text summary of the resource, for human interpretation ele-1: All FHIR elements must have a @value or children | |||||
contained | 0..* | Resource | Contained, inline Resources | |||||
extension | 0..* | Extension | Additional content defined by implementations ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
url | ΣC | 0..1 | uri | Canonical identifier for this {{title}}, represented as an absolute URI (globally unique) cnl-1: URL should not contain | or # - these characters make processing canonical references problematic ele-1: All FHIR elements must have a @value or children | ||||
identifier | Σ | 0..* | Identifier | Additional identifier for the {{title}} ele-1: All FHIR elements must have a @value or children | ||||
version | Σ | 0..1 | string | Business version of the {{title}} ele-1: All FHIR elements must have a @value or children | ||||
versionAlgorithm[x] | Σ | 0..1 | How to compare versions Binding: VersionAlgorithm (extensible) ele-1: All FHIR elements must have a @value or children | |||||
versionAlgorithmString | string | |||||||
versionAlgorithmCoding | Coding | |||||||
name | ΣC | 0..1 | string | Name for this {{title}} (computer friendly) ele-1: All FHIR elements must have a @value or children sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
title | Σ | 0..1 | string | Name for this {{title}} (human friendly) ele-1: All FHIR elements must have a @value or children | ||||
status | ?!Σ | 1..1 | code | draft | active | retired | unknown Binding: PublicationStatus (required): The lifecycle status of an artifact. ele-1: All FHIR elements must have a @value or children | ||||
experimental | Σ | 0..1 | boolean | For testing purposes, not real usage ele-1: All FHIR elements must have a @value or children | ||||
date | Σ | 0..1 | dateTime | Date last changed ele-1: All FHIR elements must have a @value or children | ||||
publisher | Σ | 0..1 | string | Name of the publisher/steward (organization or individual) ele-1: All FHIR elements must have a @value or children | ||||
contact | Σ | 0..* | ContactDetail | Contact details for the publisher ele-1: All FHIR elements must have a @value or children | ||||
description | 0..1 | markdown | Natural language description of the {{title}} ele-1: All FHIR elements must have a @value or children | |||||
useContext | Σ | 0..* | UsageContext | The context that the content is intended to support ele-1: All FHIR elements must have a @value or children | ||||
jurisdiction | Σ | 0..* | CodeableConcept | Intended jurisdiction for {{title}} (if applicable) Binding: JurisdictionValueSet (extensible): Countries and regions within which this artifact is targeted for use. ele-1: All FHIR elements must have a @value or children | ||||
purpose | 0..1 | markdown | Why this {{title}} is defined ele-1: All FHIR elements must have a @value or children | |||||
copyright | 0..1 | markdown | Use and/or publishing restrictions ele-1: All FHIR elements must have a @value or children | |||||
copyrightLabel | 0..1 | string | Copyright holder and year(s) ele-1: All FHIR elements must have a @value or children | |||||
resource | 1..1 | code | FHIR resource for the ViewDefinition Binding: ResourceType (required) | |||||
profile | 0..* | canonical(StructureDefinition) | FHIR profiles that this view definition was intended to be executed against | |||||
fhirVersion | 0..* | code | FHIR version(s) of the resource for the ViewDefinition Binding: FHIRVersion (required) | |||||
constant | 0..* | BackboneElement | Constant that can be used in FHIRPath expressions ele-1: All FHIR elements must have a @value or children | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
name | C | 1..1 | string | Name of constant (referred to in FHIRPath as %[name]) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
value[x] | 1..1 | Value of constant | ||||||
valueBase64Binary | base64Binary | |||||||
valueBoolean | boolean | |||||||
valueCanonical | canonical(Any) | |||||||
valueCode | code | |||||||
valueDate | date | |||||||
valueDateTime | dateTime | |||||||
valueDecimal | decimal | |||||||
valueId | id | |||||||
valueInstant | instant | |||||||
valueInteger | integer | |||||||
valueInteger64 | integer64 | |||||||
valueOid | oid | |||||||
valueString | string | |||||||
valuePositiveInt | positiveInt | |||||||
valueTime | time | |||||||
valueUnsignedInt | unsignedInt | |||||||
valueUri | uri | |||||||
valueUrl | url | |||||||
valueUuid | uuid | |||||||
select | C | 1..* | BackboneElement | A collection of columns and nested selects to include in the view. sql-expressions: Can only have at most one of `forEach` or `forEachOrNull`. ele-1: All FHIR elements must have a @value or children | ||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
column | 0..* | BackboneElement | A column to be produced in the resulting table. ele-1: All FHIR elements must have a @value or children | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
path | 1..1 | string | FHIRPath expression that creates a column and defines its content | |||||
name | C | 1..1 | string | Column name produced in the output sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
description | 0..1 | markdown | Description of the column | |||||
collection | 0..1 | boolean | Indicates whether the column may have multiple values. | |||||
type | 0..1 | uri | A FHIR StructureDefinition URI for the column's type. | |||||
tag | 0..* | BackboneElement | Additional metadata describing the column ele-1: All FHIR elements must have a @value or children | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
name | 1..1 | string | Name of tag | |||||
value | 1..1 | string | Value of tag | |||||
select | 0..* | See select | Nested select relative to a parent expression. | |||||
(Choice of one) | 0..1 | |||||||
forEach | 0..1 | string | A FHIRPath expression to retrieve the parent element(s) used in the containing select. The default is effectively `$this`. | |||||
forEachOrNull | 0..1 | string | Same as forEach, but will produce a row with null values if the collection is empty. | |||||
unionAll | 0..* | See select | Creates a union of all rows in the given selection structures. | |||||
where | 0..* | BackboneElement | A series of zero or more FHIRPath constraints to filter resources for the view. ele-1: All FHIR elements must have a @value or children | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized ele-1: All FHIR elements must have a @value or children ext-1: Must have either extensions or value[x], not both | ||||
path | 1..1 | string | A FHIRPath expression defining a filter condition | |||||
description | 0..1 | string | A human-readable description of the above where constraint. | |||||
Documentation for this format |
Path | Conformance | ValueSet | URI |
ViewDefinition.language | required | AllLanguageshttp://hl7.org/fhir/ValueSet/all-languages|5.0.0 from the FHIR Standard | |
ViewDefinition.versionAlgorithm[x] | extensible | VersionAlgorithmhttp://hl7.org/fhir/ValueSet/version-algorithm from the FHIR Standard | |
ViewDefinition.status | required | PublicationStatushttp://hl7.org/fhir/ValueSet/publication-status|5.0.0 from the FHIR Standard | |
ViewDefinition.jurisdiction | extensible | JurisdictionValueSethttp://hl7.org/fhir/ValueSet/jurisdiction from the FHIR Standard | |
ViewDefinition.resource | required | ResourceTypehttp://hl7.org/fhir/ValueSet/resource-types from the FHIR Standard | |
ViewDefinition.fhirVersion | required | FHIRVersionhttp://hl7.org/fhir/ValueSet/FHIR-version from the FHIR Standard |
Id | Grade | Path(s) | Details | Requirements |
cnl-0 | warning | ViewDefinition | Name should be usable as an identifier for the module by machine processing applications such as code generation : name.exists() implies name.matches('^[A-Z]([A-Za-z0-9_]){1,254}$') | |
cnl-1 | warning | ViewDefinition.url | URL should not contain | or # - these characters make processing canonical references problematic : exists() implies matches('^[^|# ]+$') | |
dom-2 | error | ViewDefinition | If the resource is contained in another resource, it SHALL NOT contain nested Resources : contained.contained.empty() | |
dom-3 | error | ViewDefinition | If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource : contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().ofType(canonical) | %resource.descendants().ofType(uri) | %resource.descendants().ofType(url))) or descendants().where(reference = '#').exists() or descendants().where(ofType(canonical) = '#').exists() or descendants().where(ofType(canonical) = '#').exists()).not()).trace('unmatched', id).empty() | |
dom-4 | error | ViewDefinition | If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated : contained.meta.versionId.empty() and contained.meta.lastUpdated.empty() | |
dom-5 | error | ViewDefinition | If a resource is contained in another resource, it SHALL NOT have a security label : contained.meta.security.empty() | |
dom-6 | best practice | ViewDefinition | A resource should have narrative for robust management : text.`div`.exists() | |
ele-1 | error | **ALL** elements | All FHIR elements must have a @value or children : hasValue() or (children().count() > id.count()) | |
ext-1 | error | **ALL** extensions | Must have either extensions or value[x], not both : extension.exists() != value.exists() | |
sql-expressions | error | ViewDefinition.select | Can only have at most one of `forEach` or `forEachOrNull`. : (forEach | forEachOrNull).count() <= 1 | |
sql-name | error | ViewDefinition.name, ViewDefinition.constant.name, ViewDefinition.select.column.name | Name is limited to letters, numbers, or underscores and cannot start with an
underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$
This makes it usable as table names in a wide variety of databases. : empty() or matches('^[A-Za-z][A-Za-z0-9_]*$') |
Differential View
This structure is derived from CanonicalResource
Name | Flags | Card. | Type | Description & Constraints |
---|---|---|---|---|
ViewDefinition | 1..1 | CanonicalResource | Elements defined in Ancestors:id, meta, implicitRules, language, text, contained, extension, modifierExtension, url, identifier, version, versionAlgorithm[x], name, title, status, experimental, date, publisher, contact, description, useContext, jurisdiction, purpose, copyright, copyrightLabel View Definition | |
name | C | 0..1 | string | Name for this {{title}} (computer friendly) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. |
resource | 1..1 | code | FHIR resource for the ViewDefinition Binding: ResourceType (required) | |
profile | 0..* | canonical(StructureDefinition) | FHIR profiles that this view definition was intended to be executed against | |
fhirVersion | 0..* | code | FHIR version(s) of the resource for the ViewDefinition Binding: FHIRVersion (required) | |
constant | 0..* | BackboneElement | Constant that can be used in FHIRPath expressions | |
name | C | 1..1 | string | Name of constant (referred to in FHIRPath as %[name]) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. |
value[x] | 1..1 | Value of constant | ||
valueBase64Binary | base64Binary | |||
valueBoolean | boolean | |||
valueCanonical | canonical(Any) | |||
valueCode | code | |||
valueDate | date | |||
valueDateTime | dateTime | |||
valueDecimal | decimal | |||
valueId | id | |||
valueInstant | instant | |||
valueInteger | integer | |||
valueInteger64 | integer64 | |||
valueOid | oid | |||
valueString | string | |||
valuePositiveInt | positiveInt | |||
valueTime | time | |||
valueUnsignedInt | unsignedInt | |||
valueUri | uri | |||
valueUrl | url | |||
valueUuid | uuid | |||
select | C | 1..* | BackboneElement | A collection of columns and nested selects to include in the view. sql-expressions: Can only have at most one of `forEach` or `forEachOrNull`. |
column | 0..* | BackboneElement | A column to be produced in the resulting table. | |
path | 1..1 | string | FHIRPath expression that creates a column and defines its content | |
name | C | 1..1 | string | Column name produced in the output sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. |
description | 0..1 | markdown | Description of the column | |
collection | 0..1 | boolean | Indicates whether the column may have multiple values. | |
type | 0..1 | uri | A FHIR StructureDefinition URI for the column's type. | |
tag | 0..* | BackboneElement | Additional metadata describing the column | |
name | 1..1 | string | Name of tag | |
value | 1..1 | string | Value of tag | |
select | 0..* | See select | Nested select relative to a parent expression. | |
(Choice of one) | 0..1 | |||
forEach | 0..1 | string | A FHIRPath expression to retrieve the parent element(s) used in the containing select. The default is effectively `$this`. | |
forEachOrNull | 0..1 | string | Same as forEach, but will produce a row with null values if the collection is empty. | |
unionAll | 0..* | See select | Creates a union of all rows in the given selection structures. | |
where | 0..* | BackboneElement | A series of zero or more FHIRPath constraints to filter resources for the view. | |
path | 1..1 | string | A FHIRPath expression defining a filter condition | |
description | 0..1 | string | A human-readable description of the above where constraint. | |
Documentation for this format |
Path | Conformance | ValueSet | URI |
ViewDefinition.resource | required | ResourceTypehttp://hl7.org/fhir/ValueSet/resource-types from the FHIR Standard | |
ViewDefinition.fhirVersion | required | FHIRVersionhttp://hl7.org/fhir/ValueSet/FHIR-version from the FHIR Standard |
Id | Grade | Path(s) | Details | Requirements |
sql-expressions | error | ViewDefinition.select | Can only have at most one of `forEach` or `forEachOrNull`. : (forEach | forEachOrNull).count() <= 1 | |
sql-name | error | ViewDefinition.name, ViewDefinition.constant.name, ViewDefinition.select.column.name | Name is limited to letters, numbers, or underscores and cannot start with an
underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$
This makes it usable as table names in a wide variety of databases. : empty() or matches('^[A-Za-z][A-Za-z0-9_]*$') |
Snapshot View
Name | Flags | Card. | Type | Description & Constraints | ||||
---|---|---|---|---|---|---|---|---|
ViewDefinition | C | 1..1 | CanonicalResource | Elements defined in Ancestors:id, meta, implicitRules, language, text, contained, extension, modifierExtension, url, identifier, version, versionAlgorithm[x], name, title, status, experimental, date, publisher, contact, description, useContext, jurisdiction, purpose, copyright, copyrightLabel View Definition | ||||
id | Σ | 0..1 | id | Logical id of this artifact | ||||
meta | Σ | 0..1 | Meta | Metadata about the resource | ||||
implicitRules | ?!Σ | 0..1 | uri | A set of rules under which this content was created | ||||
language | 0..1 | code | Language of the resource content Binding: AllLanguages (required): IETF language tag for a human language
| |||||
text | 0..1 | Narrative | Text summary of the resource, for human interpretation | |||||
contained | 0..* | Resource | Contained, inline Resources | |||||
extension | 0..* | Extension | Additional content defined by implementations | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored | ||||
url | ΣC | 0..1 | uri | Canonical identifier for this {{title}}, represented as an absolute URI (globally unique) | ||||
identifier | Σ | 0..* | Identifier | Additional identifier for the {{title}} | ||||
version | Σ | 0..1 | string | Business version of the {{title}} | ||||
versionAlgorithm[x] | Σ | 0..1 | How to compare versions Binding: VersionAlgorithm (extensible) | |||||
versionAlgorithmString | string | |||||||
versionAlgorithmCoding | Coding | |||||||
name | ΣC | 0..1 | string | Name for this {{title}} (computer friendly) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
title | Σ | 0..1 | string | Name for this {{title}} (human friendly) | ||||
status | ?!Σ | 1..1 | code | draft | active | retired | unknown Binding: PublicationStatus (required): The lifecycle status of an artifact. | ||||
experimental | Σ | 0..1 | boolean | For testing purposes, not real usage | ||||
date | Σ | 0..1 | dateTime | Date last changed | ||||
publisher | Σ | 0..1 | string | Name of the publisher/steward (organization or individual) | ||||
contact | Σ | 0..* | ContactDetail | Contact details for the publisher | ||||
description | 0..1 | markdown | Natural language description of the {{title}} | |||||
useContext | Σ | 0..* | UsageContext | The context that the content is intended to support | ||||
jurisdiction | Σ | 0..* | CodeableConcept | Intended jurisdiction for {{title}} (if applicable) Binding: JurisdictionValueSet (extensible): Countries and regions within which this artifact is targeted for use. | ||||
purpose | 0..1 | markdown | Why this {{title}} is defined | |||||
copyright | 0..1 | markdown | Use and/or publishing restrictions | |||||
copyrightLabel | 0..1 | string | Copyright holder and year(s) | |||||
resource | 1..1 | code | FHIR resource for the ViewDefinition Binding: ResourceType (required) | |||||
profile | 0..* | canonical(StructureDefinition) | FHIR profiles that this view definition was intended to be executed against | |||||
fhirVersion | 0..* | code | FHIR version(s) of the resource for the ViewDefinition Binding: FHIRVersion (required) | |||||
constant | 0..* | BackboneElement | Constant that can be used in FHIRPath expressions | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
name | C | 1..1 | string | Name of constant (referred to in FHIRPath as %[name]) sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
value[x] | 1..1 | Value of constant | ||||||
valueBase64Binary | base64Binary | |||||||
valueBoolean | boolean | |||||||
valueCanonical | canonical(Any) | |||||||
valueCode | code | |||||||
valueDate | date | |||||||
valueDateTime | dateTime | |||||||
valueDecimal | decimal | |||||||
valueId | id | |||||||
valueInstant | instant | |||||||
valueInteger | integer | |||||||
valueInteger64 | integer64 | |||||||
valueOid | oid | |||||||
valueString | string | |||||||
valuePositiveInt | positiveInt | |||||||
valueTime | time | |||||||
valueUnsignedInt | unsignedInt | |||||||
valueUri | uri | |||||||
valueUrl | url | |||||||
valueUuid | uuid | |||||||
select | C | 1..* | BackboneElement | A collection of columns and nested selects to include in the view. sql-expressions: Can only have at most one of `forEach` or `forEachOrNull`. | ||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
column | 0..* | BackboneElement | A column to be produced in the resulting table. | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
path | 1..1 | string | FHIRPath expression that creates a column and defines its content | |||||
name | C | 1..1 | string | Column name produced in the output sql-name: Name is limited to letters, numbers, or underscores and cannot start with an underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ This makes it usable as table names in a wide variety of databases. | ||||
description | 0..1 | markdown | Description of the column | |||||
collection | 0..1 | boolean | Indicates whether the column may have multiple values. | |||||
type | 0..1 | uri | A FHIR StructureDefinition URI for the column's type. | |||||
tag | 0..* | BackboneElement | Additional metadata describing the column | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
name | 1..1 | string | Name of tag | |||||
value | 1..1 | string | Value of tag | |||||
select | 0..* | See select | Nested select relative to a parent expression. | |||||
(Choice of one) | 0..1 | |||||||
forEach | 0..1 | string | A FHIRPath expression to retrieve the parent element(s) used in the containing select. The default is effectively `$this`. | |||||
forEachOrNull | 0..1 | string | Same as forEach, but will produce a row with null values if the collection is empty. | |||||
unionAll | 0..* | See select | Creates a union of all rows in the given selection structures. | |||||
where | 0..* | BackboneElement | A series of zero or more FHIRPath constraints to filter resources for the view. | |||||
@id | 0..1 | id | Unique id for inter-element referencing | |||||
extension | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url | |||||
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized | ||||
path | 1..1 | string | A FHIRPath expression defining a filter condition | |||||
description | 0..1 | string | A human-readable description of the above where constraint. | |||||
Documentation for this format |
Path | Conformance | ValueSet | URI |
ViewDefinition.language | required | AllLanguageshttp://hl7.org/fhir/ValueSet/all-languages|5.0.0 from the FHIR Standard | |
ViewDefinition.versionAlgorithm[x] | extensible | VersionAlgorithmhttp://hl7.org/fhir/ValueSet/version-algorithm from the FHIR Standard | |
ViewDefinition.status | required | PublicationStatushttp://hl7.org/fhir/ValueSet/publication-status|5.0.0 from the FHIR Standard | |
ViewDefinition.jurisdiction | extensible | JurisdictionValueSethttp://hl7.org/fhir/ValueSet/jurisdiction from the FHIR Standard | |
ViewDefinition.resource | required | ResourceTypehttp://hl7.org/fhir/ValueSet/resource-types from the FHIR Standard | |
ViewDefinition.fhirVersion | required | FHIRVersionhttp://hl7.org/fhir/ValueSet/FHIR-version from the FHIR Standard |
Id | Grade | Path(s) | Details | Requirements |
cnl-0 | warning | ViewDefinition | Name should be usable as an identifier for the module by machine processing applications such as code generation : name.exists() implies name.matches('^[A-Z]([A-Za-z0-9_]){1,254}$') | |
cnl-1 | warning | ViewDefinition.url | URL should not contain | or # - these characters make processing canonical references problematic : exists() implies matches('^[^|# ]+$') | |
dom-2 | error | ViewDefinition | If the resource is contained in another resource, it SHALL NOT contain nested Resources : contained.contained.empty() | |
dom-3 | error | ViewDefinition | If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource : contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().ofType(canonical) | %resource.descendants().ofType(uri) | %resource.descendants().ofType(url))) or descendants().where(reference = '#').exists() or descendants().where(ofType(canonical) = '#').exists() or descendants().where(ofType(canonical) = '#').exists()).not()).trace('unmatched', id).empty() | |
dom-4 | error | ViewDefinition | If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated : contained.meta.versionId.empty() and contained.meta.lastUpdated.empty() | |
dom-5 | error | ViewDefinition | If a resource is contained in another resource, it SHALL NOT have a security label : contained.meta.security.empty() | |
dom-6 | best practice | ViewDefinition | A resource should have narrative for robust management : text.`div`.exists() | |
ele-1 | error | **ALL** elements | All FHIR elements must have a @value or children : hasValue() or (children().count() > id.count()) | |
ext-1 | error | **ALL** extensions | Must have either extensions or value[x], not both : extension.exists() != value.exists() | |
sql-expressions | error | ViewDefinition.select | Can only have at most one of `forEach` or `forEachOrNull`. : (forEach | forEachOrNull).count() <= 1 | |
sql-name | error | ViewDefinition.name, ViewDefinition.constant.name, ViewDefinition.select.column.name | Name is limited to letters, numbers, or underscores and cannot start with an
underscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$
This makes it usable as table names in a wide variety of databases. : empty() or matches('^[A-Za-z][A-Za-z0-9_]*$') |