From 24f242165f7a41ee605bb885b0391d8fae9143c1 Mon Sep 17 00:00:00 2001 From: Josh Mandel Date: Wed, 1 Nov 2023 10:37:29 -0500 Subject: [PATCH] Document expectations for column val cardinality --- .../StructureDefinition-ViewDefinition-notes.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/input/pagecontent/StructureDefinition-ViewDefinition-notes.md b/input/pagecontent/StructureDefinition-ViewDefinition-notes.md index 65ae519..420f7bc 100644 --- a/input/pagecontent/StructureDefinition-ViewDefinition-notes.md +++ b/input/pagecontent/StructureDefinition-ViewDefinition-notes.md @@ -497,6 +497,9 @@ that any `unionAll` branches produce the same columns. * `S`: a Selection Structure * `N`: a Node (element) from a FHIR resource +**Errors** +* Multiple values found but not expected for column + **Emits:** One output row at a time **Purpose:** This step will take sets of "partial rows" (i.e., sets of incomplete column bindings from the various clauses of `V`) and combine them to emit complete rows. For example, if there are two sets of partial rows: @@ -523,8 +526,12 @@ Then the Cartesian product of these sets consists of four complete rows: 2. For each element `f` of `foci` 1. Initialize an empty list `parts` (each element of `parts` will be a list of partial rows) 2. Process Columns: - * For each column `col` of `S.column` - 1. Define `b` as a row whose column named `col.name` takes the value `fhirpath(col.path, f)` + * For each column `col` of `S.column`, define `val` as `fhirpath(col.path, f)` + 1. Define `b` as a row whose column named `col.name` takes the value + * If `val` was the empty set: `null` + * Else if `val` has a single element `e`: `e` + * Else if `col.collection` is true: `val` + * Else: throw "Multiple values found but not expected for column" 2. Append `[b]` to `parts` * (Note: append a list so the final element of `parts` is now a list containing the single row `b`). 3. Process Selects: