openEHR Templates: Design, Governance, and the Operational Template Lifecycle
Templates sit one semantic level above archetypes in the openEHR architecture [1]. Where an archetype defines the maximal clinical concept — everything one might ever record about a blood pressure or a medication order — a template constrains a set of archetypes into a specific clinical form or document: a discharge summary, an antenatal visit record, a medication reconciliation screen. Templates do this by removing archetype data items that a use case doesn't need (constraining occurrences to 0..0), mandating items the use case requires, tightening cardinalities, and refining terminology value sets [4]. Templates are the artifact clinical application developers and form builders work with directly — and they are compiled into the Operational Template (OPT), the flattened, definitive machine-usable form consumed by CDR platforms at runtime [2].
Design: Compose Small, Resist the Paper Form
Good template design balances clinical completeness against practical usability, and the design decisions are architectural, not cosmetic: which archetype slots to fill, which data elements to mandate versus leave optional, and how to group sections so the structure matches clinical workflow rather than fighting it.
In our experience, the most common pitfall is the monolithic template that replicates a paper form — a hundred-element structure mirroring a legacy document, where every use case gets its own giant, overlapping template. The stronger pattern is to compose smaller, focused templates around coherent clinical activities and link them, which pays off twice: data captured through focused templates is far easier to reuse and query across use cases, and template maintenance stays local — a change to how vital signs are recorded touches one small template, not every document that embeds vital signs. Mandating elements deserves the same restraint we've argued for FHIR profiles: every element you force to be mandatory excludes every workflow that can't reliably capture it, and in clinical settings those workflows are the rule, not the exception.
The Operational Template: Where Modelling Meets Runtime
The OPT is what turns modelling into infrastructure. Formally, it is a compiled artifact built from the source archetypes and templates — the computational form for operational EHR systems and the starting point for downstream generation of schemas and APIs [2]. Practically, it collects all labels, requirements, and constraints from every contained archetype and sub-template into a single, easily parsed file, which is exactly what allows a CDR to validate incoming compositions against the use case's rules, generate forms and UIs, and resolve AQL queries over archetype paths [3]. Modelling tools such as the Template Designer and Archetype Designer export OPTs, and openEHR's REST API standardizes how they are uploaded to and served by a conformant platform — meaning the OPT, not the source template, is the deployment artifact your operations team actually ships.
Governance: Treat Templates Like Schema Migrations
A template deployed to production defines what data is valid — which makes template change management as consequential as any database schema migration, and deserving of the same rigor. A breaking change to a widely deployed template ripples downstream into stored compositions, AQL queries, integrations, and forms. We recommend a lifecycle with explicit gates:
Template Lifecycle at a Glance
| Stage | Key Activities | Gate to Pass |
|---|---|---|
| Modelling | Select published archetypes (CKM first [5]), design constraints, document intent | Clinical sign-off on content and mandatory elements |
| Build | Generate the OPT from the signed-off source template | OPT compiles cleanly; versioned and stored alongside its source |
| Verification | Integration testing in staging: composition validation, AQL queries, form generation, sample data round-trips | All consumers of the template pass against the new OPT |
| Deployment | Controlled release to production, monitored rollout | Rollback path defined; affected teams notified |
| Change | Classify each proposed change as compatible or breaking; trace impact from source to OPT | Breaking changes trigger the migration analysis below |
Change Traceability and Data Migration: A Clinical Modelling Challenge
The hardest governance question is what happens to existing data when a breaking change ships. In our experience, the change must be analyzed end to end — from its origin (a revised archetype, a new clinical requirement, a terminology update) through the source template to the final OPT — because the semantics of the change determine the migration path. A renamed element, a tightened cardinality, a restructured cluster, and a re-bound value set each imply different transformations of stored compositions, and some imply none at all. This is why data migration in openEHR is not fundamentally a technical problem: it is a clinical modelling challenge, and it needs clinical modellers in the room, not just engineers.
What the openEHR stack changes is the tractability of that challenge. Because the Reference Model, the archetypes, and the templates formally define both the old shape and the new shape of the data, migration can be made a formal, testable, and repeatable process: transformations are specified against explicit models, validated by recompiling migrated compositions against the new OPT, and rerun deterministically across environments. Contrast this with proprietary-schema systems, where the "old shape" often lives partly in application code and tribal memory — and migration correctness is a matter of hope. Model-based data integrity through time is one of the quiet, compounding returns of the openEHR investment.
Where CaboLabs Fits
Template design, OPT lifecycle management, and model-driven data migration are exactly the disciplines CaboLabs has built its openEHR practice around. We help organizations design focused, reusable templates, establish template governance with clinical sign-off and staged deployment, and plan and execute data migrations when breaking changes are unavoidable. Our openEHR-native clinical data repository, Atomik, operationalizes the whole story: templates are deployed at runtime without software releases, every incoming composition is validated against its OPT, and stored data remains queryable through archetype paths across template versions.
If you're defining your first openEHR templates, wrestling with a breaking change to a widely deployed one, or looking for a CDR that treats your clinical models as the source of truth, talk to us at cabolabs.com — we'll help you keep your data valid not just today, but through every model change to come.
