Skip to content

Commit

Permalink
Document expectations for column val cardinality
Browse files Browse the repository at this point in the history
  • Loading branch information
jmandel committed Nov 1, 2023
1 parent 8eebb62 commit 24f2421
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions input/pagecontent/StructureDefinition-ViewDefinition-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 24f2421

Please sign in to comment.