Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Integrations

Query execution, the patient identity source and the three optional integrations: [record.query], [pixm], [record.change_feed], [terminology], [record.multimedia]. Everything except the query knobs and the identity source is off by default, and a disabled integration contacts nothing and mounts no routes. Precedence, the environment-name grammar, and file discovery are on the Configuration reference index.

[record.query]

AQL execution bounds.

[record.query]
plan_cache_capacity = 256
timeout = "30s"
max_result_rows = 10000
KeyTypeDefaultDescription
plan_cache_capacityint256Maximum distinct cached query plans; 0 disables the cache and every lookup runs the full parse-and-lower path. Cache activity is reported by the aql_plan_cache_events counter.
timeoutduration"30s"Per-query database execution budget; "0s" disables it. Overrun is refused 408.
max_result_rowsint10000The largest page one query execution serves: the page of a query nothing else bounds, and the maximum an explicit LIMIT or fetch may ask for (a larger page is refused 400); 0 means unbounded.

timeout is on by default, and deliberately tighter than database.statement_timeout. Keeping this budget the tighter of the two means an overrun surfaces as the engine’s own typed 408 rather than a driver error. When it fires, or when the client disconnects or the HTTP request timeout gives up first, the query’s connection is closed instead of returned to the pool, so its pool slot frees at once and PostgreSQL stops the statement within about a second (the session’s client_connection_check_interval).

max_result_rows is the largest page one execution serves. Without it, SELECT c FROM COMPOSITION c with no fetch generates SQL with no LIMIT and materialises every matching row: one request, unbounded allocation. A query that nothing else bounds takes the ceiling as its page. An explicit AQL LIMIT or a fetch parameter is honoured as written up to the ceiling; a page larger than the ceiling is refused with 400 naming the ceiling. The refusal is deliberate: a silently shortened page would let a client that pages with its own fetch as the stride skip the rows between the shortened page and its next offset, and the RESULT_SET has nothing to say so. ITS-REST leaves both the fetch default and its maximum to the implementation. A bulk consumer pages with offset and a fetch at or below the ceiling, or the operator raises the ceiling deliberately.

[pixm]

Who translates a patient identifier into the clinical domain, so the EHR that records the patient can be found (the EHR index). The EHR itself always says whose record it is: its EHR_STATUS.subject.external_ref names the subject, and FerroEHR finds a subject’s EHR by matching that reference, which it keeps indexed beside the EHR on every EHR create and EHR_STATUS update. No openEHR specification governs where the patient’s other identifiers live: the RM’s PARTY_SELF section says the association “may be done elsewhere for security reasons”, and FerroEHR’s design puts it in an IHE patient identity source.

record.subject_index = "pixm" asks an IHE patient identity source. FerroEHR asks a PIX Manager, as a PIXm Patient Identifier Cross-reference Consumer (IHE ITI TF-2 §3.83, $ihe-pix), which identifier the clinical domain holds for a patient that another domain’s identifier names. That identifier is the pseudonym EHR_STATUS.subject carries. FerroEHR sends only what ITI-83 specifies, so any conformant PIX Manager serves; FerroPIX is the one the compose quickstart and the Helm chart run.

subject_index = "local", with no identity source, is the other supported posture, for production as much as for development, tests and the conformance suites: the subject-id and subject-namespace model. A client names a patient in EHR_STATUS.subject.external_ref by any namespace and identifier (benchmark / 1793131381), as OBJECT_REF.namespace and a local GENERIC_ID.scheme allow, and a subject resolves to itself: the openEHR REST API’s GET /ehr?subject_id=…&subject_namespace=… lookup and a cohort that names its subjects both find the EHR whose EHR_STATUS names the subject, matching namespace and identifier exactly. An EHR created over POST /ehr or PUT /ehr/{ehr_id} is found from the moment it is created, and an EHR_STATUS update that changes the subject moves it. The key has no default: unset, the server refuses to start and the refusal names both choices.

