=== data on file ===
patient: John Mwangi (#1) · ward: General Medicine Ward · beds: GMED-01, GMED-02

=== routes: the modules are mounted ===
  25 named routes registered                     0                          
  create resolves before the binding             /discharge-summaries/create 

=== fixtures: two stays through the real admission path ===
  reception registers the second patient         ok                         
second patient: Amina Wanjiru (#44)
  nurse admits patient one                       ok                         
  stay one opens as admitted                     admitted                   
  nurse admits patient two                       ok                         
  stay two opens as admitted                     admitted                   

=== discharge summary: the draft and its medicines ===
OK   discharge.create (doctor)                 104670 bytes
OK   admissions.show wiring (nurse)             84695 bytes
  doctor drafts the summary                      ok                         
  summary number follows DS-{ymd}-{nnnn}         yes                        
  opens as a draft                               draft                      
  snapshot carries the admission diagnosis       Community-acquired pneumonia, right lower lobe. 
  two drugs go home                              2                          
  medicine order is preserved                    1:2                        
  creation flash names patient and number        Discharge summary DS-20261022-0002 created for John Mwangi. 
  a second summary in flight refused             refused                    
  the refusal names the open one                 This admission already has a summary in progress (DS-20261022-0002, Draft). 
  a summary for another stay is fine             ok                         
  each stay carries its own summary              2                          
  a draft cannot skip straight to issued         refused                    
  the refusal spells out the rule                Only an approved summary can be issued. 
OK   discharge.show draft (doctor)              51283 bytes
OK   discharge.edit draft (doctor)             104788 bytes
  transfer without a destination refused         invalid: referred_to       
  the refusal names the facility rule            Name the facility the patient is being transferred or referred to. 
  a planned transfer to KNH sticks               ok                         
  the draft now reads as a transfer              transfer_out               
  the destination is on record                   Kenyatta National Hospital 
  medicines resynced to the one line             1                          
  update flash is terse                          Discharge summary DS-20261022-0002 updated. 

=== clearance: prepare, approve, the billing gate, issue ===
  doctor prepares the summary                    ok                         
  status reads prepared                          prepared                   
  preparer stamped                               4                          
  prepare flash sends it on                      Discharge summary DS-20261022-0002 prepared — sent for approval. 
  a prepared summary cannot be re-prepared       refused                    
  the refusal spells out the rule                Only a draft can be prepared for approval. 
  the preparer cannot approve their own work     refused                    
  the refusal names the second-clinician rule    The clinician who prepared a summary cannot approve their own work. 
  the consultant approves it                     ok                         
  status reads approved                          approved                   
  approver stamped                               3                          
  issue with money outstanding refused           refused                    
  the refusal states the balance and the route   Kshs 15,000.00 is still outstanding on this admission — confirm billing clearance (cash / SHIF / insurer) before issuing final clearance. 
  billing confirmation clears the gate           ok                         
  status reads issued                            issued                     
  discharge date stamped                         2026-10-22                 
  issuer stamped                                 2                          
  issue flash gives final clearance              Discharge summary DS-20261022-0002 issued — final clearance given. 
  the issue booked the follow-up appointment     1                          
OK   discharge.show issued (admin)              62096 bytes
OK   discharge.print issued (admin)             10840 bytes

=== the issued record: amend, re-edit, re-issue ===
  an issued summary cannot be edited             refused                    
  the refusal names the draft rule               Only a draft — or a summary sent back for amendment — can be edited. 
  amending without a reason refused              invalid: notes             
  the refusal asks for the reason                An amendment needs a reason on record. 
  amending with a reason sticks                  ok                         
  status reads amended                           amended                    
  amendment counter bumped                       1                          
  the reason is on the record                    1                          
  amend flash returns it to the workflow         Discharge summary DS-20261022-0002 amended — it returns to the workflow for re-issue. 
OK   discharge.show amended (admin)             61852 bytes
OK   discharge.edit amended (doctor)           104611 bytes
  the amended summary re-edits to a draft        ok                         
  status is draft again                          draft                      
  the approval stamps are wiped                  1                          
  the preparer stamp is wiped                    1                          
  second preparation                             ok                         
  second approval by the consultant              ok                         
  second issue with billing confirmed            ok                         
  issued again                                   issued                     
  the follow-up stayed deduplicated              1                          
  amendment counter persists through re-issue    1                          
OK   discharge.index (doctor)                   45840 bytes
OK   discharge.index status=issued (admin)      55847 bytes

=== the death summary: a closed file, who may write it ===
  a clinical officer cannot write a death summary HTTP 403                   
  the doctor closes the file                     ok                         
  death forces the disposition                   deceased                   
  death forces the condition                     deceased                   
  the death flag is set                          1                          
  next of kin notification on record             1                          
  follow-up advice is blanked on a death         1                          
  a death summary missing its time refused       invalid: death_datetime    
OK   discharge.show death (doctor)              49305 bytes
OK   discharge.print death (doctor)              8459 bytes

=== the desk: schedule, duplicate guard, administer, roll forward ===
OK   immunizations.create search (reception)    26921 bytes
OK   immunizations.create form (reception)      32102 bytes
  reception schedules penta dose one today       ok                         
  a dose due today reads as due                  due                        
  schedule flash names the patient and date      Dose 1 of Pentavalent Vaccine (DTP-HepB-Hib) scheduled for John Mwangi on 22 Oct 2026. 
  a duplicate open dose refused                  invalid: dose_number       
  the refusal names the open dose                Dose 1 of Pentavalent Vaccine (DTP-HepB-Hib) is already open for this patient. 
OK   immunizations.show due (nurse)             42739 bytes
  administering without a batch refused          invalid: batch_number,expiry_date 
  nurse administers dose one                     ok                         
  status reads administered                      administered               
  administered_by is the nurse                   6                          
  the batch is on the cold-chain record          PEN-A412B7                 
  administration flash rolls dose two forward    Dose 1 of Pentavalent Vaccine (DTP-HepB-Hib) administered — dose 2 due 19 Nov 2026. 
  dose two auto-scheduled by the interval        2026-11-19                 
  the roll-forward is a fresh scheduled dose     scheduled                  
  a closed dose cannot be administered again     refused                    
  the refusal spells out the rule                Only an open dose can be administered — this one is Administered. 
OK   immunizations.show administered (nurse)    38997 bytes
  nurse administers dose two                     ok                         
  dose three rolls forward                       scheduled                  
  nurse administers dose three                   ok                         
  the course is complete at three doses          3                          
  completion flash says the course is done       Dose 3 of Pentavalent Vaccine (DTP-HepB-Hib) administered — the course is complete. 

=== outcomes, overdue maths and the reminder ===
  reception back-books a tetanus dose as overdue ok                         
  a past date lands as overdue                   overdue                    
  the desk counts the overdue booking            yes                        
  marking refused without a reason refused       invalid: refusal_reason    
  the refusal asks for the reason                Refused needs a reason on record. 
  marking refused with counselling on record     ok                         
  status reads refused                           refused                    
  the reason is on the register                  Declined after counselling; asked to return next outreach. 
OK   immunizations.show refused (nurse)         37181 bytes
  reception schedules MR1 for tomorrow           ok                         
  tomorrow reads as scheduled                    scheduled                  
  reception queues the SMS reminder              ok                         
  the reminder message is queued for the patient 1                          
  the dose remembers the reminder went out       1                          
  a second reminder refused                      refused                    
  the refusal says one per dose                  A reminder has already gone out for this dose. 
OK   immunizations.show reminder sent (reception)   29903 bytes
OK   immunizations.index (nurse)                38381 bytes
OK   immunizations.index overdue tab (nurse)    36677 bytes
OK   immunizations.index all tab q (nurse)      45939 bytes
OK   vaccines.index (nurse)                     62012 bytes
OK   vaccines.index q (reception)               29044 bytes
OK   vaccines.create (admin)                    60163 bytes
OK   vaccines.edit (admin)                      60644 bytes
OK   coverage report (doctor)                   63324 bytes

=== confidentiality: the sealed patient leaves every surface ===
  the sealed patient blocks the summary view     HTTP 404                   
  the sealed patient blocks the summary print    HTTP 404                   
  the sealed patient blocks the dose view        HTTP 404                   
  clearance still opens the summary              ok                         
  the desk drops the sealed patient              0                          
  clearing the seal reopens the dose             ok                         
  the desk repopulates once cleared              yes                        

=== role matrix ===
  doctor · discharge-summaries.view             yes                        
  doctor · discharge-summaries.create           yes                        
  doctor · discharge-summaries.edit             yes                        
  doctor · discharge-summaries.approve          yes                        
  doctor · discharge-summaries.issue            yes                        
  doctor · discharge-summaries.amend            yes                        
  doctor · discharge-summaries.death            yes                        
  doctor · vaccines.view                        yes                        
  doctor · vaccines.manage                      no                         
  doctor · immunizations.view                   yes                        
  doctor · immunizations.record                 yes                        
  doctor · immunizations.schedule               yes                        
  doctor · immunizations.reports                yes                        
  consultant · discharge-summaries.view         yes                        
  consultant · discharge-summaries.create       yes                        
  consultant · discharge-summaries.edit         yes                        
  consultant · discharge-summaries.approve      yes                        
  consultant · discharge-summaries.issue        yes                        
  consultant · discharge-summaries.amend        yes                        
  consultant · discharge-summaries.death        yes                        
  consultant · vaccines.view                    yes                        
  consultant · vaccines.manage                  yes                        
  consultant · immunizations.view               yes                        
  consultant · immunizations.record             yes                        
  consultant · immunizations.schedule           yes                        
  consultant · immunizations.reports            yes                        
  hospital administrator · discharge-summaries.view yes                        
  hospital administrator · discharge-summaries.create no                         
  hospital administrator · discharge-summaries.edit no                         
  hospital administrator · discharge-summaries.approve yes                        
  hospital administrator · discharge-summaries.issue yes                        
  hospital administrator · discharge-summaries.amend yes                        
  hospital administrator · discharge-summaries.death no                         
  hospital administrator · vaccines.view        yes                        
  hospital administrator · vaccines.manage      yes                        
  hospital administrator · immunizations.view   yes                        
  hospital administrator · immunizations.record yes                        
  hospital administrator · immunizations.schedule yes                        
  hospital administrator · immunizations.reports yes                        
  clinical officer · discharge-summaries.view   yes                        
  clinical officer · discharge-summaries.create yes                        
  clinical officer · discharge-summaries.edit   no                         
  clinical officer · discharge-summaries.approve no                         
  clinical officer · discharge-summaries.issue  no                         
  clinical officer · discharge-summaries.amend  no                         
  clinical officer · discharge-summaries.death  no                         
  clinical officer · vaccines.view              yes                        
  clinical officer · vaccines.manage            no                         
  clinical officer · immunizations.view         yes                        
  clinical officer · immunizations.record       yes                        
  clinical officer · immunizations.schedule     no                         
  clinical officer · immunizations.reports      no                         
  nurse · discharge-summaries.view              yes                        
  nurse · discharge-summaries.create            no                         
  nurse · discharge-summaries.edit              no                         
  nurse · discharge-summaries.approve           no                         
  nurse · discharge-summaries.issue             no                         
  nurse · discharge-summaries.amend             no                         
  nurse · discharge-summaries.death             no                         
  nurse · vaccines.view                         yes                        
  nurse · vaccines.manage                       no                         
  nurse · immunizations.view                    yes                        
  nurse · immunizations.record                  yes                        
  nurse · immunizations.schedule                no                         
  nurse · immunizations.reports                 no                         
  icu nurse · discharge-summaries.view          yes                        
  icu nurse · discharge-summaries.create        no                         
  icu nurse · discharge-summaries.edit          no                         
  icu nurse · discharge-summaries.approve       no                         
  icu nurse · discharge-summaries.issue         no                         
  icu nurse · discharge-summaries.amend         no                         
  icu nurse · discharge-summaries.death         no                         
  icu nurse · vaccines.view                     no                         
  icu nurse · vaccines.manage                   no                         
  icu nurse · immunizations.view                no                         
  icu nurse · immunizations.record              no                         
  icu nurse · immunizations.schedule            no                         
  icu nurse · immunizations.reports             no                         
  receptionist · discharge-summaries.view       no                         
  receptionist · discharge-summaries.create     no                         
  receptionist · discharge-summaries.edit       no                         
  receptionist · discharge-summaries.approve    no                         
  receptionist · discharge-summaries.issue      no                         
  receptionist · discharge-summaries.amend      no                         
  receptionist · discharge-summaries.death      no                         
  receptionist · vaccines.view                  yes                        
  receptionist · vaccines.manage                no                         
  receptionist · immunizations.view             yes                        
  receptionist · immunizations.record           no                         
  receptionist · immunizations.schedule         yes                        
  receptionist · immunizations.reports          no                         
  system administrator · discharge-summaries.view yes                        
  system administrator · discharge-summaries.create yes                        
  system administrator · discharge-summaries.edit yes                        
  system administrator · discharge-summaries.approve yes                        
  system administrator · discharge-summaries.issue yes                        
  system administrator · discharge-summaries.amend yes                        
  system administrator · discharge-summaries.death yes                        
  system administrator · vaccines.view          yes                        
  system administrator · vaccines.manage        yes                        
  system administrator · immunizations.view     yes                        
  system administrator · immunizations.record   yes                        
  system administrator · immunizations.schedule yes                        
  system administrator · immunizations.reports  yes                        
  lab technician (no access) · discharge-summaries.view no                         
  lab technician (no access) · discharge-summaries.create no                         
  lab technician (no access) · vaccines.view    no                         
  lab technician (no access) · vaccines.manage  no                         
  lab technician (no access) · immunizations.view no                         
  lab technician (no access) · immunizations.record no                         
  lab technician (no access) · immunizations.schedule no                         
  lab technician (no access) · immunizations.reports no                         
  billing officer (no clinical access) · discharge-summaries.view no                         
  billing officer (no clinical access) · discharge-summaries.create no                         
  billing officer (no clinical access) · vaccines.view no                         
  billing officer (no clinical access) · vaccines.manage no                         
  billing officer (no clinical access) · immunizations.view no                         
  billing officer (no clinical access) · immunizations.record no                         
  billing officer (no clinical access) · immunizations.schedule no                         
  billing officer (no clinical access) · immunizations.reports no                         

=== audit trail ===
  summary creation audited under Discharge       1                          
  the clearance workflow writes updates to the trail yes                        
  drugs-to-take-home lines audited               2                          
  the death summary is on the trail              1                          
  dose administration audited under Vaccination  yes                        
  the roll-forward dose is audited too           1                          

>>> discharge + vaccination green — clearance workflow, billing gate, death summary, desk, roll-forward and confidentiality all verified
