How barackwilliam/kilimoni works
Mkulima AI is a Django-powered agricultural-advice service for Tanzanian farmers, principally accessed through WhatsApp. The documented journey runs from an incoming message through interpretation, crop/location and intent handling, knowledge retrieval, an answer and follow-up, then logging and analytics. Distinct advice branches cover crop diagnosis, seed selection, planting, soil and crop rotation; datasets feed the knowledge base, while dashboard tools support imports and operations. Edges reflect README flow or source-index references; unsampled integrations are omitted where their wiring is not evidenced.
Main entry points: bot/engine.py Query engine · diagnosis/engine.py Rules diagnosis · models.py Crop and zone records · coverage.py Knowledge coverage
Components 22
Messaging and orchestration
- WhatsApp channel
whatsapp/views.py - Query engine
bot/engine.py - Message understanding
bot/understand.py - Diagnostic flow
bot/diagnostic.py
Agricultural knowledge
- Knowledge coverage
advisory/coverage.py - Location and zones
advisory/location.py - Seed selection
advisory/seed.py - Planting advice
advisory/planting.py - Soil advice
advisory/soil.py - Crop rotation
advisory/rotation.py - Farmer profile advice
advisory/profile.py - Crop and zone records
crops/models.py - Advisory records
advisory/models.py
Crop diagnosis
- Rules diagnosis
diagnosis/engine.py - Language AI layer
diagnosis/ai_layer.py - Diagnostic records
diagnosis/models.py
Farmer records
- Conversation records
bot/models.py
Data and operations
- Analytics
analytics/models.py - Advisory dataset import
advisory/importer.py - Diagnosis dataset import
diagnosis/importer.py - Dashboard and CSV tools
admin_panel/csv_import.py
Other components
- Farmer
Connections 23
- Farmer → WhatsApp channel: sends message
- WhatsApp channel → Query engine: forwards webhook
- Query engine → Message understanding: interprets message
bot/engine.py - Query engine → Diagnostic flow: checks diagnosis
bot/engine.py - Query engine → Rules diagnosis: runs diagnosis
bot/engine.py - Query engine → Knowledge coverage: checks coverage
bot/engine.py - Query engine → Location and zones: resolves location
bot/engine.py - Query engine → Seed selection: retrieves seed advice
bot/engine.py - Query engine → Planting advice: retrieves planting advice
bot/engine.py - Query engine → Soil advice: retrieves soil advice
bot/engine.py - Query engine → Crop rotation: retrieves rotation advice
bot/engine.py - Query engine → Farmer profile advice: uses farmer profile
bot/engine.py - Query engine → Conversation records: logs conversation
bot/engine.py - Query engine → Analytics: records analytics
bot/engine.py - Rules diagnosis → Diagnostic records: reads rules
diagnosis/engine.py - Rules diagnosis → Language AI layer: uses language layer
diagnosis/engine.py - Rules diagnosis → Crop and zone records: reads crop data
diagnosis/engine.py - Knowledge coverage → Advisory records: reads coverage
advisory/coverage.py - Knowledge coverage → Crop and zone records: reads crop records
advisory/coverage.py - Advisory dataset import → Advisory records: imports records
advisory/importer.py - Advisory dataset import → Crop and zone records: checks crop references
advisory/importer.py - Diagnosis dataset import → Diagnostic records: imports records
diagnosis/importer.py - Dashboard and CSV tools → Crop and zone records: imports crop data
admin_panel/csv_import.py