diff --git a/input/fsh/examples.fsh b/input/fsh/examples.fsh index 7d98be8..1b5a2fa 100644 --- a/input/fsh/examples.fsh +++ b/input/fsh/examples.fsh @@ -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 diff --git a/input/fsh/profiles.fsh b/input/fsh/profiles.fsh index cc58ca0..66ce36b 100644 --- a/input/fsh/profiles.fsh +++ b/input/fsh/profiles.fsh @@ -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 \ No newline at end of file diff --git a/input/pagecontent/StructureDefinition-ShareableViewDefinition-intro.md b/input/pagecontent/StructureDefinition-ShareableViewDefinition-intro.md deleted file mode 100644 index 618d2a7..0000000 --- a/input/pagecontent/StructureDefinition-ShareableViewDefinition-intro.md +++ /dev/null @@ -1,3 +0,0 @@ -A profile of [View Definition](StructureDefinition-ViewDefinition.html) for views that are intended -to be shared across organizations. It adds constraints to the base definition, such as requiring a URL, name, and types for each -column. See the differential table below for details. \ No newline at end of file