313 lines
10 KiB
Markdown
313 lines
10 KiB
Markdown
# FarmerTraining Model Documentation
|
|
|
|
## Overview
|
|
Model FarmerTraining adalah junction table yang menghubungkan petani dengan program pelatihan, berfungsi sebagai sistem tracking untuk enrollment, progress, dan completion pelatihan. Model ini memungkinkan manajemen pembelajaran yang personal dan terstruktur untuk setiap petani.
|
|
|
|
## Business Context
|
|
Model FarmerTraining berfungsi sebagai:
|
|
- **Enrollment Management**: Pendaftaran petani ke program pelatihan
|
|
- **Progress Tracking**: Monitoring kemajuan pembelajaran setiap petani
|
|
- **Performance Assessment**: Evaluasi hasil dan pencapaian pelatihan
|
|
- **Assignment System**: Penugasan pelatihan oleh admin kepada petani
|
|
- **Compliance Tracking**: Memastikan petani memenuhi requirement pelatihan
|
|
|
|
## Model Structure
|
|
|
|
### Primary Fields
|
|
|
|
#### **Identification & Relationships**
|
|
- **`id`** (String, Primary Key): Unique identifier menggunakan CUID
|
|
- **`farmerId`** (String, Foreign Key): Referensi ke petani yang mengikuti pelatihan
|
|
- **`trainingId`** (String, Foreign Key): Referensi ke program pelatihan yang diikuti
|
|
|
|
#### **Status & Progress Tracking**
|
|
- **`status`** (TrainingStatus Enum, Default: ENROLLED): Status pelatihan petani
|
|
- **`progress`** (Integer, Default: 0): Persentase kemajuan pelatihan (0-100)
|
|
- **`score`** (Float, Optional): Nilai/skor yang diperoleh petani
|
|
- **`completedAt`** (DateTime, Optional): Tanggal penyelesaian pelatihan
|
|
|
|
#### **Assignment Management**
|
|
- **`assignedBy`** (String, Optional): ID admin yang menugaskan pelatihan
|
|
- **`assignedAt`** (DateTime, Optional): Tanggal penugasan
|
|
- **`assignmentReason`** (String, Optional): Alasan penugasan pelatihan
|
|
- **`deadline`** (DateTime, Optional): Batas waktu penyelesaian pelatihan
|
|
|
|
#### **Metadata**
|
|
- **`createdAt`** (DateTime, Default: now()): Tanggal enrollment
|
|
- **`updatedAt`** (DateTime, Auto-update): Tanggal terakhir diupdate
|
|
|
|
## Enums Definition
|
|
|
|
### TrainingStatus
|
|
- **ENROLLED**: Petani telah mendaftar/ditugaskan pelatihan
|
|
- **IN_PROGRESS**: Petani sedang mengikuti pelatihan
|
|
- **COMPLETED**: Petani telah menyelesaikan pelatihan
|
|
- **DROPPED**: Petani keluar dari pelatihan sebelum selesai
|
|
|
|
## Database Constraints
|
|
|
|
### Unique Constraints
|
|
- **`farmerId + trainingId`**: Satu petani hanya dapat memiliki satu record per training
|
|
- Mencegah duplicate enrollment
|
|
|
|
### Indexes
|
|
- **`farmerId`**: Untuk query berdasarkan petani
|
|
- **`trainingId`**: Untuk query berdasarkan pelatihan
|
|
- **`status`**: Untuk filtering berdasarkan status
|
|
- **`completedAt`**: Untuk sorting berdasarkan tanggal completion
|
|
- **`progress`**: Untuk analytics dan reporting
|
|
- **`assignedBy`**: Untuk tracking assignment oleh admin
|
|
- **`assignedAt`**: Untuk chronological analysis
|
|
- **`deadline`**: Untuk monitoring deadline
|
|
|
|
## Business Rules
|
|
|
|
### Enrollment Rules
|
|
1. **Self-Enrollment**: Petani dapat mendaftar sendiri ke pelatihan terbuka
|
|
2. **Admin Assignment**: Admin dapat menugaskan pelatihan kepada petani
|
|
3. **Prerequisite Check**: Sistem harus memvalidasi prerequisite sebelum enrollment
|
|
4. **Capacity Limit**: Enrollment dibatasi oleh `maxParticipants` dari Training
|
|
|
|
### Status Transitions
|
|
```
|
|
ENROLLED → IN_PROGRESS (petani mulai mengikuti)
|
|
IN_PROGRESS → COMPLETED (petani selesai dengan success)
|
|
IN_PROGRESS → DROPPED (petani keluar sebelum selesai)
|
|
ENROLLED → DROPPED (petani tidak mulai dalam periode tertentu)
|
|
```
|
|
|
|
### Progress Rules
|
|
- Progress dimulai dari 0% saat enrollment
|
|
- Progress diupdate berdasarkan completion modul/section
|
|
- Progress 100% secara otomatis mengubah status ke COMPLETED
|
|
- Score hanya dapat diisi untuk status COMPLETED
|
|
|
|
### Assignment Rules
|
|
- Admin dapat menugaskan pelatihan wajib kepada petani
|
|
- Deadline dapat ditetapkan untuk assignment
|
|
- Assignment reason wajib diisi untuk tracking compliance
|
|
- Notifikasi otomatis dikirim saat assignment
|
|
|
|
## Use Cases
|
|
|
|
### 1. Self-Enrollment
|
|
**Actor**: Petani
|
|
**Flow**:
|
|
1. Petani browse training catalog
|
|
2. Pilih training yang diinginkan
|
|
3. Check prerequisites (jika ada)
|
|
4. Enrollment dengan status ENROLLED
|
|
5. Sistem create record FarmerTraining
|
|
6. Notifikasi confirmation dikirim
|
|
|
|
### 2. Admin Assignment
|
|
**Actor**: Admin
|
|
**Flow**:
|
|
1. Admin pilih petani yang akan ditugaskan
|
|
2. Pilih training yang wajib diikuti
|
|
3. Set deadline dan reason
|
|
4. Sistem create record dengan status ENROLLED
|
|
5. Notifikasi assignment dikirim ke petani
|
|
6. Tracking compliance dimulai
|
|
|
|
### 3. Progress Tracking
|
|
**Actor**: Sistem/Petani
|
|
**Flow**:
|
|
1. Petani mulai mengikuti training
|
|
2. Status berubah ke IN_PROGRESS
|
|
3. Progress diupdate setiap completion milestone
|
|
4. Sistem tracking time spent dan engagement
|
|
5. Analytics diupdate real-time
|
|
|
|
### 4. Training Completion
|
|
**Actor**: Petani/Sistem
|
|
**Flow**:
|
|
1. Petani menyelesaikan semua modul
|
|
2. Progress mencapai 100%
|
|
3. Status berubah ke COMPLETED
|
|
4. CompletedAt diset ke timestamp saat ini
|
|
5. Score diinput (jika ada assessment)
|
|
6. Certificate generation (jika applicable)
|
|
7. Completion notification dikirim
|
|
|
|
### 5. Compliance Monitoring
|
|
**Actor**: Admin
|
|
**Flow**:
|
|
1. Monitor training assignments dengan deadline
|
|
2. Identify petani yang overdue
|
|
3. Send reminder notifications
|
|
4. Escalate jika masih non-compliant
|
|
5. Generate compliance reports
|
|
|
|
## Integration Points
|
|
|
|
### Internal Systems
|
|
- **Training Model**: Referensi ke program pelatihan
|
|
- **Farmer Model**: Referensi ke data petani
|
|
- **Notification System**: Automated notifications
|
|
- **Certificate System**: Issuing certificates upon completion
|
|
- **Analytics System**: Progress dan performance metrics
|
|
|
|
### External Systems
|
|
- **Learning Management System (LMS)**: Sync progress data
|
|
- **Assessment Tools**: Import scores dan evaluations
|
|
- **Email/SMS System**: Notifications dan reminders
|
|
- **Mobile App**: Real-time progress sync
|
|
|
|
## Analytics & Reporting
|
|
|
|
### Key Metrics
|
|
- **Enrollment Rate**: Jumlah enrollment per training
|
|
- **Completion Rate**: Persentase completion per training
|
|
- **Average Progress**: Rata-rata progress per training
|
|
- **Time to Complete**: Waktu rata-rata untuk menyelesaikan
|
|
- **Drop-out Rate**: Persentase yang dropped
|
|
- **Assignment Compliance**: Tingkat compliance untuk assigned training
|
|
|
|
### Reports
|
|
- **Individual Progress**: Progress report per petani
|
|
- **Training Effectiveness**: Completion rate per training
|
|
- **Compliance Dashboard**: Status assignment dan deadline
|
|
- **Performance Analytics**: Score distribution dan trends
|
|
- **Engagement Metrics**: Activity dan participation levels
|
|
|
|
## Performance Considerations
|
|
|
|
### Query Optimization
|
|
- Composite index pada `farmerId + trainingId`
|
|
- Partial index pada active enrollments
|
|
- Materialized views untuk complex analytics
|
|
- Caching untuk frequently accessed data
|
|
|
|
### Scalability
|
|
- Partition berdasarkan created date
|
|
- Archive completed training records
|
|
- Optimize for read-heavy workloads
|
|
- Use read replicas untuk reporting
|
|
|
|
## Data Privacy & Security
|
|
|
|
### Sensitive Data
|
|
- Training progress dan scores
|
|
- Assignment reasons
|
|
- Performance metrics
|
|
- Compliance status
|
|
|
|
### Security Measures
|
|
- Access control berdasarkan role
|
|
- Audit logging untuk status changes
|
|
- Data encryption untuk sensitive fields
|
|
- Regular security audits
|
|
|
|
## Notification Management
|
|
|
|
### Automated Notifications
|
|
- **Enrollment Confirmation**: Saat enrollment berhasil
|
|
- **Assignment Notification**: Saat ditugaskan training
|
|
- **Progress Milestones**: Saat mencapai progress tertentu
|
|
- **Deadline Reminders**: Menjelang deadline assignment
|
|
- **Completion Celebration**: Saat menyelesaikan training
|
|
- **Overdue Alerts**: Saat melewati deadline
|
|
|
|
### Notification Channels
|
|
- **In-App**: Notifications dalam aplikasi
|
|
- **Email**: Detailed notifications via email
|
|
- **SMS**: Critical reminders via SMS
|
|
- **Push Notifications**: Mobile app notifications
|
|
- **WhatsApp**: Informal reminders
|
|
|
|
## Quality Assurance
|
|
|
|
### Data Integrity
|
|
- Validation rules untuk progress (0-100)
|
|
- Referential integrity dengan Training dan Farmer
|
|
- Status transition validation
|
|
- Duplicate prevention
|
|
|
|
### Business Logic Validation
|
|
- Prerequisite checking
|
|
- Capacity limit enforcement
|
|
- Deadline validation
|
|
- Score range validation
|
|
|
|
## Future Enhancements
|
|
|
|
### Planned Features
|
|
1. **Adaptive Learning**:
|
|
- Personalized learning paths
|
|
- Difficulty adjustment berdasarkan performance
|
|
- Intelligent content recommendation
|
|
- Predictive analytics untuk success
|
|
|
|
2. **Social Learning**:
|
|
- Peer comparison dan leaderboards
|
|
- Group assignments dan collaboration
|
|
- Mentorship matching
|
|
- Community discussions
|
|
|
|
3. **Advanced Analytics**:
|
|
- Machine learning untuk prediction
|
|
- Behavior analysis
|
|
- Engagement pattern recognition
|
|
- ROI measurement
|
|
|
|
4. **Mobile-First Experience**:
|
|
- Offline learning capabilities
|
|
- Mobile-optimized assessments
|
|
- Voice-based interactions
|
|
- Augmented reality training
|
|
|
|
### Integration Roadmap
|
|
- **Advanced LMS**: Full-featured learning platform
|
|
- **AI-Powered Recommendations**: Personalized learning
|
|
- **Blockchain Certificates**: Verifiable credentials
|
|
- **Virtual Reality**: Immersive training experiences
|
|
- **IoT Integration**: Real-world application tracking
|
|
|
|
## Sample Scenarios
|
|
|
|
### Scenario 1: Mandatory Training Assignment
|
|
```
|
|
Admin assigns "Pesticide Safety Training" to all farmers
|
|
- assignedBy: "admin_001"
|
|
- deadline: 30 days from assignment
|
|
- assignmentReason: "Compliance requirement"
|
|
- Automated reminders at 7, 3, 1 days before deadline
|
|
```
|
|
|
|
### Scenario 2: Self-Directed Learning
|
|
```
|
|
Farmer enrolls in "Organic Farming Basics"
|
|
- Self-enrollment without assignment
|
|
- No deadline constraint
|
|
- Progress tracking untuk personal development
|
|
- Optional assessment at completion
|
|
```
|
|
|
|
### Scenario 3: Prerequisite Chain
|
|
```
|
|
Farmer completes "Basic Crop Management" → unlocks "Advanced Pest Control"
|
|
- System automatically checks prerequisites
|
|
- Enables enrollment untuk advanced training
|
|
- Tracks learning progression
|
|
```
|
|
|
|
## Success Metrics
|
|
|
|
### Individual Level
|
|
- Training completion rate per farmer
|
|
- Average score per training
|
|
- Time to complete training
|
|
- Engagement level (time spent, interactions)
|
|
|
|
### Training Level
|
|
- Overall completion rate
|
|
- Average score distribution
|
|
- Drop-out rate analysis
|
|
- Effectiveness measurement
|
|
|
|
### System Level
|
|
- Total training hours delivered
|
|
- Farmer capacity building index
|
|
- Knowledge retention rate
|
|
- Business impact measurement |