What the local posture means for pseudonymisation: with no [privacy] subject_namespaces declared, the server stores a subject reference as the client sends it, a real identifier included. Pseudonymisation then belongs to the client, or to the demographic service the reference points at (GDPR Art. 4(5)). There is no mixed mode: a deployment that declares pseudonym namespaces keeps the rule in force under local too, so every subject reference must name a declared namespace and carry a UUID, and no other namespace is accepted beside them. A production deployment runs the subject-id posture by accepting the open_subject_namespace gap by name (deployment.profile), which boot and GET /management/status then state.

subject_index alone switches the index, in the file or as FERROEHR__RECORD__SUBJECT_INDEX. A [pixm] table kept beside "local" is not used, and boot names its keys, so a configuration written for the IHE source runs locally with FERROEHR__RECORD__SUBJECT_INDEX=local and no other change; its declared pseudonym namespaces stay in force. The compose quickstart selects its local configuration with one variable (The local EHR index).

KeyTypeDefaultDescription
record.subject_indexenum{pixm,local}requiredWho translates a subject into the clinical domain.
pixm.assigning_authorityURIrequired for pixmThe clinical domain, such as urn:oid:2.999.7.1: the targetSystem of every ITI-83 query and the namespace the answered pseudonym is stored under. It must be one of privacy.subject_namespaces.
pixm.methodenum{post,get}postpost sends a Parameters body, so a patient identifier never appears in a URL or an access log; get is the form ITI-83 prescribes, for a PIX Manager that accepts no POST.
pixm.endpointendpoint tablerequired for pixmThe PIX Manager: url, its FHIR base ([base] of [base]/Patient/$ihe-pix), timeout for one ITI-83 exchange with its tries and the waits between them, the retry of an exchange that got no answer or a 5xx, the TLS and the credential.
[privacy]
subject_namespaces = ["urn:oid:2.999.7.1"]

[record]
subject_index = "pixm"

[pixm]
assigning_authority = "urn:oid:2.999.7.1"

[pixm.endpoint]
url = "https://pix.example.org/fhir"

[pixm.endpoint.credentials.oauth]
token_endpoint = "https://idp.example.org/realms/pix/protocol/openid-connect/token"
client_id = "ferroehr"
client_secret_file = "/run/secrets/pix-client"
scope = "system/Patient.rs"

[pixm.endpoint.credentials.oauth] is the client credentials grant every ITI-83 request carries, with the grant’s keys; a 401 is answered once more under a new token. The client id is the one the identity source mints pseudonyms in the clinical domain for, and the scope is the one its PIX Manager takes from a Consumer. [pixm.endpoint.tls] holds the client’s TLS material for a PIX Manager behind a private PKI or one that asks for mutual TLS.

How a subject a cohort names is resolved:

StepUnder iheUnder local
the subject in the clinical domainits clinical pseudonym, asked of the source; a subject already in the clinical domain names itselfthe subject as given
the EHR of that subjectthe one EHR whose EHR_STATUS names itthe one EHR whose EHR_STATUS names it

The source is never asked to resolve a pseudonym back to another domain’s identifier.

No fallback. At start the server reads the source’s CapabilityStatement and refuses to start when it does not answer. A request the source then fails, refuses or times out on answers with an error that carries what the source said, and nothing is answered from the EHR_STATUS subject instead. An answered pseudonym the [privacy] subject rule refuses, or more than one identifier in the clinical domain, is refused too.

FerroEHR does no identity work in either mode. It matches no patients, merges none and links no identifier domains; the identity source does. It asks only for the cross-reference ITI-83 answers. PDQm (ITI-78) is not used: its search answers with the demographic Patient, which FerroEHR would only discard, so asking for it breaks data minimisation (GDPR Art. 5(1)(c)), and its $match is patient matching.

[record.change_feed]

