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§
- Column
Def - A single generated column on a per-resource-type table.
- Resource
Type Schema - The generated schema for one FHIR resource type’s search table.
- Schema
Registry - All generated per-resource-type schemas, keyed by resource type name.
Enums§
- Column
Type - The PostgreSQL type of a generated value column.
- Param
Columns - 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
unnesttogether.
Functions§
- code_
to_ column_ base - Converts a
SearchParametercodeinto 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.