Skip to content

Source Value Record Profile

Canonicalhttps://fhir.apps.health/StructureDefinition/nexus-core-source-value-record
Statusdraft · 1.33.0
BaseBasic (constraint)
SourceFSH · JSON

Source values that have no record of their own to sit on: a whole source category this guide does not model, or a value with no resource to carry it. One per patient per source category, coded under the source's namespace, with the values in the nexus-source-value extension. Nothing computes on it. First pass.

FSH

The authored source of truth: resources/StructureDefinition-nexus-core-source-value-record.fsh (edit on GitHub). One FSH file may define several related artifacts.

// StructureDefinition-nexus-core-source-value-record.fsh
//
// Source values with no record to sit on. A source value belongs on the record it describes, in the
// `nexus-source-value` extension. Some have no such record: a whole category of data this guide does
// not model (a source's wellness-program table, say), or a value about the patient that no resource
// here carries. This Basic holds them, one per patient per source category.
//
// THE CODE NAMES THE CATEGORY, NOT A CONCEPT. `code.coding.system` is the source's own namespace,
// `https://fhir.apps.health/source-field/<source>`, and `code` is the source's name for the category.
// It is the same namespace the child urls of the extension use, so a category and its fields read
// as one family. It is not a published code system and is never expanded or validated.
//
// THE SAME RULES AS THE EXTENSION. Nothing computes on it: no search on the values, no decision
// support, no measures. A client that saves it keeps the extension it read.
//
// ⚠ FIRST PASS -- draft. Do not treat the shape as a contract until it leaves draft.

Alias: $NexusCoreSourceValueRecord = https://fhir.apps.health/StructureDefinition/nexus-core-source-value-record

Invariant:     nexus-source-value-record-category
Description:   "The category is coded under the source's own namespace, https://fhir.apps.health/source-field/<source>."
Severity:      #error
Expression:    "code.coding.all(system.startsWith('https://fhir.apps.health/source-field/'))"

Profile:        NexusCoreSourceValueRecord
Parent:         Basic
Id:             nexus-core-source-value-record
Title:          "Source Value Record Profile"
Description:    "Source values that have no record of their own to sit on: a whole source category this guide does not model, or a value with no resource to carry it. One per patient per source category, coded under the source's namespace, with the values in the nexus-source-value extension. Nothing computes on it. First pass."
// DECLARED-ONLY, not universal: Basic carries many unrelated things, and this profile describes
// only the instances that name it in meta.profile.
* ^url = $NexusCoreSourceValueRecord
* ^status = #draft
* ^experimental = false
* obeys nexus-source-value-record-category

// THE effective date for this profile: when the values were recorded here.
* insert EffectiveDate([[created]])

// SMART EXPOSURE FOLLOWS THE TYPE. A SMART scope names a resource type, not a profile, and `Basic`
// is reachable by an app through the App State profile, so this profile declares the same grant
// rather than one it cannot have: read, write and delete. An app holding `basic` write or delete
// scopes can change or remove a source value record, as it can app state; a scope cannot narrow
// that to one profile. Limiting who writes these records (the importer and the gateway, say) is a
// server decision this profile cannot express.
* insert SmartExposed(basic)

* . ^short      = "Source values with no record of their own"
* . ^definition = """
Source values that have no record to sit on: a whole category of source data this guide does not
model, or a value about the patient that no resource here carries. The values are in the
`nexus-source-value` extension, exactly as the source held them. One per patient per source
category.
"""

* extension contains NexusSourceValue named sourceValue 1..1 MS
* extension[sourceValue] ^short = "The category's values, one child per source field"
* extension[sourceValue] ^comment = "Each child url is `https://fhir.apps.health/source-field/<source>/<field>`, under the same `<source>` as `code`."

* code 1..1 MS
* code.coding 1..1 MS
* code.coding.system 1..1 MS
* code.coding.code 1..1 MS
* code ^short = "The source category"
* code ^comment = "`system` is `https://fhir.apps.health/source-field/<source>` (invariant `nexus-source-value-record-category`); `code` is the source's own name for the category. Not a published code system: never expanded, never validated against a terminology service."

* subject 1..1 MS
* subject only Reference(NexusEmrCorePatient)
* subject ^short = "The patient the values are about"

* created 1..1 MS
* created ^short = "When the values were recorded here"
* created ^comment = "For an import, when the import wrote this record. The import's Provenance names the file, the importer and the time."