Soil Sense is an intelligent soil moisture monitoring web application designed to help farmers optimize irrigation practices through real-time data analysis and machine learning predictions. This project serves as the Artificial Intelligence research project for Year 3 students at Makerere University College of Computing and Information Sciences (COCIS).
- Real-time Soil Moisture Monitoring: Track soil moisture levels from IoT devices, CSV uploads, or manual input
- Machine Learning Predictions: AI-powered forecasting of future soil moisture levels
- Smart Irrigation Recommendations: Automated suggestions based on crop requirements and predictions
- Interactive Dashboards: Visualize data with charts and graphs using Chart.js
- Role-based Access Control: Secure user management with Admin, Technician, and Farmer roles
- Comprehensive Reporting: Generate and download reports in PDF/Excel formats
- User registration and authentication
- Password reset and profile management
- Role-based access control (Admin, Technician, Farmer)
- Secure session management
- Store and retrieve soil moisture readings
- Filter data by location, date range, and crop type
- Historical data analysis and trending
- Data export capabilities
- Predictive modeling for soil moisture levels
- Model retraining capabilities for admins
- Weather forecast integration
- Automated threshold-based alerts
- Django 5.2.4 - Web framework
- Django REST Framework - API development
- Python 3.x - Programming language
- SQLite3 - Database
- HTML/CSS/JavaScript - Frontend technologies
- Chart.js - Data visualization
- Tailwind CSS - UI framework
- scikit-learn - ML algorithms
- Pandas/NumPy - Data processing
- UbiOps - Model inference
- Git - Version control
- Python 3.8 or higher
- pip (Python package installer)
- Git
-
Clone the repository
git clone https://github.com/<username>/soil-sense.git cd soil-sense
-
Create and activate virtual environment
python -m venv .venv # On Windows .venv\Scripts\activate # On macOS/Linux source .venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
# Create .env file cp .env.example .env # Edit .env with your configuration
-
Run database migrations
python manage.py makemigrations authentication python manage.py migrate
-
Create superuser
python manage.py createsuperuser
-
Run the development server
python manage.py runserver
-
Access the application
- Open your browser and go to
http://127.0.0.1:8000/ - Admin panel:
http://127.0.0.1:8000/admin/
- Open your browser and go to
soilsense/
├── manage.py # Django management script
├── requirements.txt # Python dependencies
├── README.md # Project documentation
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
├── db.sqlite3 # SQLite database
├── authentication/ # Authentication app
│ ├── __init__.py
│ ├── admin.py # Admin configuration
│ ├── apps.py # App configuration
│ ├── models.py # Custom User model
│ ├── views.py # Authentication views
│ ├── tests.py # Test cases
│ └── migrations/ # Database migrations
├── ml/ # Machine Learning Engine
│ ├── __init__.py # Main ML interface
│ ├── config.py # ML configuration and settings
│ ├── data_processor.py # Data preprocessing utilities
│ ├── model_trainer.py # Model training functionality
│ └── predictor.py # Prediction functions
├── apps/ # Role-based applications
│ ├── farmer/ # Farmer-specific functionality
│ │ ├── __init__.py
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── models.py
│ │ ├── views.py
│ │ ├── tests.py
│ │ └── migrations/
│ ├── technician/ # Technician-specific functionality
│ │ ├── __init__.py
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── models.py
│ │ ├── views.py
│ │ ├── tests.py
│ │ └── migrations/
│ └── landing_page/ # Landing page and public views
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── models.py
│ ├── views.py
│ ├── tests.py
│ └── migrations/
└── soilsense/ # Main Django project
├── __init__.py
├── settings.py # Django settings
├── urls.py # Main URL configuration
├── wsgi.py # WSGI configuration
└── asgi.py # ASGI configuration
Create a .env file in the root directory with the following variables:
DEBUG=True
SECRET_KEY=your-secret-key-hereThe database comes already set up for the light nature of the project we use sqlite3 which has a well documented api for django
- Register an account with farmer role
- Add your farm locations and crop information
- View real-time soil moisture data
- Receive irrigation recommendations
- Download reports for record keeping
- Access system with technician credentials
- Monitor multiple farm locations
- Configure sensor thresholds
- Generate technical reports
- Manage user accounts and permissions
- Upload and retrain ML models
- Configure system-wide settings
- Access comprehensive analytics
- Input Parameters: Location, current soil moisture, temperature, humidity
- Output: Predicted soil moisture levels for next 7-30 days
- Model Types: Linear regression, Random Forest, Neural Networks
- Retraining: Admin can upload new training data and retrain models
- IoT sensor data
- Weather API integration
- Historical soil moisture records
- Crop-specific water requirements
The application provides RESTful APIs for:
- User authentication and management
- Soil moisture data CRUD operations
- ML prediction endpoints
- Report generation
- Alert management
POST /api/auth/login/ # User login
GET /api/moisture/ # Get moisture data
POST /api/predict/ # Get ML predictions
GET /api/reports/ # Generate reports
Run the test suite:
python manage.py testRun with coverage:
coverage run --source='.' manage.py test
coverage report- Set
DEBUG=Falsein settings - Configure production database
- Set up static file serving
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Year 3 Students - Makerere University COCIS
- [Student Name 1] - Backend Development
- [Student Name 2] - Frontend Development
- [student Name 3] - Machine Learning
- [Student Name 4] - Database Design
- [Student Name 5]- Backend and Frontend/ml
For support and questions:
- Email: soilsense@mak.ac.ug
- GitHub Issues: Create an issue
- Documentation: Wiki
- v1.0.0 - Initial release with basic soil moisture monitoring
Made with ❤️ by Makerere University BSSE Group P Students