ADR-0003: Persistent imaging annotations
- Status: Accepted
- Date: 2026-07-18
- Supersedes: None
- Superseded by: None
Context
The unified record viewer needs familiar measurement and annotation tools without presenting viewport adjustments as durable clinical findings. Cornerstone owns the annotation model, while the application must protect local record data from malformed payloads and concurrent browser tabs.
Decision
Use Cornerstone's native Length, Angle, and Arrow Annotation tools. Persist a validated, versioned annotation snapshot per imaging series in local SQLite. Snapshots carry the application schema version, Cornerstone version, revision, and timestamps. Saves use optimistic concurrency; stale revisions receive a conflict instead of overwriting newer work.
Keep zoom, pan, window/level, rotation, and current slice as ephemeral viewport state. Do not offer image annotations in the Cornerstone ECG viewport or in browser-native document viewers.
Alternatives considered
- Keep all annotations session-only.
- Store one database row per annotation and translate Cornerstone state into an application-owned measurement model.
- Persist every viewport presentation property with the annotations.
Consequences
The adapter can hydrate and serialize Cornerstone-native state with limited translation, and the user receives debounced autosave, retry, and conflict feedback. Snapshot schema and Cornerstone upgrades require compatibility review. Annotations are user-authored overlays, not verified clinical conclusions.
Verification
Tests cover payload validation, atomic revision predicates, API privacy headers, client conflicts, autosave retry, and adapter serialization. Browser checks cover format-aware tools and the absence of Cornerstone tool warnings.
Reusable lesson
This decision is project-specific and does not currently propose a global lesson.