For the separate agent workspace in Semantic Studio, see Agent Studio: versioned sandbox configuration, tool permissions, execution tests and history.
Governed Workflow Designer and Rich Native Form Studio
The planned Workflow Designer and Rich Native Form Studio would let administrators build reusable operational forms and connect them through stages, transitions, queues, assignments, approvals, timers, escalations, clinical-form launches, and approved integrations. The following design requirements describe that target; later sections cover the existing template and form tools.
Strict semantic separation
| Field or stage class | Purpose | Persistence rule |
|---|---|---|
NATIVE | Operational capture such as collection, transport, assignment or checklist state. | Remains in the native submission and operational workflow record. |
TRUSTED_CONTEXT | Authenticated patient, encounter, practitioner, facility, tenant and workflow context. | Read-only provenance supplied by AMCDR; ordinary fields cannot override it. |
CLINICAL_CONTRIBUTION | Context passed to a later governed clinical form. | Does not become an authoritative clinical fact by itself. |
OPENEHR_BOUND | A field derived from an exact approved template constraint. | Can participate only in an explicitly approved and runtime-validated composition effect. |
Every native form stage declares one mode: native only, contribute to a later clinical step, launch a governed clinical form, create a composition, or version an identified composition. Creation and versioning require the exact template version and checksum, compatible datatype/cardinality/terminology mappings, complete mandatory targets, clinical approval and runtime openEHR validation. AMCDR never destructively overwrites composition history.
Workflow capabilities
- Human-form, governed clinical-form, approval, review, service-action, integration, wait, timer, decision, parallel split/join, subprocess and terminal stages.
- Role, queue, team, individual, facility and controlled rule-based assignment, with claim, delegation, reassignment, due date and escalation history.
- Typed transition guards and calculations using a deterministic, resource-bounded expression model; arbitrary JavaScript, SQL, Python, shell commands and user-supplied executable code are prohibited.
- Allow-listed, typed effects for native persistence, tasks, clinical-form launch, composition creation/versioning, notifications, reports, domain events and approved connectors.
- Durable timers, explicit parallel tokens and joins, optimistic locking, idempotency keys, transactional outbox delivery, bounded retries and a visible exception queue.
- Responsive and accessible form/runtime presentation, localisation, autosaved drafts, synthetic preview and role/context simulation.
Immutable versions and publication governance
The design requires published form, mapping, and workflow versions to be immutable, with stable keys and checksums. Instances stay on their starting version. Changes are classified as patch-compatible, backward-compatible, migration-required, or new-instances-only. Moving active instances requires an approved migration plan covering stages, tokens, submissions, assignments, timers, and pending effects, with a dry run and a record of each result.
Publication is blocked until schema and graph validation, dependency resolution, route determinism, permission and assignment checks, openEHR mapping coverage, sensitive-data policy, synthetic tests, accessibility checks, compatibility analysis and required operational, clinical, privacy, security and integration approvals pass. High-risk clinical publication uses separation of duties. Emergency suspension prevents new starts without deleting active-instance history.
Security and production operation
The runtime revalidates all permissions, patient-access policy, tenant scope, rules, mappings, terminology and template constraints; browser validation is advisory. New workflow tables and queries require tenant-scoped database enforcement and cross-tenant denial tests. Attachments use approved document/object storage with MIME inspection, malware scanning, checksum, encryption, access control, retention and quota enforcement—not unbounded JSON or database blobs. External effects can reach only server-managed, approved destinations and must be safe to retry.
Operational metrics cover instance completion, stage duration, overdue tasks, escalations, validation failures, effect retries, dead letters, mapping failures, migrations and version adoption. Correlation and causation identifiers join workflow, audit, outbox and connector evidence without placing patient values in logs or metrics.
Delivery and acceptance sequence
- Deliver immutable schemas, lifecycle, RBAC, tenant isolation and audit.
- Deliver the metadata-driven native runtime renderer and versioned submissions before drag-and-drop authoring.
- Add typed rules, terminology fields, responsive behavior and accessibility.
- Add Native Form Studio authoring, preview, comparison and publication.
- Add workflow runtime tasks, timers, transitions, concurrency controls, outbox and observability.
- Add the visual workflow graph and equivalent accessible outline.
- Add governed clinical-form stages and openEHR mapping validation and preview.
- Enable explicit composition effects only after clinical-safety acceptance.
- Add signed/checksummed import/export, environment promotion, compatibility analysis and instance migration.
- Pilot a bounded operational workflow and Laboratory native stages before wider adoption.
The detailed design is in docs/AMCDR_Governed_Workflow_Designer_Implementation_Specification.md. Its delivery sequence includes the clinical, privacy, security, regulatory, operational, and recovery reviews required before deployment.
Responsive Studio workspace
Open Semantic Studio → Designer to work on the selected template. The form is the main workspace. Use the bottom tools for Add fields, Structure, Field settings, Form setup, Rules & data and Review. One tool opens at a time. On small or short screens, tools open as a separate view; choose Back to form to return to the canvas with your selection and edits retained.
Choose Edit on a field to change its label, help text, widget or presentation. Detailed template paths remain available under Advanced data binding. Use Preview to inspect the form and Save draft to save your work. Review & publish opens local design checks before publication. Editing after a successful check requires checking the updated form again. These browser checks do not replace server validation or clinical review.
Studio navigation becomes a selector when tabs cannot fit. In Templates, open View to inspect a template and use Back to template library to return to the list. Mapping panels and binding forms stack as space narrows; wide tables scroll within their own area.
Template-first flow
- Upload or register an openEHR template.
- Inspect the extracted semantic node catalog.
- Drag template fields into a form layout.
- Configure field properties: label, widget, required/read-only/hidden state, layout span, help text, default expression, terminology lookup, and foundation binding.
- Bind coded fields to built-in coding sets, remote terminology servers, static values, or template-derived terminology bindings.
- Preview and publish the form under an appropriate service module.
- Bind published forms to workflow steps and foundation projections when the composition is intended to drive operational state.
Use Workflow Foundation Bindings for the operational projection matrix covering admissions, transfers, discharge, NICU, labour, emergency arrival, death documentation, birth workflows, monitoring, and HMIS follow-up.
Clinical persistence contract
A published AMCDR clinical form is an openEHR capture surface. Clinical values must bind to fields in the selected template and are committed as a versioned openEHR composition. PostgreSQL workflow tables may retain identifiers, state, queues, and rebuildable projections, but they are not a parallel clinical record. Presentation-only labels do not persist; foundation-only fields become composition context; a foundation binding applied to a clinical template field prefills that field while the value still persists at its template path.
Semantic Studio records this boundary in the governed form contract. Publication declares openEHR_composition as canonical owner, requires template bindings for clinical fields, classifies operational projections as rebuildable, and prohibits silent application-table persistence of clinical facts.
Encounter and episode context
Every form declares one context policy: encounter required, encounter optional, clinical episode required, or longitudinal patient record. An episode-required form also declares its episode type, such as pregnancy or oncology. Designers can restrict permitted encounter types and statuses and can explicitly govern late documentation.
At runtime AMCDR resolves the patient, EHR, encounter, visit, and episode, checks that they belong to the same patient and tenant boundary, and issues a short-lived signed form-context token. Composition submission revalidates that token. Amendments preserve the original composition context instead of inheriting whichever encounter happens to be open later.
POST /forms/antenatal-assessment/runtime-resolution
{
"patient_id": "...",
"ehr_id": "...",
"encounter_id": "...",
"episode_id": "pregnancy-2026-02"
}
Governed cross-form derivations
Cross-form derivations resolve canonical values from earlier openEHR compositions. A rule declares the source template and path, current-encounter/current-episode/latest-patient scope, condition, target field, result policy, missing-data behaviour, and clinician override boundary. Semantic Studio includes a rule simulator before publication.
{
"id": "a7-to-b1",
"source_template_key": "form-a-template",
"source_path": "form_a.a7",
"scope": "latest_patient_record",
"operator": "equals",
"compare_value": 2,
"target_field_id": "field-b1",
"target_path": "form_b.b1",
"result_mode": "constant",
"result_value": 6,
"override_policy": "locked"
}
The resolved target value is saved only when Form B is committed. Its provenance records the derivation rule, source template, source composition UID and version, source encounter or episode, resolution time, and override policy. Existing signed compositions are never mutated by a derivation.
Selection-first clinical capture
Semantic Studio can govern each field as automatic, selection preferred, selection required, or manual. Candidate values can come from template constraints, terminology and value sets, foundation context, and prior openEHR compositions. Coded fields use dropdowns or terminology search; foundation identifiers resolve from the active workflow context; recent clinical values are presented as a dedicated recorded-value selector.
Previous-value reuse is deliberately configurable. A designer may offer choices without prefill, prefill the latest value, or prefill only when exactly one prior value is available. History can be limited to the current encounter, current clinical episode, or longitudinal patient record. AMCDR retains the selected source composition and version in submission provenance. This reduces repetitive typing without silently treating an old observation as a new clinical fact.
Use selection required with manual fallback disabled for governed enumerations. Use selection preferred when the clinician may need to record a legitimate value that is not yet present in the proposed choices. Narrative findings remain free text only where the openEHR template requires narrative content.
Templates And FHIR Mapping
FHIR StructureDefinitions describe exchange payloads; openEHR templates describe the canonical clinical record that AMCDR stores. When FHIR data must become canonical clinical data, create a transformation map that links FHIR profile paths to template field keys. See FHIR Mapping and SDs for profile import, mapping examples, ingest APIs, projection APIs, and validation behaviour.
Template Exports And Composition Formats
Semantic Studio separates template structure from mapped data. The OPT is the source template. The TDS XSD is the OPT-derived schema imported by mapping tools. The TDD Example XML is a sample XML instance generated from the TDS. TDD Documentation is the human-readable mapping reference for implementers.
| Use | API | Notes |
|---|---|---|
| Download OPT | GET /templates/{template_key}/exports/opt | Returns the authoritative source template. |
| Download TDS XSD | GET /templates/{template_key}/exports/tds | Generates on demand when needed and returns the template-specific schema for mapping tools and validators. |
| Generate TDD Example XML | POST /templates/{template_key}/generate/tdd-example | Builds a sample XML data instance from the same canonical template tree. |
| Download TDD Example XML | GET /templates/{template_key}/examples/tdd | Returns XML content with namespace declarations, schema-location metadata, context, and template field elements. |
| Download TDD Documentation | GET /templates/{template_key}/exports/tdd-documentation | Returns the implementation mapping reference when generated. |
| Download flat JSON example | GET /templates/{template_key}/examples/flat | Returns a compact JSON payload for direct integrations. |
| Download structured JSON example | GET /templates/{template_key}/examples/structured | Returns an openEHR-shaped JSON payload for direct integrations. |
| Export sample by version | GET /template-versions/{template_version_id}/examples/tdd | Use this when a partner must target an exact governed template version. Flat and structured examples use the same path pattern. |
| Transform mapped TDD XML | POST /records/ingest | Uses the governed transformation workflow; TDD is not a second composition CRUD representation. |
| Submit FLAT or STRUCTURED JSON | POST /openehr/v1/ehr/{ehr_id}/composition | Use the corresponding openEHR media type and openehr-template-id. |
| Read or export a composition | GET /openehr/v1/ehr/{ehr_id}/composition/{uid_based_id} | Use Accept to select canonical, FLAT, or STRUCTURED representation. |
{
"template_key": "kds-laborbericht",
"format": "tdd_example",
"payload": {
"xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><KDS_Laborbericht xmlns=\"http://schemas.oceanehr.com/templates\" xmlns:oe=\"http://schemas.openehr.org/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" template_id=\"kds-laborbericht\"><context><language><terminology_id><value>ISO_639-1</value></terminology_id><code_string>en</code_string></language><time><value>2026-03-13T10:15:00Z</value></time></context><data><messwert><value xsi:type=\"oe:DV_QUANTITY\"><oe:magnitude>3.5</oe:magnitude><oe:units>mmol/L</oe:units></value></messwert></data></KDS_Laborbericht>"
}
}
TDD imports resolve XML elements against generated aliases, XML-safe labels, node ids, canonical field names, canonical OPT paths, and AQL paths. Quantities, proportions, and coded values are normalised into AMCDR's canonical composition pipeline after XML parsing.
Flat JSON And Structured JSON
FLAT JSON and STRUCTURED JSON are supported representations of the same canonical openEHR composition resource.
Flat JSON uses compact template field keys and ctx/... context keys. It is suitable for ETL jobs, simple partner systems, and forms that do not need to send an openEHR-shaped payload. Structured JSON keeps the composition envelope, context, content, events, elements, datatypes, and values visible as JSON.
| Format | Create API | Example API | Persisted export |
|---|---|---|---|
| TDD XML | POST /records/ingest transformation | GET /templates/{template_key}/examples/tdd | Transformation provenance |
| FLAT JSON | POST /openehr/v1/ehr/{ehr_id}/composition | GET /templates/{template_key}/examples/flat | Same resource with FLAT Accept |
| STRUCTURED JSON | POST /openehr/v1/ehr/{ehr_id}/composition | GET /templates/{template_key}/examples/structured | Same resource with STRUCTURED Accept |
All three persisted exports are available regardless of the format used at creation. For example, a composition created from flat JSON can later be exported as TDD XML or structured JSON.
POST /openehr/v1/ehr/00000000-0000-0000-0000-000000000000/composition
Content-Type: application/openehr.wt.flat+json
openehr-template-id: kds-laborbericht
Prefer: return=representation
Field properties
The right-side Field Properties panel configures form-layer behavior. It remains visible beside the canvas on desktop widths and collapses below the canvas only on small screens.
Each selected field has a Widget control. Designers can choose the presentation that matches the workflow, such as text, long text, dropdown, autocomplete, radio choice, checkbox/toggle, date, date-time, quantity, identifier, or coded terminology lookup. For dropdowns and radio groups, designers can use Terminology lookup -> Static value list to define the code, display value, terminology ID, and version for each option. AMCDR limits the available widgets by the field's openEHR RM value type so the UI remains compatible with the clinical template.
Template-Level Composition Protection
Templates can define a composition access policy when records created from that template must be hidden from normal clinical views, patient-facing views, exports, and AQL execution unless the actor has a configured restricted-access role. This is intended for templates such as client registration evidence, MPI reconciliation, protected identity workflows, safeguarding records, or other administrative/clinical records that should not appear in the ordinary patient timeline.
{
"composition_access_policy": {
"visibility": "restricted",
"required_role_keys": ["mpi_admin", "protected_record_access"],
"aql_protected": true,
"hide_from_lists": true,
"patient_release_status": "withheld_from_patient",
"reason": "Registration composition contains identity-resolution evidence."
}
}
When a protected template is used to create a composition, AMCDR stores the normalized access policy in the composition provenance. Composition list/detail APIs, openEHR composition reads, saved-query execution, outbound saved-query exports, and AQL execution enforce the policy. AQL queries that explicitly reference a protected template are denied for users without the required role; broader AQL queries filter protected-template rows before results are returned.
AQL predicates alone are not sufficient access control. Use template-level composition protection for default hiding, and use role assignments or access policies to grant controlled access to the users responsible for MPI, protected records, governance review, or other restricted workflows.
Portable form packages
Published forms are exportable as portable openEHR form packages. A package carries the form definition, UI layout, value-set bindings, validation rules, web-template metadata, and examples, but it still depends on the target system accepting the referenced template_id.
Use Portable Forms for deployment modes, package contents, APIs, and how a form runtime posts compositions to AMCDR or another openEHR CDR.
External integrations routing
The External integrations runtime workspace option marks a published form as usable by external openEHR CDR connector workflows. It means AMCDR renders the form and submits or exports the resulting template-compliant composition through the backend adapter layer to systems such as EHRbase, Better CDR, another AMCDR deployment, or an integration gateway.
The target system must still be configured and compatible: same accepted template_id, compatible composition format, compatible terminology/code bindings, endpoint and authentication settings, and a resolved patient/EHR context.