Expand description
Resolving a search parameter’s FHIRPath expression against the
StructureDefinition snapshots, to learn whether it can yield more than
one value.
A parameter that yields at most one value can be stored as a scalar column, which is what lets an index answer an ordered comparison, a prefix match or a sort. One that can yield more cannot.
The answer is given per (parameter, resource type), because most shared
base parameters are a union with one branch per type —
AllergyIntolerance.patient | … | Observation.subject.where(resolve() is Patient) | … — and a resource only ever takes its own branch. Judging the
union as a whole would let one repeating branch (DocumentReference’s
encounter) deny a column to every other type.
Each branch is reduced to a plain dotted path — Patient.birthDate,
Patient.name.family — and resolved against the schema, so the answer is
exact and needs no sample data. A where() filter is dropped from the path,
because a filter can only remove values; an ofType() or as cast narrows
the leaf to the cast’s type. Anything else — an index accessor, a function
the walk cannot see through — leaves the branch unanswered, and the
parameter repeating for that type.
Note what this deliberately does not answer. Cardinality is the count of
values the expression selects, not the count of index entries they
become: Observation.code selects one CodeableConcept, which fans out to
one token per coding. Callers have to combine repeats with the leaf type’s
fan-out, which is why [ResolvedPath::leaf_type] is reported alongside.
Structs§
- Resolved
Path - Snapshot
Index - The snapshots a path is resolved against, keyed by the type they define.
Enums§
- Path
Analysis - What walking a path against the snapshots established.
Constants§
- FANNING_
OUT_ TYPES - Datatypes whose conversion to index values emits more than one entry for a single value, so a path that selects exactly one of them still produces several index entries.
Functions§
- analyze_
path - Walks a plain dotted path through the snapshots, segment by segment.
- generate_
lookup - Emits the Rust source for the compiled lookup table.
- is_
single_ valued_ for - Whether a parameter produces at most one index entry for a resource of
type
base. - load_
definitions - Reads every
StructureDefinitionunder the given files or directories, following the same JSON-file walk the other generators use. Bundles are unwrapped, so aprofiles-resources.min.jsoncan be passed directly. - load_
search_ parameters - Reads every
SearchParameterunder the given files or directories.