# BV-SIS Module Dependencies
## Inter-Module Dependency Map

**Document Version:** 1.0

---

## 1. Dependency Overview

Institution Setup is the **foundation layer**. All other modules depend on it either directly or transitively. Student Registration is the **core operational hub** connecting admission, finance, examination, and communications.

---

## 2. Dependency Diagram

```mermaid
flowchart TD
    IS[Institution Setup] --> CM[Course Management]
    IS --> SA[Student Admission]
    IS --> SF[Student Finance]
    IS --> SR[Student Registration]
    
    CM --> SR
    CM --> EX[Examination]
    
    SA --> SR
    SA --> SF
    
    SR --> SF
    SR --> EX
    SR --> OR[Online Registration]
    SR --> SIC[Student Identity Cards]
    SR --> BS[BulkSMS and Email]
    
    SF --> EX
    SF --> MR[Management Reports]
    
    EX --> EC[Examination Configuration]
    EX --> EM[Examination Marking]
    EC --> EM
    
    EM --> SF
    
    SR --> MR
    SF --> MR
    EX --> MR
    
    SM[System Maintenance] --> ALL[All Modules]
```

---

## 3. Module Dependency Matrix

| Module | Depends On | Required Before |
|--------|-----------|-----------------|
| **Institution Setup** | System Maintenance (users) | Nothing — first to implement |
| **Course Management** | Institution Setup (Faculty, Programmes) | Institution Setup |
| **Student Admission** | Institution Setup (Programmes, Sessions, Intakes) | Institution Setup |
| **Student Finance** | Institution Setup, Student Admission (optional: students) | Institution Setup |
| **Student Registration** | Institution Setup, Course Management, Student Admission | Institution + Course Management |
| **Online Registration** | Student Registration, Student Admission | Student Registration |
| **Examination** | Course Management, Student Registration | Course Management + Student Registration |
| **Examination Configuration** | Course Management, Institution Setup | Course Management |
| **Examination Marking** | Examination, Examination Configuration, Student Registration | Examination Configuration |
| **Management Reports** | All operational modules | All modules (incremental) |
| **BulkSMS and Email** | Student Registration (student contacts) | Student Registration |
| **System Maintenance** | Nothing | Can be implemented first (parallel) |
| **Student Identity Cards** | Student Registration (student biodata/photo) | Student Registration |

---

## 4. Detailed Dependencies by Module

### 4.1 Institution Setup

**Provides to all modules:**
- Institution name/abbrev (branding, documents)
- Campuses (student school assignment)
- Faculties (course and programme organization)
- Programs / Programmes / Tracks (qualification hierarchy)
- Programme Structures (curriculum templates)
- Academic Paths, Sessions, Intakes (time dimension)
- Study Plan Periods (semester/year structure)

**Depends on:**
- System Maintenance → Users (for created_by audit fields)

**Internal dependencies (setup order within module):**
```
Institution → Campuses → Faculty → Area of Study → Programme of Study
  → Programme Track → Study Plan Periods → Programme Structure
  → Academic Path → Sessions Setup → Academic Intake → Dashboard
```

---

### 4.2 Course Management

**Depends on:**
- Faculty (from Institution Setup) — required for course creation
- Programmes (from Institution Setup) — for course-programme assignment

**Provides to:**
- Programme Structure — courses referenced in structure items
- Student Registration — course enrollment
- Student Finance — course fees
- Examination — exam scheduling and marking per course
- Course Managers → Examination Marking (lecturer access)

---

### 4.3 Student Admission

**Depends on:**
- Programmes, Sessions, Intakes — for application intake selection
- Study Modes, Program Classes — lookup data
- Admission Settings — configuration

**Provides to:**
- Student Registration — admitted applications become students
- Student Finance — registration fees
- BulkSMS — admission notification letters
- Online Registration — application portal

**Workflow dependency:**
```
Admission Settings → Entry Requirements → Application Data Entry
  → Approval → Registration Fees → Student Registration (convert to student)
```

---

### 4.4 Student Finance

**Depends on:**
- Students (from Student Registration or Admission)
- Programmes (for fee assignment)
- Courses (for course fees)
- Sessions (for session-based billing)

**Provides to:**
- Examination — result release gate (Release Student/Session Results)
- Student Registration — clearance status affects registration
- Management Reports — financial analytics

**Critical gate dependency:**
```
Student Finance (Clearance) → Examination (Result Release)
```

---

### 4.5 Student Registration

