This project is an end-to-end full-stack Internet of Things (IoT) monitoring dashboard built for the College Research Affiliate Program. It dynamically tracks water tank usage via ultrasonic sensor telemetry (distance and temperature) and uses Machine Learning to categorize the usage behavior in real-time.
- Real-Time Dashboard: View current water heights, sensor telemetry, and dynamic AI-powered inferences tracking node activity.
- Machine Learning: Integrates a highly-accurate Random Forest classifier (
scikit-learn) optimized via hyperparameter tuning to accurately discern between activities likewashing_machine,flush, andgeyser. - Historical Analysis: Features detailed
/predictionscharting powered by Recharts (Pie/Confidence Gauges) to review statistical history. - Cloud Database (Aiven): Safely logs temporal series analysis and AI prediction history asynchronously in a cloud-hosted PostgreSQL instance.
- Custom Theming: Incorporates the University's "Deep Blue & Gold" design system for a sleek visual experience.
- Frontend: React.js, Axios, Recharts, Custom CSS (Vercel)
- Backend: FastAPI, Uvicorn, SQLAlchemy, Scikit-Learn (Render)
- Database: PostgreSQL (Aiven)
- Navigate into the backend directory:
cd backend - Activate a Python virtual environment:
python -m venv venv source venv/bin/activate # Or `.\venv\Scripts\activate` on Windows
- Install strict runtime dependencies:
pip install -r requirements.txt
- Define your
.envconnection strings for the Aiven Cloud DB:DB_HOST=watermonitoring-cluster.aivencloud.com DB_PORT=... DB_NAME=defaultdb DB_USER=avnadmin DB_PASSWORD=... DB_SSLMODE=require
- Run the server using
uvicorn:uvicorn main:app --reload
- Open a new terminal and navigate to the UI root:
cd frontend - Install node dependencies:
npm install
- Set your internal
.env:REACT_APP_API_URL=http://localhost:8000
- Launch the local React server on Port 3000:
npm start
This project is configured natively for completely zero-touch deployment pipelines!
Backend (Render API)
- Reads from the root
render.yamlorchestration configuration to pull dependencies directly frombackend/requirements.txt. - Starts the production
uvicorn main:app --host 0.0.0.0process.
Frontend (Vercel UI)
- Pulls configuration from
frontend/vercel.jsonfor mapping external HTTP routes over React's native Single Page Application (SPA) logic.
Detailed ML optimization reports, analysis of switching models from Keras LSTMs to joblib Random Forests, and final Cloud architecture setups are tracked within the Documentation.md artifact included inside this repository!