9.0 KiB
Epic 1: 3-Portal Cohort Management System
Epic Goal: Transform DocuSeal into a specialized 3-portal cohort management system that enables training institutions to manage complete document workflows from cohort creation through sponsor finalization.
Integration Requirements:
- Must integrate with existing DocuSeal form builder for agreement templates
- Must use existing document storage and signing infrastructure
- Must extend existing authentication and user management
- Must maintain backward compatibility with all existing DocuSeal features
Story 1.1: Institution and Admin Management
As a system administrator, I want to create and manage training institutions with multiple admin users (super and regular admins), so that private training institutions can manage their cohorts independently.
Acceptance Criteria:
- Database schema for institutions and admin roles exists
- Super admins can create institutions and invite other admins
- Regular admins can manage cohorts within their institution
- Admins cannot access other institutions' data
- Role-based permissions are enforced at API and UI levels
Integration Verification:
- IV1: Existing DocuSeal user authentication remains functional
- IV2: New role system doesn't conflict with existing DocuSeal user roles
- IV3: Performance impact on existing user operations is minimal
Story 1.2: Cohort Creation and Template Management
As an admin, I want to create cohorts with program type selection, student count, sponsor email, and upload agreement templates, so that I can set up training programs with all necessary documentation.
Acceptance Criteria:
- Cohort creation form captures all required fields
- Admins can upload main agreement template using DocuSeal form builder
- Admins can upload additional supporting document templates
- System validates template formats and requirements
- Cohort is saved with all associated templates and metadata
Integration Verification:
- IV1: DocuSeal form builder integration works for template creation
- IV2: Existing document storage handles new template types
- IV3: Template associations don't break existing submission workflows
Story 1.3: Student Invitation and Enrollment
As an admin, I want to generate invite links or send email invitations to students for cohort enrollment, so that students can access the student portal and begin their submission process.
Acceptance Criteria:
- Admin can generate unique invite link for each student
- Admin can bulk send email invitations to all students
- Invite links are single-use and expire after enrollment
- Students can access student portal via invite without existing account
- Student enrollment creates cohort_enrollment record with "Waiting" state
Integration Verification:
- IV1: Existing DocuSeal email system handles new invitation templates
- IV2: Authentication works for new users without breaking existing users
- IV3: Enrollment records link properly to existing user/submission infrastructure
Story 1.4: Admin Document Verification Workflow
As an admin, I want to manually review and verify student-uploaded documents with ability to reject with reasons, so that I can ensure document compliance before sponsor review.
Acceptance Criteria:
- Admin dashboard shows pending verifications across all cohorts
- Admin can view student-uploaded documents with preview
- Admin can approve or reject documents with required reason
- Rejection notifications sent to students with reason
- Audit trail captures all verification actions with timestamps
Integration Verification:
- IV1: Document preview uses existing DocuSeal file rendering
- IV2: Notification system doesn't interfere with existing DocuSeal emails
- IV3: Audit trail storage doesn't impact existing document storage performance
Story 1.5: Student Portal - Document Upload and Agreement Completion
As a student, I want to upload required documents, fill and sign the main agreement and supporting documents, so that I can complete my enrollment requirements.
Acceptance Criteria:
- Student portal shows their cohort and required documents
- Students can upload matric, ID, disability docs, qualifications, certificates
- Students can fill and sign main agreement using DocuSeal form builder
- Students can fill and sign additional supporting documents
- System updates enrollment state from "Waiting" → "In Progress" → "Complete"
- Students can submit all documents when complete
Integration Verification:
- IV1: DocuSeal form builder works seamlessly for student-facing forms
- IV2: File uploads use existing storage and validation
- IV3: State transitions don't conflict with existing submission states
Story 1.6: Sponsor Portal - Multi-Student Review and Signing
As a sponsor, I want to review and sign agreements for all students in a cohort, with individual and bulk options, so that I can efficiently complete sponsor responsibilities.
Acceptance Criteria:
- Sponsor portal shows cohort overview with all student statuses
- Sponsor can view individual student submissions and documents
- Sponsor can sign each student's agreements individually
- Sponsor can bulk sign all students at once
- Sponsor can submit all signatures to finalize cohort
- Sponsor portal only accessible after all students complete submissions
Integration Verification:
- IV1: Sponsor authentication works without existing DocuSeal account
- IV2: Signing workflow uses existing DocuSeal signature infrastructure
- IV3: Bulk operations don't impact existing single-document signing performance
Story 1.7: Admin Finalization and Document Access
As an admin, I want to finalize the cohort after sponsor completion and access all signed documents, so that I can complete the workflow and maintain records.
Acceptance Criteria:
- Admin can finalize cohort after sponsor submission
- System generates complete document packages for each student
- Admin can download individual or bulk signed documents
- Finalized cohorts show completion status in dashboard
- Admin can access historical cohort data and reports
Integration Verification:
- IV1: Document generation uses existing DocuSeal PDF processing
- IV2: Download functionality doesn't break existing document downloads
- IV3: Historical data access doesn't impact current cohort performance
Story 1.8: Notification and Reminder System
As a system, I want to send automated notifications for all workflow events and reminders for incomplete actions, so that all parties stay informed and workflows complete efficiently.
Acceptance Criteria:
- Cohort creation triggers admin notification
- Student invite sends email with portal access link
- Submission reminders sent after configurable delay
- State change notifications sent to relevant parties
- Sponsor access notification sent when all students complete
- Deadline reminders configurable per cohort
Integration Verification:
- IV1: All notifications use existing DocuSeal email infrastructure
- IV2: Reminder scheduling doesn't impact Sidekiq job queue performance
- IV3: Email templates maintain existing DocuSeal branding and formatting
Story 1.9: Dashboard and Analytics
As an admin, I want to see real-time dashboard showing cohort status, completion metrics, and analytics, so that I can monitor progress and identify bottlenecks.
Acceptance Criteria:
- Dashboard shows all cohorts with completion percentages
- Real-time updates for student submission states
- Analytics on completion times, document types, verification rates
- Export functionality for reports (CSV, PDF)
- Role-based dashboard views (admin vs. sponsor vs. student)
Integration Verification:
- IV1: Dashboard queries don't impact existing DocuSeal performance
- IV2: Analytics data collection doesn't interfere with document processing
- IV3: Export functionality uses existing DocuSeal reporting infrastructure
Story 1.10: State Management and Workflow Orchestration
As a system, I want to manage complex state transitions and workflow orchestration across all three portals, so that the entire cohort workflow progresses correctly and no steps are skipped.
Acceptance Criteria:
- State machine defined for all enrollment states (Waiting → In Progress → Complete)
- Workflow rules enforced: students can't submit until docs uploaded, sponsor can't access until all students complete, etc.
- State transitions are atomic and handle concurrent operations
- Rollback capabilities for incorrect state transitions
- State history audit trail for troubleshooting
Integration Verification:
- IV1: State management doesn't conflict with existing DocuSeal submission states
- IV2: Workflow orchestration handles edge cases (student dropout, template changes, etc.)
- IV3: Performance remains acceptable with large cohorts and concurrent operations