"""Consolidated user roles. HAND-AUTHORED: edit this file, then run build_roles.py (and build_screens.py).

Every actor (ACT-*) in section 2 of the ten domain specifications is either merged into exactly one role
here or listed in SYSTEM_ACTORS; build_roles.py fails otherwise. Every screen in the screen inventory must be
used by at least one role.

Role fields
  id       UR-NN
  family   grouping used for usability test recruitment
  title    the consolidated role name
  actors   'ADM-001, FIN-013' -> ACT-ADM-001, ACT-FIN-013
  tasks    main tasks, merged from the actors' primary activities
  freq     how often the main tasks are done: Continuous (many times an hour), Frequent (several times a day),
           Daily, Periodic (weekly, monthly or per cycle), On event (rare, unplanned)
  where    where the work is done
  devices  what the work is done on
  input    main input method
  density  High (many items per screen, expert users), Medium, Low (occasional or untrained users)
  form     primary form factor, used for the design-implication summary
  screens  screen IDs used: 'CLI-001, ADM-003' -> UI-CLI-001, UI-ADM-003
  notes    why actors were merged, and anything the usability tests should check

freq, where, devices, input, density and form are drawn from the specifications and common hospital practice,
adopted as the design baseline on 17 November 2026 instead of field research before design. They are checked by the
formative and summative usability tests of section 4 of user-roles.md; change them here when a test contradicts them.
"""

FAMILIES = [
    'Clinical care', 'Perioperative and critical care', 'Pharmacy', 'Diagnostics', 'Patient access and flow',
    'Finance and supply chain', 'Health information and privacy', 'Clinical and data governance',
    'Management and analytics', 'IT, platform and security', 'Patients and the public', 'Cross-cutting',
]

FORMS = {
    'Workstation': 'Desktop workstation at a desk, office or nursing station',
    'Workstation on wheels': 'Mobile cart or ward workstation used at or near the bed',
    'Handheld': 'Managed handheld device with a barcode scanner, used at the bedside',
    'Theatre workstation': 'Fixed workstation or tablet in theatre, often used standing or by a non-sterile team member',
    'Reading station': 'Multi-monitor diagnostic reading workstation with dictation',
    'Counter workstation': 'Front-desk or cashier counter workstation with peripherals, facing the public',
    'Wall display': 'Large shared screen, read from a distance, no input',
    'Phone and web': "Patient's own phone, tablet or computer",
    'Embedded': 'Appears inside other roles\' screens; inherits their form factor',
}

