Skip to main content

Module schema

Module schema 

Source
Expand description

Per-resource-type table schema generation for the hybrid PG search backend.

The PG backend mirrors the Elasticsearch split: HL7 base (system-level) search parameters get dedicated, type-specific columns on a table named after the resource type (search_patient, search_observation, …), while project-level (tenant custom) parameters share the EAV search_dynamic_* tables keyed by param_url.

Every value column is an array, since a single resource can produce many values for one parameter. Multi-part types (token, date, reference, quantity) use parallel arrays: index i of each column belongs to the same logical value, which lets queries recombine them with unnest(a, b) WITH ORDINALITY.

Structs§

ColumnDef
A single generated column on a per-resource-type table.
ResourceTypeSchema
The generated schema for one FHIR resource type’s search table.
SchemaRegistry
All generated per-resource-type schemas, keyed by resource type name.

Enums§

ColumnType
The PostgreSQL type of a generated value column.
ParamColumns
The set of columns backing one search parameter, grouped by the role each column plays. Query builders match on this to know which columns to unnest together.

Functions§

code_to_column_base
Converts a SearchParameter code into a safe PostgreSQL column base name: lowercased, with every character outside [a-z0-9_] folded to _.
generate_schemas
Derives per-resource-type table schemas from the system-level search parameters.
resource_type_to_table
Converts a FHIR resource type name into its search table name.