Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tabular profile and an example. #232

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions input/fsh/examples.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,43 @@ Usage: #example
* path = "family"
* name = "family_name"

Instance: ShareablePatientDemographics
InstanceOf: ViewDefinition
Description: """
Creates the same view as the 'PatientDemographics' example, but applies both the
ShareableViewDefinition and TabularViewDefinition profiles.
"""
Usage: #example
* url = "http://example.com/ShareablePatientDemographics"
* name = "patient_demographics"
* fhirVersion[+] = #4.0
* fhirVersion[+] = #5.0
* status = #draft
* resource = #Patient
* meta
* profile[+] = "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ShareableViewDefinition"
* profile[+] = "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/TabularViewDefinition"
* select[+]
* column[+]
* path = "getResourceKey()"
* name = "id"
* type = "string"
* column[+]
* path = "gender"
* name = "gender"
* type = "string"
* select[+]
* forEach = "name.where(use = 'official').first()"
* column[+]
* path = "given.join(' ')"
* name = "given_name"
* description = "A single given name field with all names joined together."
* type = "string"
* column[+]
* path = "family"
* name = "family_name"
* type = "string"

Instance: PatientAddresses
InstanceOf: ViewDefinition
Description: """An example of unnesting patient addresses into multiple
Expand Down
36 changes: 35 additions & 1 deletion input/fsh/profiles.fsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
Invariant: no-collections
Description: """
Tabular view columns must not be collections.
"""
Severity: #error
Expression: "collection.empty() or collection = false"

Invariant: primitives-only
Description: """
Tabular view columns only contain primitive values.
"""
Severity: #error
Expression: "type in ('base64Binary' | 'boolean' | 'canonical' | 'code' | 'dateTime' | 'decimal' | 'id' | 'instant' | 'integer' | 'integer64' | 'markdown' | 'oid' | 'string' | 'positiveInt' | 'time' | 'unsignedInt' | 'url' | 'uuid')"

Profile: ShareableViewDefinition
Title: "Shareable View Definition"
Parent: ViewDefinition
Description: "A Shareable View Definition"
Description: """
A profile for View Definitions intended to be shared between multiple systems. This requires there
be a defined URL, name, and version. Also, each column must have specified type so consuming
systems

Shareable View Definitions often also use the TabularViewDefinition profile, requiring
that the view be shareable and contain only tabular values, as is common in many databases
and analytic tools.
"""
* url 1..1
* name 1..1
* fhirVersion 1..*
* select.column.type 1..1

Profile: TabularViewDefinition
Title: "Tabular View Definition"
Parent: ViewDefinition
Description: """
A profile for View Definitions where each resulting field must contain only a simple scalar value.
This is sometimes referred to as 'CSV Mode', but applies to any system that explicitly constrains its
views or tables to tabluar data.
"""
* select.column obeys no-collections
* select.column obeys primitives-only

This file was deleted.

Loading