Skip to content

Commit 5e20e51

Browse files
authored
Update README.md
1 parent 3992f36 commit 5e20e51

1 file changed

Lines changed: 51 additions & 111 deletions

File tree

README.md

Lines changed: 51 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,76 @@
1-
# drishti
2-
AI-Driven Sustainability Operating System for Urban Water Systems
1+
# DRISHTI
2+
## AI-Driven Sustainability Operating System for Urban Water Systems (particularly the Yamuna)
33

4-
## Quickstart (Local)
4+
Delhi contributes a majority of the Yamuna’s pollution despite covering only a small stretch of the river.
5+
Current interventions are reactive, fragmented, and lack continuous monitoring.
56

6-
1. Create a virtualenv and install dependencies:
7+
**DRISHTI** is a lightweight, real-time decision support platform that helps authorities detect pollution early, predict risks, and take targeted action.
78

8-
```bash
9-
python -m venv .venv
10-
.\.venv\Scripts\activate
11-
pip install -r requirements.txt
12-
```
13-
14-
2. Seed a few sensors and create the DB:
15-
16-
```bash
17-
python -m scripts.init_db
18-
```
19-
20-
3. Start the FastAPI backend:
21-
22-
```bash
23-
uvicorn backend.main:app --reload
24-
```
25-
26-
4. (Optional) Run the data generator to simulate sensor readings:
27-
28-
```bash
29-
python scripts/generate_data.py --url http://localhost:8000 --sensors 5 --count 200 --delay 0.3
30-
```
31-
32-
5. Start the Streamlit frontend:
33-
34-
```bash
35-
streamlit run frontend/app.py
36-
```
37-
38-
6. Visit http://localhost:8501 for the dashboard. The backend runs on http://localhost:8000.
9+
Instead of waiting for damage, we enable a **monitor → predict → intervene** strategy.
3910

4011
---
4112

