Skip to main content

Module sof

Module sof 

Source
Expand description

SQL-on-FHIR support for storage backends.

The ViewDefinition → SQL pipeline:

  1. irPlanNode tree and value types (LitValue, Expr, …).
  2. compile_path — FHIRPath expression → Expr lowering.
  3. compile_view — ViewDefinition JSON → PlanNode (build_plan).
  4. dialectSqliteDialect / PgDialect implementations of the Dialect trait (JSON accessors, parameter syntax, etc.).
  5. emitPlanNode → parameterised SQL (emit_plan).
  6. compiler — public façade combining build_plan + emit_plan into compile_view_definition_dialect, the entry point used by the runners.

Backend runners:

  • sqliteSqliteInDbRunner (SQL) for SQLite.
  • postgresPgInDbRunner (SQL) for PostgreSQL.
  • mongodbMongoInDbRunner (aggregation pipeline) for MongoDB.
  • in_processInProcessSofRunner, a backend-agnostic runner that evaluates the view with the helios-sof engine over scanned resources (used by S3 / S3-primary composites, which have no query engine).

Inline resource: parameters on $viewdefinition-run are handled by the REST layer via the in-process helios-sof FHIRPath evaluator, so this module does not need a per-backend inline runner.

Modules§

compile_path
FHIRPath expression → SqlExpr compiler.
compile_view
ViewDefinition JSON → PlanNode compiler.
compiler
ViewDefinition compiler (SQLite/PostgreSQL SQL and MongoDB pipelines).
dialect
Dialect trait — token-level SQL emission for PostgreSQL JSONB and SQLite JSON1.
emit
Lowers IR (PlanNode/SqlExpr) to a concrete SQL string for a given Dialect.
emit_mongo
MongoDB aggregation-pipeline emitter for the SQL-on-FHIR compiler.
in_process
Generic in-process SQL-on-FHIR runner.
ir
Intermediate representation for the FHIRPath → SQL compiler.
mongodb
MongoDB in-DB SQL-on-FHIR runner.
postgres
PostgreSQL in-DB SQL-on-FHIR runner.
sqlite
SQLite in-DB SQL-on-FHIR runner.
sqlite_udfs
SQLite scalar UDFs registered for the in-DB SOF runner.