ROLES = [
    # ---------------- Clinical care ----------------
    dict(id='UR-01', family='Clinical care', title='Physician (attending, specialist, dentist)',
         actors='ADM-007, CLI-001, ANC-017, HIM-010, PEX-005, EBP-009',
         tasks='Review the chart and results; document; diagnose; order and prescribe; reconcile medication; acknowledge critical results; request admission, transfer and discharge; release results to the patient; confirm pathway activation; complete chart deficiencies',
         freq='Continuous', where='Wards, clinics, emergency department, on-call from anywhere in the hospital',
         devices='Ward and clinic workstations; workstation on wheels on rounds; tablet or phone for read-mostly review',
         input='Keyboard and mouse; order and note templates; dictation where available', density='High', form='Workstation',
         screens='CLI-001, CLI-002, CLI-003, CLI-004, CLI-007, CLI-008, CLI-009, CLI-010, CLI-015, CLI-017, CLI-019, ADM-003, ADM-009, HIM-004, PEX-014, EBP-001, EBP-007, EBP-008, EBP-009, ANC-016, ANL-013, CLI-005, CLI-018, CLI-013, EBP-010',
         notes='Merges the physician of five specifications and the "responsible" or "treating" clinician of Domains 4, 6, 7 and 9, which are the same person seen from different workflows. Heavy interruption: work must survive switching patient.'),
    dict(id='UR-02', family='Clinical care', title='Emergency clinician and triage nurse',
         actors='ADM-003, CLI-005',
         tasks='Rapid identification and registration of arrivals; triage category; rapid assessment, allergies and observations; urgent orders; flow and disposition; escalation and handover',
         freq='Continuous', where='Emergency department: triage desk, resuscitation and treatment areas',
         devices='Emergency department workstations and workstation on wheels; flow board on a wall display',
         input='Keyboard and mouse; minimal typing, short pick lists', density='High', form='Workstation',
         screens='ADM-008, ADM-012, CLI-001, CLI-003, CLI-005, CLI-008, CLI-015, CLI-019, ESS-004, CLI-004, CLI-017',
         notes='Same actor named in Domains 1 and 3. Speed matters more than completeness: unknown and unidentified patients are common (ACC-004).'),
    dict(id='UR-03', family='Clinical care', title='Ward nurse and midwife',
         actors='ADM-005, CLI-002, ANC-008, EBP-010',
         tasks='Assessments and observations; care plan and task worklist; medication administration with barcode verification; transfusion verification; transfers, leave and bed readiness; handover; pathway steps; escalation',
         freq='Continuous', where='Ward, at the nursing station and at the bedside',
         devices='Nursing station workstation; workstation on wheels; bedside handheld with scanner; ward flow board',
         input='Touch and barcode scan at the bedside; keyboard and mouse at the station', density='High', form='Handheld',
         screens='CLI-003, CLI-004, CLI-005, CLI-006, CLI-007, CLI-013, CLI-014, CLI-015, CLI-018, CLI-019, ADM-004, ADM-009, ADM-012, ANC-007, ISE-012, EBP-008, EBP-009, HIM-004, CLI-010, CLI-008, CLI-017, ANC-002',
         notes='The transfusing practitioner (Domain 4) and the care-team member (Domain 9) are tasks done mostly by nurses; physicians also verify transfusions. Interrupted constantly; gloved hands at the bedside.'),
    dict(id='UR-04', family='Clinical care', title='Charge nurse and nursing supervisor',
         actors='CLI-007, EBP-011, CLI-017, HIM-014',
         tasks='Assign tasks and patients; monitor overdue work; co-sign and witness; resolve escalations, including overdue pathway steps; bed and transfer coordination for the ward',
         freq='Frequent', where='Ward nursing station', devices='Nursing station workstation; ward flow board',
         input='Keyboard and mouse', density='High', form='Workstation',
         screens='CLI-006, CLI-009, CLI-018, ADM-004, ADM-009, ADM-012, EBP-010, CLI-007, HIM-004, HIM-003, CLI-013, ESS-009, CLI-003, CLI-008, CLI-017',
         notes='Also works as UR-03 during the shift. Needs a ward-level overview, not a single patient.'),
    dict(id='UR-05', family='Clinical care', title='Allied health professional and therapist',
         actors='CLI-006, ANC-015',
         tasks='Receive referrals; assessments, therapy plans and session records; orders within scope of practice',
         freq='Frequent', where='Wards, therapy departments, outpatient clinics',
         devices='Workstation; workstation on wheels or tablet on the ward', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='ANC-013, ANC-016, CLI-001, CLI-003, CLI-008, CLI-004, CLI-007, CLI-006, CLI-009',
         notes='Domain 3 and Domain 4 name the same people. Nutrition service (Instalasi Gizi) staff who prepare and serve meals use this role with the Diet work list view of UI-CLI-006 only (DG-01).'),
    dict(id='UR-06', family='Clinical care', title='Student and supervised practitioner',
         actors='CLI-012, ANC-023',
         tasks='Draft notes and orders that need countersignature', freq='Frequent',
         where='Wards and clinics', devices='Shared workstations', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='CLI-001, CLI-003, CLI-008, ANC-005',
         notes='Same screens as UR-01 with a pending-countersignature state; rotate often, so training time is short.'),
    dict(id='UR-07', family='Clinical care', title='Specimen collector (phlebotomist)',
         actors='ANC-003',
         tasks='Verify the patient, print and apply container labels, record collection', freq='Continuous',
         where='Wards and outpatient collection rooms', devices='Bedside handheld with scanner; portable label printer',
         input='Barcode scan and touch', density='Low', form='Handheld',
         screens='ANC-002, ISE-012',
         notes='Rounds of many patients; each collection is a short guided scan sequence.'),
    dict(id='UR-08', family='Clinical care', title='Clinic message-pool staff',
         actors='PEX-006, PEX-015',
         tasks='Triage, answer or reassign patient messages; escalate clinical messages', freq='Frequent',
         where='Clinic offices', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='PEX-013',
         notes='Usually clinic nurses or administrative staff working a shared inbox.'),

    # ---------------- Perioperative and critical care ----------------
    dict(id='UR-09', family='Perioperative and critical care', title='Surgeon and proceduralist',
         actors='ANC-009',
         tasks='Request cases; take part in the time-out; operative and procedure records', freq='Daily',
         where='Theatre, procedure rooms, wards', devices='Theatre workstation; ward workstations', input='Keyboard and mouse; often dictated or entered by others', density='Medium', form='Theatre workstation',
         screens='ANC-008, ANC-009, ANC-010, ANC-016, CLI-001, CLI-008',
         notes='Also a UR-01 physician outside theatre. Sterile during the procedure, so the circulating nurse often records.'),
    dict(id='UR-10', family='Perioperative and critical care', title='Anesthetist',
         actors='ANC-010',
         tasks='Pre-operative assessment; time-based anesthesia record; time-out', freq='Continuous',
         where='Pre-operative clinic, theatre', devices='Theatre workstation next to the anesthesia machine', input='Touch and keyboard; device data captured automatically',
         density='High', form='Theatre workstation',
         screens='ANC-008, ANC-009, ANC-010, CLI-001, ANC-014, ANC-007',
         notes='Records continuously during a case; the screen must be readable at a glance while attending to the patient.'),
    dict(id='UR-11', family='Perioperative and critical care', title='Theatre nurse (scrub and circulating)',
         actors='ANC-011',
         tasks='Safety checklist; swab and instrument counts; implant recording', freq='Continuous',
         where='Theatre', devices='Theatre workstation; scanner for implants', input='Touch and barcode scan', density='Medium', form='Theatre workstation',
         screens='ANC-008, ANC-009, ANC-010, FIN-017'),
    dict(id='UR-12', family='Perioperative and critical care', title='Recovery (PACU) nurse',
         actors='ANC-013',
         tasks='Recovery observations; discharge criteria; handoff to the ward', freq='Continuous',
         where='Recovery unit', devices='Bedside workstation', input='Touch and keyboard', density='High', form='Workstation on wheels',
         screens='ANC-011, CLI-005, CLI-007, ANC-008, ANC-014'),
    dict(id='UR-13', family='Perioperative and critical care', title='Critical care nurse and intensivist (ICU, NICU)',
         actors='ANC-014, ANC-016',
         tasks='High-frequency flowsheet charting; validate device data; fluid balance and care bundles; escalation; human milk labelling, storage and feed verification in the NICU',
         freq='Continuous', where='Intensive care and neonatal units, at the bedside',
         devices='Bedside workstation; handheld with scanner for medication and feeds', input='Touch and keyboard; device data captured automatically; barcode scan',
         density='High', form='Workstation on wheels',
         screens='ANC-007, ANC-012, ANC-014, CLI-001, CLI-013, CLI-014, CLI-019, ISE-012',
         notes='The NICU and lactation nurse is merged here because the setting and devices are the same. Usually one or two patients per nurse, so screens show more detail per patient.'),
    dict(id='UR-14', family='Perioperative and critical care', title='Theatre coordinator and scheduler',
         actors='ANC-012',
         tasks='Schedule and sequence theatre lists; allocate rooms, staff and equipment', freq='Frequent',
         where='Theatre office and control desk', devices='Workstation; theatre board on a wall display', input='Keyboard and mouse; drag and drop', density='High', form='Workstation',
         screens='ANC-008'),

    # ---------------- Pharmacy ----------------
    dict(id='UR-15', family='Pharmacy', title='Pharmacist',
         actors='CLI-003',
         tasks='Verify medication orders; apply formulary rules and propose substitutions; review medication alerts; dispense and reconcile; controlled-substance checks',
         freq='Continuous', where='Pharmacy and ward pharmacy rounds', devices='Pharmacy workstation, often two monitors; tablet on rounds',
         input='Keyboard and mouse', density='High', form='Workstation',
         screens='CLI-010, CLI-011, CLI-012, CLI-015, FIN-017, CLI-004, CLI-018, CLI-013, CLI-003',
         notes='Also acts as authorized pharmacist in pharmacy stores (UR-16).'),
    dict(id='UR-16', family='Pharmacy', title='Pharmacy technician and pharmacy stores staff',
         actors='CLI-004, FIN-009',
         tasks='Prepare, label and dispense verified items; process returns; receive and transfer pharmacy stock; manage expiry; reconcile controlled stock',
         freq='Continuous', where='Pharmacy dispensary and pharmacy stores', devices='Workstation with scanner and label printer',
         input='Barcode scan, keyboard and mouse', density='Medium', form='Workstation',
         screens='CLI-012, FIN-011, FIN-012, FIN-015, FIN-017, FIN-013',
         notes='Domain 5 names "pharmacist / pharmacy technician" as stores staff; the stores work is mostly technicians.'),
    dict(id='UR-17', family='Pharmacy', title='Medication safety officer',
         actors='CLI-010',
         tasks='Review overrides, late and omitted doses and controlled-substance discrepancies', freq='Periodic',
         where='Office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='CLI-016, FIN-017, ANL-003, CLI-012, ANL-001'),

    # ---------------- Diagnostics ----------------
    dict(id='UR-18', family='Diagnostics', title='Laboratory scientist and technologist',
         actors='ANC-001',
         tasks='Receive specimens; run worklists; review analyzer results; technical validation', freq='Continuous',
         where='Laboratory benches and specimen reception', devices='Bench workstation with scanner', input='Barcode scan, keyboard and mouse', density='High', form='Workstation',
         screens='ANC-001, ANC-004'),
    dict(id='UR-19', family='Diagnostics', title='Laboratory supervisor and authorizing pathologist',
         actors='ANC-002',
         tasks='Clinical validation; release and correction of results; start critical-result communication', freq='Frequent',
         where='Laboratory', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ANC-001, ANC-003, ANC-004'),
    dict(id='UR-20', family='Diagnostics', title='Pathologist and histopathology technologist',
         actors='ANC-006',
         tasks='Grossing, processing and block and slide tracking; pathology report sign-out', freq='Frequent',
         where='Histopathology laboratory', devices='Bench workstation with scanner; reporting workstation', input='Barcode scan; dictation for reports', density='High', form='Workstation',
         screens='ANC-015'),
    dict(id='UR-21', family='Diagnostics', title='Blood bank scientist',
         actors='ANC-007',
         tasks='Group and screen; crossmatch; issue, return and disposal of blood products', freq='Frequent',
         where='Blood bank', devices='Bench workstation with scanner', input='Barcode scan, keyboard and mouse', density='High', form='Workstation',
         screens='ANC-006, FIN-017'),
    dict(id='UR-22', family='Diagnostics', title='Radiographer and imaging technologist',
         actors='ANC-004',
         tasks='Work the modality worklist; record acquisition status and dose', freq='Continuous',
         where='Imaging rooms, at the modality console', devices='Workstation beside the modality', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='ANC-005, ANC-004'),
    dict(id='UR-23', family='Diagnostics', title='Radiologist',
         actors='ANC-005',
         tasks='Report studies by dictation; sign and amend reports; flag critical findings', freq='Continuous',
         where='Reading room', devices='Multi-monitor reading station with the image viewer and dictation', input='Dictation, keyboard shortcuts', density='High', form='Reading station',
         screens='ANC-005, ANC-003',
         notes='The diagnostic image viewer is part of the imaging archive component (DEC-ANC-001: OHIF and Weasis on the dcm4chee archive); the HIS reporting screens sit beside it.'),
    dict(id='UR-24', family='Diagnostics', title='Clinical engineer and device administrator',
         actors='ANC-018',
         tasks='Register devices; validate device interfaces; resolve device faults and held data', freq='On event',
         where='Clinical engineering office and on the ward', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='ANC-014'),

    # ---------------- Patient access and flow ----------------
    dict(id='UR-25', family='Patient access and flow', title='Registration and admission clerk',
         actors='ADM-001, FIN-013, PEX-003, ESS-012',
         tasks='Search the patient index; register and verify identity; capture demographics, payer and consent; check eligibility; create encounters; admit, transfer, discharge; manage queues; activate portal accounts',
         freq='Continuous', where='Registration desk, admission office, outpatient front desk',
         devices='Counter workstation with ID-card reader, document scanner, wristband and label printers, signature pad',
         input='Keyboard and mouse; card and document scanning', density='High', form='Counter workstation',
         screens='ADM-001, ADM-003, ADM-007, ESS-006, FIN-007, PEX-015',
         notes='Named in Domains 1, 5 and 7. The consent recording user of Domain 10 is mostly this role; clinicians also record consent. Face-to-face with the patient, so the screen may be visible to them.'),
    dict(id='UR-26', family='Patient access and flow', title='Registration supervisor',
         actors='ADM-010',
         tasks='Correct and cancel encounters; approve priority overrides; correct identifiers; work incomplete registrations', freq='Daily',
         where='Registration office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ADM-001, ADM-003, ADM-010, ADM-002, ADM-004, ADM-005'),
    dict(id='UR-27', family='Patient access and flow', title='Scheduler and clinic clerk',
         actors='ADM-006, PEX-004, ANC-021, ANC-022',
         tasks='Book, reschedule and cancel appointments; manage waitlists; check patients in; answer portal appointment requests', freq='Continuous',
         where='Clinic front desk and booking office', devices='Workstation; telephone headset', input='Keyboard and mouse', density='High', form='Counter workstation',
         screens='ADM-005, ADM-006, ADM-007, PEX-013, ANC-016, ANC-005',
         notes='Often on the phone while booking, so the screen must work one-handed with the keyboard.'),
    dict(id='UR-28', family='Patient access and flow', title='Bed manager and patient flow coordinator',
         actors='ADM-004',
         tasks='Reserve, allocate and block beds; designate isolation; monitor flow boards', freq='Continuous',
         where='Bed management office; hospital command centre', devices='Workstation; flow boards on wall displays', input='Keyboard and mouse; drag and drop', density='High', form='Workstation',
         screens='ADM-004, ADM-012'),
    dict(id='UR-29', family='Patient access and flow', title='Housekeeping and environmental services',
         actors='ADM-008, ANC-025',
         tasks='Receive, start and complete bed-cleaning tasks', freq='Frequent',
         where='Throughout the hospital', devices='Phone or handheld', input='Touch, one tap per step', density='Low', form='Handheld',
         screens='ADM-004, ESS-010, ANC-002, ANC-007, ISE-012',
         notes='Minimal training; screens should show one task at a time.'),
    dict(id='UR-30', family='Patient access and flow', title='Identity steward',
         actors='ADM-002, HIM-011',
         tasks='Review uncertain matches and duplicate candidates; merge and unmerge; reconcile demographics', freq='Daily',
         where='HIM office', devices='Workstation, ideally two monitors for side-by-side comparison', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ADM-002, HIM-001',
         notes='Domains 1 and 6 name the same HIM specialist.'),

    # ---------------- Finance and supply chain ----------------
    dict(id='UR-31', family='Finance and supply chain', title='Billing officer',
         actors='FIN-001, PEX-009',
         tasks='Review charges and resolve charge exceptions; generate and adjust invoices; answer billing enquiries from the portal', freq='Continuous',
         where='Billing office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='FIN-001, FIN-002, FIN-004, PEX-013'),
    dict(id='UR-32', family='Finance and supply chain', title='Cashier',
         actors='FIN-002',
         tasks='Take deposits and payments; issue receipts; allocate payments; refunds; open and close the cashier session', freq='Continuous',
         where='Cashier counter', devices='Counter workstation with receipt printer, cash drawer and card terminal', input='Keyboard and mouse; card terminal', density='Medium', form='Counter workstation',
         screens='FIN-005, FIN-001',
         notes='Queue of patients waiting; each transaction must be fast and hard to get wrong.'),
    dict(id='UR-33', family='Finance and supply chain', title='Claims officer',
         actors='FIN-003',
         tasks='Prepare, validate and submit claims; work rejections and denials; resubmit; reconcile remittance', freq='Continuous',
         where='Claims office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='FIN-008, FIN-009'),
    dict(id='UR-34', family='Finance and supply chain', title='Insurance verification officer',
         actors='FIN-004',
         tasks='Run eligibility checks; maintain coverage layers; record authorizations', freq='Continuous',
         where='Admission office and payer desk', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='FIN-007'),
    dict(id='UR-35', family='Finance and supply chain', title='Finance supervisor',
         actors='FIN-005',
         tasks='Approve refunds, adjustments, write-offs and credit notes above threshold; review reconciliation', freq='Daily',
         where='Finance office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='FIN-001, FIN-004, FIN-006, FIN-018, FIN-013'),
    dict(id='UR-36', family='Finance and supply chain', title='Finance accountant',
         actors='FIN-006',
         tasks='Review posting batches; resolve posting failures; reconcile to the finance system', freq='Daily',
         where='Finance office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='FIN-009, FIN-010'),
    dict(id='UR-37', family='Finance and supply chain', title='Tariff administrator',
         actors='FIN-007',
         tasks='Author, test, submit and publish tariff versions', freq='Periodic',
         where='Finance office', devices='Workstation', input='Keyboard and mouse; bulk import', density='High', form='Workstation',
         screens='FIN-003'),
    dict(id='UR-38', family='Finance and supply chain', title='Inventory controller and storekeeper',
         actors='FIN-008, FIN-020',
         tasks='Receive, issue, transfer and return stock; run stocktakes; manage lots and expiry; maintain items and locations', freq='Continuous',
         where='Central stores and departmental store rooms', devices='Workstation; handheld scanner for counts and receipts', input='Barcode scan, keyboard and mouse', density='Medium', form='Workstation',
         screens='FIN-011, FIN-012, FIN-013, FIN-015, FIN-014, FIN-018'),
    dict(id='UR-39', family='Finance and supply chain', title='Department requester',
         actors='FIN-010',
         tasks='Raise requisitions; record departmental consumption and returns; check availability', freq='Daily',
         where='Wards and departments', devices='Shared ward or department workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='FIN-014, FIN-016',
         notes='Usually a ward clerk or unit manager doing this alongside other work.'),
    dict(id='UR-40', family='Finance and supply chain', title='Procurement officer',
         actors='FIN-011',
         tasks='Convert requisitions to purchase orders; track supplier delivery', freq='Daily',
         where='Procurement office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='FIN-014, FIN-015, FIN-018'),
    dict(id='UR-41', family='Finance and supply chain', title='Line manager and approver',
         actors='FIN-012, ESS-002, FIN-019',
         tasks='Approve requisitions and purchase orders within limits; approve access requests; periodic access recertification', freq='Periodic',
         where='Any office', devices='Workstation; phone for approvals', input='Keyboard and mouse; one-tap approval', density='Low', form='Workstation',
         screens='FIN-013, FIN-014, ESS-002, FIN-011',
         notes='Merges approval actors from Domains 5 and 10: the same managers approve both. Occasional users, so approval screens must need no training.'),

    # ---------------- Health information and privacy ----------------
    dict(id='UR-42', family='Health information and privacy', title='HIM manager',
         actors='HIM-001',
         tasks='Manage HIM queues and assignments; approve waivers; review performance; approve disposition batches', freq='Daily',
         where='HIM office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='HIM-001, HIM-003, HIM-008, ADM-002, HIM-010, HIM-009'),
    dict(id='UR-43', family='Health information and privacy', title='Clinical coder',
         actors='HIM-002',
         tasks='Review the record; accept or reject candidate codes; assign and finalise codes', freq='Continuous',
         where='HIM office or remote', devices='Workstation with two monitors (record and coding side by side)', input='Keyboard-heavy, code search', density='High', form='Workstation',
         screens='HIM-001, HIM-002, HIM-006, ANL-013'),
    dict(id='UR-44', family='Health information and privacy', title='Coding supervisor',
         actors='HIM-003',
         tasks='Review coding; approve revisions after finalisation; resolve coding exceptions', freq='Daily',
         where='HIM office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='HIM-001, HIM-002, ANL-013'),
    dict(id='UR-45', family='Health information and privacy', title='HIM analyst',
         actors='HIM-004, PEX-007',
         tasks='Review deficiencies; raise manual deficiencies; complete and lock records; handle correction requests on the legal record', freq='Continuous',
         where='HIM office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='HIM-001, HIM-003, HIM-006, HIM-005',
         notes='Domain 7 calls this role "HIM officer".'),
    dict(id='UR-46', family='Health information and privacy', title='Document indexing clerk',
         actors='HIM-005',
         tasks='Scan paper and downtime documents; classify and index; quality-check; correct indexing', freq='Continuous',
         where='HIM scanning room', devices='Workstation with high-volume document scanner', input='Keyboard shortcuts, scanner', density='Medium', form='Workstation',
         screens='HIM-005, HIM-006, HIM-001, ANL-013'),
    dict(id='UR-47', family='Health information and privacy', title='Release of information officer',
         actors='HIM-006',
         tasks='Register requests; verify identity and authority; assemble, redact and release packages; log disclosures', freq='Daily',
         where='HIM office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='HIM-010, HIM-011, HIM-006, HIM-001'),
    dict(id='UR-48', family='Health information and privacy', title='Privacy officer',
         actors='HIM-007, PEX-008, ESS-004, ANL-010',
         tasks='Approve sensitive releases and extracts; define restrictions and privacy labels; review record access and Break-the-Glass sessions; handle data subject requests and portal access disputes', freq='Daily',
         where='Privacy office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='HIM-010, HIM-011, HIM-012, ESS-003, ESS-005, ESS-006, ESS-008, ANL-011, PEX-015, PEX-016, HIM-001, EBP-013',
         notes='Four specifications name a privacy officer. Usually a small team, so one role.'),
    dict(id='UR-49', family='Health information and privacy', title='Legal and compliance officer',
         actors='HIM-008',
         tasks='Apply and release legal holds; approve disposal; approve retention rules', freq='On event',
         where='Legal office', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='HIM-007, HIM-008, HIM-009, HIM-010'),
    dict(id='UR-50', family='Health information and privacy', title='Records retention administrator',
         actors='HIM-009',
         tasks='Define retention rules; review eligibility lists; prepare archival and disposal batches', freq='Periodic',
         where='HIM office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='HIM-007, HIM-008, HIM-006, HIM-001, HIM-009'),
    dict(id='UR-51', family='Health information and privacy', title='Auditor (internal or external)',
         actors='FIN-018, ESS-015, EBP-013',
         tasks='Query audit and governance evidence; inspect ledgers and adjustment history; reconstruct historical decisions and pathway audit; export reports', freq='Periodic',
         where='Office, read-only', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ESS-008, EBP-013, FIN-001, EBP-012',
         notes='Merges auditor actors of Domains 5, 9 and 10.'),

    # ---------------- Clinical and data governance ----------------
    dict(id='UR-52', family='Clinical and data governance', title='Clinical governance approver',
         actors='CLI-009, EBP-004, EBP-016, PEX-016',
         tasks='Approve clinical content, alert severity, override policy, guidelines and pathways; authorize retirement and suspension; accept residual risks', freq='Periodic',
         where='Office and governance meetings', devices='Workstation; meeting-room screen', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='CLI-016, CLI-020, EBP-005, EBP-006, EBP-011, EBP-012, PEX-016, ESS-007, ESS-011, EBP-001',
         notes='Senior clinicians acting in a committee; occasional users of these screens.'),
    dict(id='UR-53', family='Clinical and data governance', title='Clinical informatics steward and pathway designer',
         actors='CLI-008, EBP-005, CLI-018',
         tasks='Maintain templates, order sets and decision-support rules; run simulations; operate the override review queue; model pathways, bind terminology and run scenario tests', freq='Daily',
         where='Informatics office', devices='Workstation with two monitors', input='Keyboard and mouse; visual modelling', density='High', form='Workstation',
         screens='CLI-016, CLI-020, EBP-003, EBP-004, EBP-014, EBP-001',
         notes='Both build executable clinical content on the same rule runtime (DEC-CLI-005 and DEC-EBP-009).'),
    dict(id='UR-54', family='Clinical and data governance', title='Clinical content owner',
         actors='EBP-002',
         tasks='Author recommendations; set review dates; submit content for review; respond to review triggers', freq='Periodic',
         where='Office', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='EBP-001, EBP-002, EBP-012, EBP-004, ANL-010'),
    dict(id='UR-55', family='Clinical and data governance', title='Clinical reviewer and clinical safety reviewer',
         actors='EBP-003, EBP-008, ANC-026',
         tasks='Review content versions and comment; recommend approval or return; record safety assessments and hazard links', freq='Periodic',
         where='Office', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='EBP-005, ANC-006, EBP-001, EBP-013',
         notes='Both review a version before approval, on the same screen.'),
    dict(id='UR-56', family='Clinical and data governance', title='Evidence curator',
         actors='EBP-001',
         tasks='Register, classify and maintain evidence sources, citations and assessments', freq='Periodic',
         where='Office or library', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='EBP-001, EBP-002'),
    dict(id='UR-57', family='Clinical and data governance', title='Content publisher',
         actors='EBP-007',
         tasks='Run release checks; promote, publish and roll back clinical content', freq='Periodic',
         where='Informatics office', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='EBP-006',
         notes='Must be separate from the author and the approver of the same content.'),
    dict(id='UR-58', family='Clinical and data governance', title='Data and terminology steward',
         actors='ESS-005, ESS-006, EBP-006, ANL-006',
         tasks='Load code system versions; maintain value sets and concept maps; resolve unmapped codes; propose and resolve master-data changes; resolve quarantined records and data-quality exceptions', freq='Daily',
         where='Office', devices='Workstation', input='Keyboard and mouse; bulk import', density='High', form='Workstation',
         screens='ESS-007, EBP-003, ANL-009, ANL-008, ANL-010',
         notes='Merges stewardship actors of Domains 8, 9 and 10. Code systems in scope: SNOMED CT, LOINC, UCUM, RxNorm or WHO ATC, KFA and ICD-10 (DEC-CLI-004).'),
    dict(id='UR-59', family='Clinical and data governance', title='Data owner and governance council member',
         actors='ESS-007, ESS-016, ANL-005, ANL-016, ANL-017',
         tasks='Approve master-data and reference-data changes, metric definitions, ownership, rules and policy; review stewardship measures', freq='Periodic',
         where='Office and governance meetings', devices='Workstation', input='Keyboard and mouse', density='Low', form='Workstation',
         screens='ESS-007, ESS-012, ANL-010, ANL-008, ANL-009, ANL-011'),
    dict(id='UR-60', family='Clinical and data governance', title='AI governance reviewer',
         actors='ANL-011',
         tasks='Assess and approve AI use cases and model releases; suspend models', freq='On event',
         where='Office', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='ANL-012'),
    dict(id='UR-61', family='Clinical and data governance', title='Configuration administrator',
         actors='ADM-009, ANC-019, CLI-011, ESS-008, EBP-015, PEX-010, PEX-011, PEX-017',
         tasks='Maintain templates, calendars, queue and bed rules, worklists, thresholds, checklists, forms, notification templates and release rules; submit configuration for approval and promote it', freq='Periodic',
         where='IT or departmental office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ADM-011, CLI-020, ESS-011, PEX-016',
         notes='Seven specifications name a configuration role for their own settings. One role with domain-scoped permissions keeps one change process (Domain 10 configuration lifecycle).'),

    # ---------------- Management and analytics ----------------
    dict(id='UR-62', family='Management and analytics', title='Executive and hospital manager',
         actors='ANL-001',
         tasks='View management reports, trends and the scorecard; request drill-down', freq='Periodic',
         where='Office, meetings, remote', devices='Workstation; tablet or phone', input='Touch or mouse; read-only', density='Low', form='Workstation',
         screens='ANL-001, ANL-014, ANL-004'),
    dict(id='UR-63', family='Management and analytics', title='Operations manager and department head',
         actors='ANL-002',
         tasks='View operational dashboards for own area; review exceptions', freq='Daily',
         where='Department office', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='ANL-001, ANL-005, ANL-014'),
    dict(id='UR-64', family='Management and analytics', title='Quality and outcomes analyst',
         actors='ANL-003, EBP-012',
         tasks='Review quality indicators, decision-support analytics and pathway measures; propose measure definitions; prepare governance material', freq='Daily',
         where='Quality office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ANL-003, EBP-011, ANL-014, ANL-007, EBP-012, ANL-010, ANL-001, ANL-011',
         notes='Domains 8 and 9 name the same analyst.'),
    dict(id='UR-65', family='Management and analytics', title='Finance and revenue cycle analyst',
         actors='ANL-004',
         tasks='Run and review financial and revenue-cycle reports; investigate reconciliation variances', freq='Daily',
         where='Finance office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ANL-004, ANL-007'),
    dict(id='UR-66', family='Management and analytics', title='Data engineer and analytics platform administrator',
         actors='ANL-007, ANL-014',
         tasks='Register sources; build transformations; run controlled replay; maintain lineage; configure pipelines and refresh schedules', freq='Daily',
         where='IT office', devices='Workstation', input='Keyboard', density='High', form='Workstation',
         screens='ANL-006, ANL-008, ANL-011'),
    dict(id='UR-67', family='Management and analytics', title='BI developer and report author',
         actors='ANL-008',
         tasks='Create and publish dashboards and reports from certified metrics', freq='Daily',
         where='IT or analytics office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ANL-007, ANL-010'),
    dict(id='UR-68', family='Management and analytics', title='Researcher and QI investigator',
         actors='ANL-009',
         tasks='Submit extract requests; receive approved data sets', freq='On event',
         where='Office', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='ANL-007, ANL-011'),
    dict(id='UR-69', family='Management and analytics', title='Data scientist and model developer',
         actors='ANL-013',
         tasks='Register models, prompts, corpora and evaluation sets; run evaluations', freq='Daily',
         where='IT or analytics office', devices='Workstation', input='Keyboard', density='High', form='Workstation',
         screens='ANL-012'),

    # ---------------- IT, platform and security ----------------
    dict(id='UR-70', family='IT, platform and security', title='Platform engineer, SRE and backup operator',
         actors='ISE-001, ISE-006, ANC-024',
         tasks='Provision environments; deploy and scale; respond to incidents; run and verify backups, restore tests and failover', freq='Daily',
         where='IT operations', devices='Workstation', input='Keyboard', density='High', form='Workstation',
         screens='ISE-004, ISE-005, ISE-007, ISE-009, ANC-005, ISE-010',
         notes='Backup and recovery sits with the single platform team (DEC-ISE-001, resolved 2026-11-16).'),
    dict(id='UR-71', family='IT, platform and security', title='Domain service team (developer)',
         actors='ISE-008',
         tasks='Publish APIs and events; consume platform services; own service catalogue entries and runbooks', freq='Daily',
         where='IT office', devices='Workstation', input='Keyboard', density='High', form='Workstation',
         screens='ISE-003, ISE-004, ESS-012'),
    dict(id='UR-72', family='IT, platform and security', title='Integration engineer',
         actors='ISE-002',
         tasks='Register interfaces; configure routes; run conformance tests; certify partners', freq='Daily',
         where='IT office', devices='Workstation', input='Keyboard', density='High', form='Workstation',
         screens='ISE-002, ISE-003'),
    dict(id='UR-73', family='IT, platform and security', title='Integration and workflow operations analyst',
         actors='ISE-003, ESS-010',
         tasks='Review quarantine and dead-letter queues; controlled replay; work reconciliation lists; recover stuck tasks and failed notifications', freq='Continuous',
         where='IT operations', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ISE-001, ESS-009, ADM-010, ANC-004',
         notes='Both monitor failed messages and replay them; one operations desk.'),
    dict(id='UR-74', family='IT, platform and security', title='Security engineer and security operations analyst',
         actors='ISE-004',
         tasks='Manage keys and certificates; triage security alerts; preserve evidence; track vulnerabilities', freq='Continuous',
         where='Security operations', devices='Workstation', input='Keyboard', density='High', form='Workstation',
         screens='ISE-006, ISE-008, ISE-011, ISE-002'),
    dict(id='UR-75', family='IT, platform and security', title='Security officer',
         actors='ESS-003, ESS-017',
         tasks='Author and approve authorization policies; review security events; query audit; administer the audit service and act on integrity and completeness exceptions (the audit administrator, held by a different person from application administrators)', freq='Periodic',
         where='Security office', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ESS-003, ESS-005, ESS-008, ESS-011'),
    dict(id='UR-76', family='IT, platform and security', title='Release and change approver',
         actors='ISE-005, ESS-009',
         tasks='Review release evidence; approve or reject promotion of software and configuration; authorize rollback', freq='Periodic',
         where='IT office', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='ISE-007, ESS-011, ISE-002',
         notes='Merges the Domain 2 release manager and the Domain 10 configuration change approver.'),
    dict(id='UR-77', family='IT, platform and security', title='Network and endpoint administrator',
         actors='ISE-007',
         tasks='Maintain network segmentation, asset inventory, patching and endpoint protection', freq='Daily',
         where='IT operations', devices='Workstation', input='Keyboard', density='High', form='Workstation',
         screens='',
         notes='No HIS screen: works in network and endpoint tools. Part of the single platform team (DEC-ISE-001).'),
    dict(id='UR-78', family='IT, platform and security', title='Incident commander',
         actors='ISE-011',
         tasks='Classify impact; declare and end downtime; authorize network isolation, restoration and reconciliation', freq='On event',
         where='Command centre', devices='Workstation; wall display', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='ISE-010'),
    dict(id='UR-79', family='IT, platform and security', title='Enterprise architect',
         actors='ISE-012',
         tasks='Approve dependencies; record architecture decisions; review supported versions', freq='Periodic',
         where='Office', devices='Workstation', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='ISE-011, ESS-012'),
    dict(id='UR-80', family='IT, platform and security', title='Identity and access administrator',
         actors='ESS-001',
         tasks='Provision, change, suspend and deactivate accounts; assign roles on approved requests', freq='Daily',
         where='IT service desk', devices='Workstation', input='Keyboard and mouse', density='High', form='Workstation',
         screens='ESS-002'),
    dict(id='UR-81', family='IT, platform and security', title='Portal support agent',
         actors='PEX-012',
         tasks='Patient account support without access to clinical content; unlock and recovery assistance', freq='Frequent',
         where='Service desk', devices='Workstation; telephone headset', input='Keyboard and mouse', density='Medium', form='Workstation',
         screens='PEX-015'),

    # ---------------- Patients and the public ----------------
    dict(id='UR-82', family='Patients and the public', title='Patient',
         actors='ADM-011, CLI-016, FIN-014, PEX-001',
         tasks='Provide identity evidence; view released results and documents; request appointments; send messages; complete forms and report medications; view bills; manage consent and preferences', freq='Periodic',
         where='Home or anywhere; in the hospital at kiosks or the front desk', devices="Patient's own phone (most), tablet or computer",
         input='Touch', density='Low', form='Phone and web',
         screens='PEX-001, PEX-002, PEX-003, PEX-004, PEX-005, PEX-006, PEX-007, PEX-008, PEX-009, PEX-010, PEX-011, PEX-012',
         notes='Untrained, any age and literacy level, possibly unwell or anxious. Plain language and the national language first (NFR-012).'),
    dict(id='UR-83', family='Patients and the public', title='Authorized representative',
         actors='PEX-002',
         tasks="The patient's tasks, limited to the scope of the grant", freq='Periodic',
         where='Home or anywhere', devices='Own phone, tablet or computer', input='Touch', density='Low', form='Phone and web',
         screens='PEX-001, PEX-002, PEX-003, PEX-004, PEX-005, PEX-006, PEX-007, PEX-008, PEX-009, PEX-010, PEX-012',
         notes='Must always see whose record they are acting on.'),
    dict(id='UR-84', family='Patients and the public', title='External requester',
         actors='HIM-012',
         tasks='Submit a request for records and receive the release', freq='On event',
         where='Outside the hospital', devices='Paper, email or the portal', input='None in the HIS', density='Low', form='Phone and web',
         screens='',
         notes='No account in the HIS; served by UR-47, or through the portal if the requester is the patient.'),

    # ---------------- Cross-cutting ----------------
    dict(id='UR-85', family='Cross-cutting', title='All workforce users',
         actors='ESS-011, ANL-012',
         tasks='Sign on and complete MFA; receive and acknowledge notifications; claim and complete tasks; invoke Break-the-Glass where permitted; review AI-drafted content', freq='Continuous',
         where='Everywhere', devices='Every workforce device', input='As the host screen', density='Medium', form='Embedded',
         screens='ESS-001, ESS-004, ESS-010, CLI-019, ANL-002, ANL-013, EBP-001',
         notes='Not a job: the shared components every role uses. Listed so the shared components have an owner role in the usability test plan.'),
]

SYSTEM_ACTORS = (
    'ADM-012, ADM-013, ISE-009, ISE-010, ISE-013, ISE-014, CLI-013, CLI-014, CLI-015, ANC-020, '
    'FIN-015, FIN-016, FIN-017, HIM-013, PEX-013, PEX-014, ANL-015, EBP-014, ESS-013, ESS-014'
)

# What each form factor means for screen design (used in section 1 of the generated page, docs/design/user-roles.md).
FORM_DESIGN = {
    'Workstation': 'High density is acceptable for trained daily users: tables, keyboard shortcuts, side-by-side panels. Design for 1366 to 1920 pixel widths and for interruption.',
    'Workstation on wheels': 'Used standing, often one-handed, beside the patient. Larger targets than a desk, readable at arm\'s length, quick lock when walking away.',
    'Handheld': 'One task at a time, guided scan sequence, large touch targets usable with gloves, a hard stop on mismatch, and a visible commit state (UI-ISE-012).',
    'Theatre workstation': 'Readable from a distance, minimal typing, touch-first, often operated by a non-sterile team member on behalf of others.',
    'Reading station': 'Sits beside the image viewer on separate monitors; keyboard shortcuts and dictation, no mouse-heavy forms.',
    'Counter workstation': 'Fast, keyboard-driven transactions with peripherals (card reader, scanner, printers). The screen may face the patient, so mind what is shown.',
    'Wall display': 'Read-only, large type, status by colour and symbol together, and patient privacy rules for public areas.',
    'Phone and web': 'Mobile-first, plain language, accessible (WCAG 2.2 AA), localized, and usable without training.',
    'Embedded': 'Shared components inherit the host screen\'s form factor and must work in all of them.',
}