42-
This repository is a hackathon-friendly prototype. It uses a lightweight SQLite DB by default but can be pointed to a Supabase/Postgres instance by setting the `DATABASE_URL` environment variable.
43-
44-
## Supabase Auth & DB (recommended for deployment) ✅
45-
46-
- Create a free Supabase project at https://app.supabase.com and note the **Project URL** and **anon/public key** (Project -> Settings -> API).
47-
- Enable Email auth in Supabase (Auth -> Settings).
48-
- Set environment variables locally or in deployment:
49-
- `DATABASE_URL` (Postgres connection string from Supabase)
50-
- `SUPABASE_URL` (your project URL, e.g. https://xyz.supabase.co)
51-
- `SUPABASE_KEY` (anon/public key for client-side auth calls)
52-
- (Optional) `SUPABASE_SERVICE_ROLE_KEY` for any server-side admin tasks — keep secret.
53-
54-
### Applying the DB schema
55-
56-
A SQL migration is included at `migrations/initial.sql` and a small runner `scripts/apply_migrations.py` uses your `DATABASE_URL` to apply it.
57-
58-
Example (local):
13+
## 🚨 Problem
5914

60-
```bash
61-
set DATABASE_URL=postgresql://user:pass@host:5432/dbname # Windows (PowerShell: $env:DATABASE_URL=...)
62-
python scripts/apply_migrations.py
63-
```
15+
- Untreated sewage enters through multiple drains
16+
- Monitoring is sparse and manual
17+
- Illegal/ intermittent dumping goes unnoticed
18+
- STPs are overloaded or bypassed
19+
- Agencies lack coordinated, real-time data
6420

65-
If you prefer the Supabase UI, you can paste `migrations/initial.sql` into the SQL editor and run it there.
21+
Result:
22+
By the time pollution is noticed, it’s already too late.
6623

67-
### Frontend & backend env vars
68-
69-
- Frontend (Streamlit Cloud): set `API_BASE`, `SUPABASE_URL`, `SUPABASE_KEY`.
70-
- Backend (Railway/Render): set `DATABASE_URL` and optionally `SUPABASE_SERVICE_ROLE_KEY`.
71-
72-
### Security notes
73-
74-
- Do not commit service-role keys to source control.
75-
- Use Supabase anon key only in client; use service role key or DB connection string only for the server.
76-
77-
78-
## Tests
79-
80-
Run quick smoke tests locally (no server needed):
81-
82-
```bash
83-
python -m scripts.test_api
84-
python -m scripts.test_ml
85-
```
86-
87-
These use FastAPI's TestClient and simple synthetic data to verify core endpoints and ML functions.
88-
89-
## Dashboard (Streamlit)
90-
91-
The Streamlit app shows an interactive sensor map and details:
92-
- Hover sensors on the map to view latest readings, `last_service`, and unresolved alert count.
93-
- Select a sensor to see metrics and time-series charts.
94-
- Use "Refresh sensor data" in the sidebar to clear the cache and refetch from Supabase.
95-
96-
To run locally:
24+
---
9725

98-
```bash
99-
streamlit run frontend/app.py
100-
```
26+
## 💡 Our Solution
10127

102-
When deployed to Streamlit Cloud, set `SUPABASE_URL` and `SUPABASE_KEY` in the app Secrets.
28+
We built a **smart environmental monitoring system** that:
10329

104-
## Deploy (short)
30+
- Continuously collects sensor data
31+
- Detects anomalies automatically
32+
- Simulates pollution risk
33+
- Tracks issues
34+
- Visualizes everything on one dashboard
10535

106-
- Backend: Railway or Render — point `start` to `uvicorn backend.main:app --host 0.0.0.0 --port $PORT` and set `DATABASE_URL` as secret.
107-
- Frontend: Streamlit Cloud — push repo, set `API_BASE` to your backend and `SUPABASE_*` env vars in the UI.
36+
It acts as the **control center for river health**.
10837

10938
---
11039

111-
# Streamlit Cloud Deployment
40+
## 🧠 System Flow
41+
42+
Sensors → Database → AI/ML → Backend API → Dashboard → Action
11243

113-
1. Push the repo to GitHub.
114-
2. On streamlit.io/cloud, create a new app from this repo.
115-
3. In the app settings > Secrets, add:
116-
- SUPABASE_URL
117-
- SUPABASE_KEY
118-
4. Deploy. Use the sidebar to enter a table name and view/insert rows.
44+
- Sensors send water quality data
45+
- ML detects abnormal spikes
46+
- Alerts are generated automatically
47+
- Officials raise issues and take action
48+
- Policies can be simulated before deployment
11949

12050
---
12151

122-
# Quick local setup
52+
## ✨ Features
12353

124-
## Unix
54+
### 📊 Real-Time Monitoring
55+
- Live sensor readings
56+
- Time-series charts
57+
- Water quality metrics (pH, DO, BOD, COD, turbidity, ammonia, temperature, conductivity)
12558

126-
1. ./setup_venv.sh
127-
2. source .venv/bin/activate
128-
3. streamlit run streamlit_app.py
59+
### 🚨 Intelligent Alerts
60+
- Automatic anomaly detection
61+
- Severity-based warnings
62+
- Location-specific flags
12963

130-
## Windows
64+
### 🔮 Prediction / Simulation Engine
65+
- Short-term pollution forecasting
66+
- Risk scoring for drains/segments
13167

132-
1. setup_venv.bat
133-
2. .venv\Scripts\activate
134-
3. streamlit run streamlit_app.py
68+
### 📝 Issue Tracker
69+
- Raise issues
70+
- Track resolution status
13571

136-
Before deploying to Streamlit Cloud, add SUPABASE_URL and SUPABASE_KEY in the app Secrets.
72+
### 🗺 Interactive Dashboard
73+
- Sensor map
74+
- Alerts table
75+
- Charts & analytics
76+
- Authentication

0 commit comments

Comments
 (0)