Triage Store Guide¶
TriageStore provides a thread-safe,
SQLite-backed local review queue for clinical Record and Query triage
workflows with validated TriageStatus
transitions (NEW ↔ UNDER_REVIEW ↔ RESOLVED), reviewer assignments,
annotations, and immutable transition history.
Default and IMEDNET_TRIAGE_DB_PATH stores automatically partition SQLite
files per normalized EDC base_url origin directory, enforce owner-only
0700/0600 permissions on POSIX hosts, and scrub Query comments,
annotations, and status transition notes against global and study-configured
phi_fields sensitivity rules.
Managing a Local Triage Queue¶
upsert_item()inserts or updates aTriageItem(enforcing valid status transitions when updating an existing item).assign_item()assigns a queued item to a revieweruser_id.add_annotation()appends a timestampedTriageAnnotation.update_status()validates the targetTriageStatustransition and records aTriageHistoryEntry.get_queue()andget_triage_item()hydrate items alongside orderedannotationsandhistory.
import tempfile
from pathlib import Path
from imednet.models.triage import TriageItem, TriageStatus
from imednet_workflows import TriageStore
with tempfile.TemporaryDirectory() as tmp_dir:
store = TriageStore(Path(tmp_dir) / "study_triage.sqlite3")
store.upsert_item(
TriageItem(
item_id="REC-101",
study_key="STUDY",
status=TriageStatus.NEW,
severity="HIGH",
)
)
store.assign_item("REC-101", "cdm_reviewer_1")
store.add_annotation("REC-101", "cdm_reviewer_1", "Reviewing Vital Signs Query")
store.update_status(
"REC-101",
TriageStatus.UNDER_REVIEW,
user_id="cdm_reviewer_1",
comment="Opened investigation with Site",
)
store.update_status(
"REC-101",
TriageStatus.RESOLVED,
user_id="cdm_reviewer_1",
comment="Verified updated Record value",
)
resolved_queue = store.get_queue("STUDY", status=TriageStatus.RESOLVED)
assert len(resolved_queue) == 1
assert len(resolved_queue[0].annotations) == 1
assert len(resolved_queue[0].history) == 2
print(resolved_queue[0].item_id, resolved_queue[0].status.value)
CLI Triage Queue Commands¶
Reviewers can synchronize Query queues into TriageStore, inspect status
counts, assign ownership, record scrubbed reviewer notes, and inspect audit
transition history directly from the CLI via imednet workflows triage:
# Pull unresolved study queries into the origin-partitioned SQLite TriageStore
imednet workflows triage sync DEMO-STUDY --unresolved --simulation
# Inspect queued items and status counts (NEW, UNDER_REVIEW, RESOLVED)
imednet workflows triage list DEMO-STUDY --status NEW
imednet workflows triage counts DEMO-STUDY --format json
# Assign ownership and append a PHI-scrubbed reviewer annotation
imednet workflows triage assign DEMO-STUDY:701 cdm_reviewer_1 \
--comment "Reviewing Vital Signs Query"
# Transition status through UNDER_REVIEW to RESOLVED and inspect audit history
imednet workflows triage resolve DEMO-STUDY:701 --user cdm_reviewer_1 \
--status UNDER_REVIEW --comment "Opened investigation with Site"
imednet workflows triage resolve DEMO-STUDY:701 --user cdm_reviewer_1 \
--comment "Verified updated Record value"
imednet workflows triage history DEMO-STUDY:701 --format json