agdar/SIGNING_EDIT_PREVENTION_IMPLEMENTATION.md
Marwan Alwali 2f1681b18c update
2025-11-11 13:44:48 +03:00

2.5 KiB

Signing Edit Prevention Implementation Plan

Overview

Implement edit prevention after signing for all clinical documents across all apps.

Apps with Signing Functionality

  1. ABA - ABASession, ABAConsult (2 models)
  2. OT - OTSession, OTConsult (2 models)
  3. SLP - SLPConsult, SLPAssessment, SLPIntervention, SLPProgressReport (4 models)
  4. Medical - MedicalConsultation, MedicalFollowUp (2 models)
  5. Nursing - NursingEncounter (1 model)

Total: 11 models

Implementation Strategy

1. Create Mixin for Edit Prevention

Create SignedDocumentEditPreventionMixin in core/mixins.py that:

  • Checks if document is signed in dispatch() method
  • Prevents access to update views for signed documents
  • Shows appropriate error message
  • Redirects to detail view

2. Update All UpdateView Classes

Add the mixin to all 11 update views:

  • ABASessionUpdateView
  • ABAConsultUpdateView
  • OTSessionUpdateView
  • OTConsultUpdateView
  • SLPConsultUpdateView
  • SLPAssessmentUpdateView
  • SLPInterventionUpdateView
  • SLPProgressReportUpdateView
  • MedicalConsultationUpdateView
  • MedicalFollowUpUpdateView
  • NursingEncounterUpdateView

3. Update Confirmation Messages

Update all sign view confirmation messages to include: "Are you sure you want to sign this document? Once signed, no further editing will be allowed. This action cannot be undone."

4. Update Templates

Update detail templates to:

  • Hide "Edit" button if document is signed
  • Show "Signed - No Editing Allowed" message

Files to Modify

Python Files (12 files)

  1. core/mixins.py - Add new mixin
  2. aba/views.py - Update 2 views
  3. ot/views.py - Update 2 views
  4. slp/views.py - Update 4 views
  5. medical/views.py - Update 2 views
  6. nursing/views.py - Update 1 view

Template Files (11 files)

  1. aba/templates/aba/session_detail.html
  2. aba/templates/aba/consult_detail.html
  3. ot/templates/ot/session_detail.html
  4. ot/templates/ot/consult_detail.html
  5. slp/templates/slp/consultation_detail.html
  6. slp/templates/slp/assessment_detail.html
  7. slp/templates/slp/intervention_detail.html
  8. slp/templates/slp/progress_detail.html
  9. medical/templates/medical/consultation_detail.html
  10. medical/templates/medical/followup_detail.html
  11. nursing/templates/nursing/encounter_detail.html

Implementation Steps

  1. Create mixin in core/mixins.py
  2. Update all UpdateView classes
  3. Update all sign view confirmation messages
  4. Update all detail templates
  5. Test implementation