Roots.
AI-powered crop recommendation system.
A full-stack agricultural recommendation application that combines environmental conditions, live weather data, and machine learning to suggest optimal crops for any selected geographical location.
# 01 // FULL-STACK SYSTEM ARCHITECTURE
React & TypeScript
Geolocation · Weather UI · Results
Flask REST API
Validation · Weather cache · Routes
Scikit-Learn Model
Random Forest · 7 Soil/Climate inputs
Open-Meteo APIs
Live metrics + 1991–2020 rainfall
The frontend captures location coordinates and soil properties, the Flask service aggregates real-time temperature, humidity, and historical rainfall via Open-Meteo APIs, and feeds the standardized 7-feature vector into a serialized Random Forest classifier to return ranked agricultural recommendations.
# 02 // FOUR-STEP RECOMMENDATION PIPELINE
Users search by city/region or activate device geolocation. The application resolves coordinates and manages past location history for rapid re-evaluation.
The Flask service fetches real-time temperature and relative humidity alongside historical precipitation archives (1991–2020) to synthesize an annualized rainfall index.
Accepts essential chemical soil properties: Nitrogen (N), Phosphorus (P), Potassium (K), and soil pH levels, using regional baseline estimates with support for manual input override.
Evaluates the trained model to predict the top 3 recommended crops with probabilistic confidence scores, falling back to a deterministic agricultural heuristic if the ML inference fails.
# 03 // ML MODEL & FEATURE SPECIFICATION
The core predictive engine is a Random Forest Classifier trained in Google Colab on multi-class crop records (cropsdata.csv) and serialized to a .pkl artifact for low-latency serving in Flask. The model evaluates seven environmental vectors:
Nitrogen (N)
Vegetative leaf growth ratio
Phosphorus (P)
Root & seed development
Potassium (K)
Disease & drought resistance
Soil pH
Nutrient availability index
Temperature
Live ambient reading (°C)
Humidity
Relative moisture (%)
Annual Rainfall
Derived historical precipitation estimate (mm)
# 04 // CHALLENGES & PRACTICAL LEARNINGS
Transitioned a standalone Colab notebook into an interactive web app. Engineered input verification in Flask, handled serialized model deserialization, and formatted multi-class probabilities into clean, ranked JSON responses for React.
Live APIs don't supply annual rainfall on demand. Solved by querying Open-Meteo's historical archives (1991–2020) and deriving annualized precipitation norms, coupled with in-memory caching to curb rate limits.
A key internship insight was avoiding false accuracy claims. Soil values use state-level baseline defaults rather than physical field sensors; the UI clearly displays when default assumptions or rule-based fallbacks are active.
Internship Experience & Scope
Roots was developed as part of a focused 1-month AI/ML internship at Technopark, Thiruvananthapuram. The project emphasized connecting machine learning models to live web services, handling data provenance, and turning raw predictions into accessible, actionable tools for everyday users.