Templates & EHRs
Templates holds the operational templates the CDR validates compositions against, and EHRs opens every EHR with its compositions, directory, status, contributions and tags.
Templates
The list has a tab per family, ADL 1.4 and ADL 2, each with its count,
a find field over id, concept and archetype, and a row per template with
Build a query and Delete… in its menu. The releases of one template
share a group: the newest release leads with the number of releases, and the
earlier releases follow under it, each its own row. Releases belong together
when their ids differ only in the .v version at the end; an ADL 1.4
template whose id has no version joins the templates with the same concept
and root archetype.
Uploading a template
Upload a template opens an editor for one source: choose or drop a file
(.opt or .xml for ADL 1.4; .adl, .adls, .adlt, .adl2 or .txt for ADL 2; up to 16 MiB) or
paste the source, then Upload this template. The CDR validates it; a
refusal keeps the source on the page beside the CDR’s diagnostics, for ADL 2
the openEHR-ADL engine’s own words. With JavaScript off, paste the source.
A template
An ADL 1.4 template’s page has five tabs, and a sixth, Compare, when it has more than one release. Overview reads its identity, its releases with the number of compositions committed against each, and how to query it. The release you are reading is named beside the title; with more than one release it opens a list of the others, the newest marked, each a link that works with FerroUI’s scripts refused too.
Paths is its Web Template as a tree: pick a node to read its path, type and codes, and on a COMPOSITION template Build a query on this path. A demographic template’s nodes offer no query, since the query builder reads compositions. With FerroUI’s scripts loaded the tree folds in place and answers the arrow keys; without them each node is a link.
Source is the template as stored, with line numbers and Copy; Download in the More menu saves it as a file. Example is the composition the CDR generates for it, in the format, type and detail you pick.
ADL 2 shows the ADL 1.4 template converted to ADL 2, as the CDR converts
it (GET {ext}/definition/template/adl1.4/{template_id}/adl2): one ADL 2
archetype per archetype root the template embeds, the top root first, each
with the conversion’s notes, what it dropped or changed, and its source, then
the slot fills that joined the roots. The conversion only reads; nothing is
stored. See Archetypes for the archetypes themselves.
Compare reads two releases, the one you are reading and the one before it unless you choose others, and lists each path the later release adds, removes or changes, with what it was and what it is.
ADL 2 templates
An ADL 2 template’s page opens on its latest release, and the JSON tab beside
Source shows the OperationalTemplateV2 document. An older release opens on
its Overview, says which release you are reading, and links back to the
latest.
A template whose archetypes the CDR no longer holds says so on every tab, names each missing archetype and links to uploading them. Its Paths, JSON and Example tabs stay empty until the archetypes are back.
Deleting a template
Delete… in a row’s menu opens the template with the confirmation inline; on the template’s page it opens a dialog. The CDR refuses while compositions use the template, and deleting needs its ADMIN role; either refusal arrives in the CDR’s words.
EHRs
The list shows every EHR the CDR holds, newest first, and finds one by its subject id and namespace. The subject is shown masked.
New EHR creates one with its status: an optional subject (an id the CDR keeps without reading it, and its namespace) and an optional EHR id; leave the id empty and the CDR mints a UUID. An id that is no UUID is refused before anything is sent; an id the CDR already holds is refused with a link to that EHR.
An EHR
An EHR’s page names it, its subject masked until you press Reveal (with JavaScript off the reveal is a link), and its Queryable and Modifiable badges, on every tab. A revealed subject hides again after the time set in Your preferences (30 seconds unless you change it). New composition and More (Commit several changes, Create the directory, Copy EHR id, Delete EHR…) sit in the header.
The tabs:
- Compositions: the EHR’s compositions, filtered by composer, template and start date; the filters stay in the address.
- Directory: the folder tree, Show one folder by path, and the directory’s versions with Restore… on each older one. Edit opens the editor: add, rename and remove folders and add references to the EHR’s compositions; nothing reaches the CDR until you save. Older versions reads further back than the newest ten.
- Status: the current
EHR_STATUSand its versions; Edit status sets Queryable, Modifiable and the other details as one new version. - Contributions: the contributions per day over the last 30 days and every contribution, each opening its versions.
- Tags: every tag in the EHR, on a composition or on the EHR status, by key and value; a row opens the object it tags.
Every save names the version it supersedes (If-Match). A save over a
version someone else replaced meanwhile is refused with the CDR’s 412, and
the editor offers to reload the newer version.
Deleting an EHR
Delete EHR… asks for the first eight characters of the EHR’s id, then removes the EHR and everything in it; it needs the CDR’s ADMIN role.
Archiving an EHR
While the CDR’s admin API is on, the EHR’s More menu offers Archive… and
Restore from the archive… (POST {ext}/admin/archive/ehrs and
…/ehrs/restore, see Admin & messaging APIs →
Archiving). Each asks for
confirmation. An archived EHR moves to the cold tier with all its content: it
stays readable by its id, here and over the API, but it leaves every AQL
result, so it disappears from the EHRs list and from queries until it is
restored. Both need the CDR’s ADMIN role; a refusal, such as an EHR the CDR
does not hold, is shown in the CDR’s words.
EHR Extracts
Export as EHR Extract in an EHR’s More menu downloads the EHR as the CDR
exports it (GET {ext}/message/export/{ehr_id}): a JSON list holding one
EXTRACT with every versioned object of the EHR, latest versions only, saved
as ehr-extract-<ehr_id>.json. Import EHR Extract in the EHRs list’s
More menu takes an extract, JSON or XML, chosen, dropped or pasted, and
imports it as a new EHR (POST {ext}/message/import), under the EHR id you
give or else under the one the extract carries. A file the viewer exported
imports as it is. A success opens the imported EHR; a refusal, such as an EHR
id that exists already, stays on the page in the CDR’s words. See EHR
Extract & messaging.
Committing several changes at once
Commit several changes builds one contribution: stage a new composition, an amended one or the EHR status, each with its document in an editor of its own, as many as you need, then commit them together with a description. The CDR takes all of them or none: a refused change keeps every staged change on the page beside the CDR’s words.
Compositions
A composition’s page has four tabs. Reading shows it as a person reads it, label and value, by section.
Document shows it in the format you pick (JSON, XML, FLAT or STRUCTURED),
as the CDR converts it. Versions lists every version and reads the
VERSIONED_COMPOSITION and the chosen version’s envelope; At a time opens
the version that was current then. The envelope names the kind of the
version’s signature (a SHA-256 digest, or an OpenPGP signature with its
algorithm, such as ML-DSA-65+Ed25519) and shows the signature as stored, with
the version’s attestations beneath it: who attested, when, why and what. The
CDR checks the signature when it serves the version; see
Version signing. Tags lists the composition’s tags and
sets or removes one; a tag stays on the composition across its versions and
commits no version.
Edit as a new version opens the document in an editor; the save writes the next version. Delete composition… marks it deleted with a new version; its versions stay readable and it leaves the EHR’s list.
Justified and emergency access
For clinicians opening a record outside their care relationships.
When FerroEHR refuses a read because the access rests on a justification of
the access policy and states no reason (refused-reason-missing), the
refusal is followed by Open this record on a justification. Choose a
purpose of use from the list GET /ferroehr/rest/extensions/v1/access/purposes
answers and give your reason in your own words, 1 to 1000 characters. The
access policy decides, by the purpose, whether this is a justified or an
emergency access; the viewer only states it. What a justification lifts and
what it never lifts is on
Access control in detail.
The justification holds for that one record for 15 minutes, until you choose End now in the notice above the page, or until you sign out. While it holds, every call the viewer makes to draw that record’s pages carries the purpose in the purpose header and the reason, percent-encoded, in the reason header the purposes route names. The reason is kept in the viewer’s server-side session and nowhere else, and the person reads it in their access log.