Quickstart
After installing, you need a ViewDefinition. Save this as
patient_view.json:
{ "resourceType": "ViewDefinition", "name": "patient_names", "resource": "Patient", "select": [ { "column": [ { "name": "id", "path": "id" }, { "name": "gender", "path": "gender" }, { "name": "family", "path": "name.first().family" } ] } ]}Run a view over FHIR data — no database
Section titled “Run a view over FHIR data — no database”Point run at a ViewDefinition and some resources (--input takes an NDJSON
file, a Bundle, a JSON resource/array, a directory, or - for stdin):
octofhir-sof run patient_view.json --input patients.ndjsonid,gender,familypt-1,female,Chalmerspt-2,male,LevinChoose the output format with --output csv|ndjson|json (parquet with the
Parquet feature). Streaming NDJSON in and NDJSON out runs in bounded memory:
cat export/*.ndjson | octofhir-sof run patient_view.json --input - --output ndjsonRun every view in a directory in one pass, one output file per view:
octofhir-sof run views/ --input data/ --output csv --out out/Generate SQL
Section titled “Generate SQL”generate emits a PostgreSQL JSONB SELECT by default, or DuckDB JSON with
--dialect duckdb:
octofhir-sof generate patient_view.json # PostgreSQLoctofhir-sof generate patient_view.json --dialect duckdb # DuckDBOr a CREATE TABLE for the view’s columns (--ddl, dialect ansi | postgres
| duckdb):
octofhir-sof generate patient_view.json --ddl --dialect postgresSee SQL dialects for the differences.
Validate (offline, no package)
Section titled “Validate (offline, no package)”validate checks the ViewDefinition’s structure against the spec — SQL-safe
names, one iteration construct per select, unique column names, consistent
unionAll branches:
octofhir-sof validate patient_view.jsonoctofhir-sof validate patient_view.json --sarif > results.sarifSchema-driven linting checks selectors against a FHIR package; --shareable
checks the portable FHIRPath subset (offline, no package needed):
octofhir-sof lint patient_view.json --package hl7.fhir.r4.coreoctofhir-sof lint patient_view.json --shareableBrowse every rule in the rule reference, or read the linting guide.
Exit codes
Section titled “Exit codes”0 on success · 1 on validation errors, lint errors, test failures, or I/O
errors.