**Depends on:**
- Institution Setup — all hierarchy for enrollment
- Course Management — courses for enrollment
- Computer Number Scheme — student number generation
- Student Admission — applications convert to students

**Provides to:**
- Student Finance — student records for invoicing
- Examination — enrolled students for marks
- BulkSMS — student contact data
- Student Identity Cards — biodata and photo
- Online Registration — admin approval queue
- Management Reports — enrollment statistics

**Internal tab dependencies:**
```
Biodata (create student) → Course Enrollment (assign programme/session)
  → Courses (register courses) → Register Student (confirm registration)
  → Program Structure (view curriculum)
```

---

### 4.6 Online Registration

**Depends on:**
- Student Registration — admin approval workflow (Online Registration Requests)
- Student Admission — application forms and requirements
- Student Finance — fee preview (enterprise)
- Institution Setup — available programmes/sessions

**Provides to:**
- Student Registration — approved requests create/update enrollments

---

### 4.7 Examination Suite

**Examination depends on:**
- Courses, Sessions — exam scheduling
- Student Registration — enrolled students

**Examination Configuration depends on:**
- Courses — grading schemes per course/programme
- Institution Setup — sessions, periods

**Examination Marking depends on:**
- Examination Configuration — grading rules
- Course Managers — lecturer assignments
- Student Courses — which students take which courses
- Student Finance — result release blocked if fees unpaid

---

### 4.8 BulkSMS and Email

**Depends on:**
- Student Registration — phone numbers, email addresses
- Student Admission — applicant contacts (pre-admission SMS)
- Contact Groups — custom groups

**Provides to:**
- All modules — notification delivery channel

---

### 4.9 Student Identity Cards

**Depends on:**
- Student Registration — photo, name, student number, programme
- Institution Setup — institution name/logo for card template

---

### 4.10 Management Reports

**Depends on:**
- All modules — aggregates data from every source

**Report data sources:**
| Report | Source Modules |
|--------|---------------|
| Enrollment | Student Registration, Institution Setup |
| Financial | Student Finance |
| Examination | Examination Marking |
| Admission | Student Admission |
| Communication | BulkSMS |

---

### 4.11 System Maintenance

**Depends on:** Nothing (foundational)

**Provides to:** All modules — authentication, authorization, audit, configuration

---

## 5. Data Flow Dependencies

### 5.1 Student Creation Flow
```
Application (Admission) → Approve → Generate Student Number (Registration)
  → Create Student Record → Assign Programme → Enroll Courses
  → Generate Invoice (Finance) → Register for Session
```

### 5.2 Result Release Flow
```
Enter Marks (Examination Marking) → Moderate → Process Results
  → Check Finance Clearance (Student Finance) → Release Results
  → Notify Student (BulkSMS)
```

### 5.3 Registration Flow
```
Configure Intake (Institution Setup) → Open Admission (Admission)
  → Receive Applications → Admit → Register Student (Registration)
  → Assign Courses → Confirm Registration → Issue ID Card
```

---

## 6. Lookup Data Dependencies

| Lookup Table | Used By Modules |
|-------------|-----------------|
| countries | Student Registration, Student Admission |
| study_modes | Student Registration, Student Admission |
| program_classes | Student Registration |
| marital_statuses | Student Registration, Student Admission |
| sponsorship_types | Student Registration, Student Admission |
| period_schemes | Institution Setup |
| admission_schemes | Student Admission |
| offence_types | Student Registration |
| fee_categories | Student Finance |

---

## 7. Circular Dependency Prevention

| Potential Cycle | Resolution |
|----------------|------------|
| Registration ↔ Finance | Finance reads student data; Registration reads clearance status (one-way read) |
| Examination ↔ Finance | Finance gates result release; Examination does not modify finance (one-way gate) |
| Admission ↔ Registration | Admission creates application; Registration creates student on admission (sequential) |

---

## 8. Implementation Dependency Order

See `13_DEVELOPMENT_ROADMAP.md` for phased implementation. Summary:

```
Phase 0: System Maintenance (auth, users, roles)
Phase 1: Institution Setup (complete hierarchy)
Phase 2: Course Management
Phase 3: Student Admission
Phase 4: Student Registration
Phase 5: Student Finance
Phase 6: BulkSMS and Email
Phase 7: Student Identity Cards
Phase 8: Online Registration
Phase 9: Examination Suite
Phase 10: Management Reports
```

---

*End of Module Dependencies*