The commit-event outbox and its cursor feed. Off until a reader is granted: a reader is the reader element of a read_change_feed grant in the CDR, not a key (Operational policy). The envelopes are PHI-free by design. The feed, its routes and its scope are on Change events (outbox feed).

KeyTypeDefaultDescription
retentionduration"7d"How long an acknowledged row is kept after its commit; at least a second.
prune_intervalduration"1h"How often the retention prune runs; never "0s".

[terminology]

The one FHIR terminology server the CDR asks; the table’s presence turns it on. The terminology extension API is api.terminology (bool, false).

KeyTypeDefaultDescription
endpointendpoint tablerequiredThe server: url, its FHIR R4B base URL (for FerroTERM http://ferroterm:8080/r4b; a [terminology] table without it is a boot error), timeout for one call, the retry of a call that got no answer or a 5xx, the TLS and the credential.
on_errorenum{accept,refuse}acceptWhat an unresolvable binding does to a commit: accept accepts it (fail-open), refuse rejects it.

Every key is a scalar, so the whole section is reachable through the environment: FERROEHR__TERMINOLOGY__ENDPOINT__URL, FERROEHR__TERMINOLOGY__ON_ERROR, FERROEHR__TERMINOLOGY__ENDPOINT__TIMEOUT.

[terminology]
on_error = "accept"

[terminology.endpoint]
url = "http://ferroterm:8080/r4b"

The server answers every terminology the bundled openEHR terminology does not carry: the /terminology/* extension API, AQL TERMINOLOGY(…) resolution, the ADL 2 binding check and the composition-commit binding checks below. A response that is not a valid FHIR R4B Parameters or ValueSet resource (for example an $expand result missing the required ValueSet.status or expansion.timestamp) is treated as an upstream fault rather than partially read, so it takes the same path as an unreachable server and on_error decides what the commit does.

Note

The terminology server needs the fhir build feature, which is on in the published binary and container images. A binary built with --no-default-features refuses at startup if [terminology] is configured; the in-process openEHR terminology bundle remains available.

The endpoint table

Every outbound HTTP integration, [terminology.endpoint], [pixm.endpoint] and [audit.fhir_feed.endpoint], is the FerroHEALTH family’s one endpoint table, so an operator writes the same keys for each integration of each product. Each integration’s client is built from it by ferrohealth-smart’s outbound client, the one every product of the family uses.

KeyTypeDefaultDescription
urlURLrequiredThe service’s base URL. Credentials embedded in it are masked in every rendering, and a credential here beside one in credentials is a boot error: the service would receive two authorizations.
timeoutduration"10s"How long one whole call may take; never zero.
connect_timeoutdurationunsetHow long opening the connection may take; unset, only timeout bounds it.
retrytablethree attempts, a fifth of a second doubling to five secondsHow a call that got no answer, or a 5xx, is tried again: max_attempts (3) counts the first try, so 1 never retries; the wait starts at initial_backoff and doubles up to max_backoff ("5s"). A refusal the service answered on purpose is never retried.
tlstableplatform rootsThe family’s outbound TLS table: trust_roots_file, a PEM bundle trusted beside the platform’s roots for a service behind a private PKI; client_identity_file (or client_identity inline), one PEM holding the client certificate chain and its key for mutual TLS; and min_version ("1.3", or "1.2").
credentialstablenoneWhat every call carries: HTTP Basic (user with password or password_file) or the OAuth2 client-credentials grant [...credentials.oauth], never both.

The grant’s access token is cached and re-requested shortly before it expires, and a call the service answers with 401 is sent once more under a new token. Its keys:

KeyTypeDefaultDescription
token_endpointURLone of token_endpoint and issuerThe OAuth2 token endpoint. Credentials embedded in it are masked in every rendering.
issuerstringone of token_endpoint and issuerThe issuer whose metadata names the token endpoint (RFC 8414).
client_idstringrequiredThe registered client identifier. Empty is a boot error.
client_secret / client_secret_filesecret / pathone is requiredThe client secret, inline or read from a mounted file.
client_authenum{client_secret_basic,client_secret_post,private_key_jwt,tls_client_auth,self_signed_tls_client_auth}client_secret_basicHow the client authenticates at the token endpoint.
scopestringunsetThe scope request parameter.
audiencestringunsetThe audience request parameter some authorization servers read.
resourceURLunsetThe RFC 8707 resource request parameter.
private_key_filepathunsetThe PEM private key that signs the client assertion under private_key_jwt (RFC 7523).
kidstringthe RFC 7638 thumbprintThe kid the client assertion names.
assertion_algstringby key typeThe algorithm the client assertion is signed with.
assertion_audienceenum{token_endpoint,issuer}token_endpointThe aud of the client assertion; issuer needs issuer set.
tlstableplatform rootsThe token endpoint’s own TLS table, with the keys above.
refresh_marginduration"30s"How long before the token expires a new one is fetched.
timeoutduration"10s"How long one call to the authorization server may take.
[terminology.endpoint.credentials.oauth]
token_endpoint = "https://idp.example.org/realms/ts/protocol/openid-connect/token"
client_id = "ferroehr-cdr"
client_secret_file = "/run/secrets/ts-client"
scope = "system/*.read"

Archetype value-set bindings at commit

With [terminology] enabled, committing a COMPOSITION also resolves the archetype constraint bindings its template declares: where a template binds an ac code to an external terminology query, the coded value in the composition must be a member of the value set that query returns.

  • The code is in the value set → the commit proceeds.
  • The code is not in the value set → 422 naming the path, the code, and the bound query. That is a real constraint violation, not a service failure, so on_error does not change it.
  • The value set could not be resolved (server down, error response, unknown value set) → on_error decides: false (the default) accepts the commit and logs a warning; true rejects it with 422.

With [terminology] disabled (the default) no binding is resolved and no request is made, so commit behaviour is exactly as if this section did not exist.

Note

The composition’s terminology_id is sent verbatim as the FHIR system parameter, and no openEHR specification defines a mapping between terminology_id values (SNOMED-CT) and FHIR system URIs (http://snomed.info/sct). If your archetypes and your terminology server disagree, align them in the terminology-server configuration; the CDR does not rewrite the value.

[record.multimedia]

DV_MULTIMEDIA externalization to an S3-compatible object store. Off by default: blobs stay inline, byte-identical, and no object store is built or contacted. The table keeps enabled where other optional features use the table’s presence, because url applies while it is off: the blobs already offloaded are read back from it.

KeyTypeDefaultDescription
enabledboolfalseExternalize large multimedia data.
thresholdsize"256KiB"Decoded size strictly above which data is offloaded; at or below it stays inline.
urlsecret URLunset ⇒ default AWS endpoint resolutionS3-compatible endpoint. Must be an absolute http/https URL when set; an http:// URL is plain HTTP, development only, which production names as the plaintext_object_store gap. Credentials embedded in it are redacted from every rendering.
bucketstringopenehr-multimediaTarget bucket for content-addressed blobs.
regionstringus-east-1AWS region; S3 requires one even for non-AWS endpoints.
access_key_idstringunsetS3 access key id. Unset, with no secret key either, runs the client anonymously.
secret_access_key / secret_access_key_filesecret / pathunsetS3 secret access key. At most one of the pair.

An enabled integration whose url is set but blank, not an absolute URL, or carries a scheme other than http/https is a boot error. That case is easy to reach by accident (an unset Compose variable expanding to nothing, or an empty Helm value) and used to boot cleanly and then fail on the first multimedia commit, so it is refused where an operator can still act on it.

Warning

Offloaded blobs are PHI. The bucket must be private and encrypted, and reached over HTTPS. Multimedia externalization also needs the multimedia build feature (on in the published binary and container images); a slim build refuses at startup rather than silently keeping blobs inline.