roadmap/model_documentation/plot_model_documentation.md

341 lines
9.6 KiB
Markdown

# Plot Model Documentation
## Overview
Model Plot adalah subdivision dari Farm yang merepresentasikan area tanam spesifik dalam satu lahan pertanian. Plot berfungsi sebagai unit terkecil dalam manajemen pertanian untuk tracking detail produksi, tanaman, dan aktivitas pertanian yang lebih granular.
## Business Context
Model Plot berfungsi sebagai:
- **Production Unit**: Unit terkecil untuk tracking produksi dan hasil
- **Crop Management**: Manajemen spesifik per jenis tanaman
- **Resource Allocation**: Alokasi input dan sumber daya per area
- **Performance Analysis**: Analisis performa per plot untuk optimization
- **Rotation Planning**: Perencanaan rotasi tanaman
- **Precision Agriculture**: Implementasi pertanian presisi
## Model Structure
### Primary Fields
#### **Identification & Basic Info**
- **`id`** (String, Primary Key): Unique identifier menggunakan CUID
- **`farmId`** (String, Foreign Key): Referensi ke farm induk
- **`name`** (String, Required): Nama plot untuk identifikasi
- **`area`** (Decimal, Optional): Luas plot dalam hektar
- **`description`** (String, Optional): Deskripsi detail plot
#### **Crop Information**
- **`productId`** (String, Foreign Key, Optional): Jenis produk/komoditas yang ditanam
- **`variantId`** (String, Foreign Key, Optional): Varietas spesifik yang ditanam
- **`plantedDate`** (DateTime, Optional): Tanggal penanaman terakhir
#### **Geographic Data**
- **`boundaries`** (JSON, Optional): Boundaries plot dalam format GeoJSON polygon
#### **Status & Metadata**
- **`isActive`** (Boolean, Default: true): Status aktif plot
- **`createdAt`** (DateTime, Default: now()): Tanggal pembuatan
- **`updatedAt`** (DateTime, Auto-update): Tanggal terakhir diupdate
## Relationships
### Many-to-One Relationships
- **Farm**: Setiap plot belongs to satu farm
- **Product**: Plot dapat dikaitkan dengan satu jenis produk
- **ProductVariant**: Plot dapat specify varietas tertentu
### One-to-Many Relationships
- **Harvest**: Plot dapat memiliki multiple harvest records
- **WeatherData**: Data cuaca spesifik untuk plot
- **WeatherForecast**: Prediksi cuaca untuk plot
- **FarmInput**: Input yang digunakan pada plot
- **InputSchedule**: Jadwal input untuk plot
- **LaborRecord**: Catatan kerja pada plot
- **LaborSchedule**: Jadwal kerja pada plot
- **EquipmentUsage**: Penggunaan alat pada plot
- **PestDiseaseRecord**: Catatan hama/penyakit pada plot
- **FinancialRecord**: Catatan keuangan per plot
- **SoilTest**: Tes tanah spesifik plot
- **PlotSeason**: Manajemen musim tanam per plot
## Database Indexes
### Primary Indexes
- **`farmId`**: Relasi dengan farm
- **`productId, variantId`**: Pencarian berdasarkan crop
- **`plantedDate`**: Sorting berdasarkan waktu tanam
- **`isActive`**: Filter plot aktif
## Business Rules
### Validation Rules
1. **Area Constraints**:
- Area plot tidak boleh melebihi area farm
- Total area semua plot dalam farm tidak boleh > area farm
- Area harus > 0 jika diisi
2. **Crop Consistency**:
- ProductVariant harus sesuai dengan Product
- Satu plot hanya satu jenis crop pada satu waktu
- PlantedDate tidak boleh di masa depan
3. **Geographic Rules**:
- Plot boundaries harus dalam farm boundaries
- Plot tidak boleh overlap dengan plot lain dalam farm yang sama
### Business Logic
- Plot dapat kosong (fallow) tanpa crop assignment
- History crop rotation dapat dilihat dari PlotSeason
- Deactivated plot tidak dapat menerima input baru
## Use Cases
### 1. Plot Creation & Setup
**Actor**: Petani/Farm Manager
**Flow**:
1. Define plot boundaries dalam farm
2. Assign nama yang descriptive
3. Calculate atau input area
4. Set initial crop jika sudah ditanam
5. Aktivasi plot untuk operations
### 2. Crop Planting Management
**Actor**: Petani
**Flow**:
1. Select plot yang akan ditanam
2. Choose product dan variant
3. Set planting date
4. Update plot record
5. Create PlotSeason record
6. Schedule initial inputs
### 3. Production Tracking
**Actor**: Petani/Field Officer
**Flow**:
1. Monitor crop development per plot
2. Record inputs dan activities
3. Track labor dan equipment usage
4. Monitor pest/disease issues
5. Record harvest results
### 4. Crop Rotation Planning
**Actor**: Agronomist/Petani
**Flow**:
1. Analyze historical PlotSeason data
2. Plan next season crops
3. Consider soil health dan nutrient balance
4. Schedule land preparation
5. Update plot assignments
### 5. Performance Analysis
**Actor**: Data Analyst/Manager
**Flow**:
1. Compare productivity across plots
2. Analyze input efficiency per plot
3. Identify high/low performing areas
4. Generate recommendations
5. Optimize resource allocation
## Integration Points
### Internal Systems
- **Farm Management**: Parent-child relationship
- **Product Catalog**: Crop selection
- **Season Management**: Temporal crop tracking
- **Input Management**: Resource allocation
- **Harvest Tracking**: Production recording
- **Financial System**: Plot-level costing
### External Systems
- **Satellite Imagery**: Plot monitoring
- **Weather Services**: Micro-climate data
- **Soil Testing Labs**: Plot-specific analysis
- **Precision Agriculture**: Variable rate applications
- **Drone Services**: Plot surveillance
## Data Management
### Geographic Data
- GeoJSON polygons untuk plot boundaries
- Coordinate validation terhadap farm boundaries
- Area calculation dari polygon coordinates
- Spatial indexing untuk efficient queries
### Historical Data
- Maintain crop history melalui PlotSeason
- Track input usage over time
- Production trends analysis
- Soil health evolution
## Performance Considerations
### Query Optimization
- Index pada farmId untuk farm-level queries
- Composite index pada productId+variantId
- Spatial index untuk geographic queries
- Materialized views untuk aggregations
### Scalability
- Plot data umumnya tidak terlalu large
- Efficient spatial data storage
- Optimized untuk farm-level rollups
- Caching untuk frequently accessed plots
## Analytics & Reporting
### Key Metrics
- **Yield per Plot**: Produktivitas per unit area
- **Input Efficiency**: ROI per plot
- **Crop Performance**: Comparison across plots
- **Resource Utilization**: Labor, equipment, inputs
- **Profitability Analysis**: Revenue vs costs per plot
### Reports
- **Plot Performance Dashboard**: Real-time metrics
- **Crop Rotation Report**: Historical patterns
- **Input Usage Analysis**: Resource optimization
- **Yield Comparison**: Plot benchmarking
- **Profitability Analysis**: Financial performance
## Quality Assurance
### Data Integrity
- Referential integrity dengan Farm
- Valid GeoJSON boundaries
- Realistic area calculations
- Consistent crop assignments
### Validation Rules
- Plot boundaries within farm boundaries
- No overlapping plots dalam same farm
- Valid product-variant combinations
- Reasonable planting dates
## Future Enhancements
### Planned Features
1. **Precision Agriculture**:
- Variable rate application zones
- Yield mapping integration
- Soil variation mapping
- Micro-climate monitoring
2. **AI-Powered Insights**:
- Optimal crop selection recommendations
- Yield prediction per plot
- Input optimization suggestions
- Disease/pest early warning
3. **IoT Integration**:
- Sensor-based monitoring
- Automated irrigation per plot
- Real-time soil monitoring
- Equipment tracking per plot
4. **Advanced Analytics**:
- Machine learning untuk optimization
- Predictive modeling
- Comparative analysis
- Benchmark studies
## Sample Plot Configurations
### Rice Plot Setup
```json
{
"name": "Sawah A1",
"farmId": "farm_123",
"area": 0.25,
"productId": "rice_001",
"variantId": "ir64_variant",
"plantedDate": "2024-01-15",
"description": "Quarter hectare rice plot, north section"
}
```
### Vegetable Rotation Plot
```json
{
"name": "Veggie Plot B",
"farmId": "farm_456",
"area": 0.1,
"productId": "tomato_001",
"variantId": "cherry_tomato",
"plantedDate": "2024-02-01",
"description": "Small intensive vegetable plot for rotation"
}
```
### Tree Crop Plot
```json
{
"name": "Coffee Section 1",
"farmId": "farm_789",
"area": 1.0,
"productId": "coffee_001",
"variantId": "arabica_typica",
"plantedDate": "2020-03-15",
"description": "Mature coffee trees, 4 years old"
}
```
## Crop Rotation Management
### Rotation Patterns
- **Sequential Cropping**: Different crops per season
- **Intercropping**: Multiple crops simultaneously
- **Fallow Periods**: Rest periods untuk soil recovery
- **Cover Crops**: Soil improvement crops
### Planning Considerations
- Soil nutrient management
- Pest and disease cycles
- Market demand patterns
- Input cost optimization
- Labor availability
## Environmental Monitoring
### Plot-Level Tracking
- Soil health indicators
- Water usage efficiency
- Input application rates
- Yield sustainability
- Environmental impact
### Compliance Monitoring
- Organic certification requirements
- Chemical application limits
- Water usage regulations
- Environmental protection standards
## Risk Management
### Production Risks
- Weather-related losses
- Pest and disease outbreaks
- Market price fluctuations
- Input cost variations
### Mitigation Strategies
- Diversified cropping patterns
- Insurance coverage per plot
- Early warning systems
- Adaptive management practices
## Mobile Field Data Collection
### Field App Features
- GPS-based plot identification
- Real-time data entry
- Photo documentation
- Voice notes capability
- Offline data sync
### Data Collection Types
- Daily observations
- Input applications
- Labor activities
- Equipment usage
- Problem incidents
This documentation provides comprehensive guidance for Business Analysts to understand the Plot model's role in precision farm management and its integration with the broader Happy Farmer ecosystem.