Expand description
ViewDefinition compiler (SQLite/PostgreSQL SQL and MongoDB pipelines).
Thin façade over the IR-based pipeline:
build_planwalks the ViewDefinition JSON and produces aPlanNodetree plus the resolvedViewDefinition.constant[]values. TheCompileTargettunes target-specific lowering (e.g. trailing-[N]forEach).- The emitter lowers the plan to the target form:
emit_planfor SQL via theDialecttrait, oremit_mongofor a MongoDB aggregation pipeline.
Returns SofError::Uncompilable for FHIRPath constructs the in-DB
pipeline doesn’t yet handle (e.g. where(crit) chains, the boundary
functions without a column type hint, deeper unionAll/repeat nesting).
There is no in-process fallback — the REST handler maps these errors
to 422 Unprocessable Entity.
Structs§
- Compiled
Pipeline - Output of compiling a ViewDefinition to a MongoDB aggregation pipeline.
- Compiled
Query - Output of a successful ViewDefinition compilation.
Enums§
- Compile
Target - Backend a ViewDefinition is being compiled for. Drives target-specific
lowering decisions in
build_plan(e.g. whether trailing-[N]forEach paths may use a correlated subquery) and selects the emitter. - Compiled
View - Compiled SQL-on-FHIR view, in the form the target backend executes: parameterised SQL, or a MongoDB aggregation pipeline.
- SqlDialect
- SQL dialect to target during compilation.
Functions§
- compile_
view_ definition - Compiles a raw ViewDefinition JSON value into a
CompiledQueryfor SQLite. - compile_
view_ definition_ dialect - Compiles a raw ViewDefinition JSON value into a
CompiledQueryfor the given dialect. - compile_
view_ definition_ mongo - Compiles a raw ViewDefinition JSON value into a MongoDB aggregation pipeline.