A Minimum Viable Product (MVP) for a web application that assists farmers in optimizing livestock care. The application tracks feeding routines, animal health data, and uses AI prompts to generate feeding suggestions, detect anomalies, and provide health summaries.
- Backend: Python with Flask
- Database: SQLite with SQLAlchemy ORM
- Frontend: HTML, CSS, and vanilla JavaScript
- AI Integration: Google Generative AI (Gemini)
- Register and manage livestock animals
- Record feeding logs and health data
- AI-powered tools:
- Generate optimized feeding plans
- Detect anomalies in health and feeding patterns
- Create comprehensive health summaries
- Alert system for health and feeding issues
git clone <repository-url>
cd <repository-directory>python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txtYou need to set the GOOGLE_API_KEY environment variable with your Google Generative AI API key:
On Linux/macOS:
export GOOGLE_API_KEY="your_api_key_here"On Windows:
set GOOGLE_API_KEY=your_api_key_hereAlternatively, you can create a .env file in the project root with the following content:
GOOGLE_API_KEY=your_api_key_here
cd app
python seed_db.pypython app.pyThe application will be available at http://127.0.0.1:5000/
GET /api/animals: List all animalsPOST /api/animals: Add a new animalGET /api/animals/<animal_tag_id>: Get details of a specific animalPUT /api/animals/<animal_tag_id>: Update animal detailsDELETE /api/animals/<animal_tag_id>: Delete an animal
GET /api/animals/<animal_tag_id>/feeding_logs: List feeding logs for an animalPOST /api/animals/<animal_tag_id>/feeding_logs: Add a feeding log for an animal
GET /api/animals/<animal_tag_id>/health_records: List health records for an animalPOST /api/animals/<animal_tag_id>/health_records: Add a health record for an animal
GET /api/alerts: List all active (non-acknowledged) alertsPOST /api/alerts/<alert_id>/acknowledge: Mark an alert as acknowledged
POST /api/ai/generate_feeding_plan/<animal_tag_id>: Generate a feeding planPOST /api/ai/detect_anomalies/<animal_tag_id>: Detect health or feeding anomaliesGET /api/ai/health_summary/<animal_tag_id>: Generate a health summary
app/
├── app.py # Main Flask application
├── models/
│ └── models.py # SQLAlchemy data models
├── static/
│ ├── css/
│ │ └── style.css # CSS styles
│ └── js/
│ └── main.js # Client-side JavaScript
├── templates/ # Jinja2 HTML templates
│ ├── base.html
│ ├── dashboard.html
│ ├── animals.html
│ └── ...
└── seed_db.py # Database seeding script
- Animal: Basic information about livestock animals
- FeedingLog: Records of animal feeding events
- HealthRecord: Animal health measurements and observations
- Alert: System notifications about potential issues
- Mobile responsiveness for field use
- Image/video analysis for visual health checks
- Integration with IoT sensors for automated data collection
- More sophisticated anomaly detection algorithms
- User roles and permissions system
- Email or SMS notifications for critical alerts