TrashGuard

Spot the dump, snap the pic, help keep San José clean.

Selected track: Clean up your city


💡 Inspiration

As an international student new to San José, I experienced the city with fresh eyes. Near campus I kept seeing overflowing bins and illegally dumped mattresses and furniture.
I soon learned about San José’s 311 system, a channel for non-emergency service requests—a civic tool I’d never used back home.

Yet public data show illegal-dumping reports are rising, while anecdotes suggest cleanup crews still follow fixed routes that may miss brand-new piles.
So I asked:

Can we augment 311 with a focused app that turns resident snapshots into a live hotspot map—helping the City direct crews faster?


🌍 What TrashGuard Does

Feature Details
Maps Current Intensity Google-Maps heat-map of every “Illegal Dumping” 311 ticket from the last 90 days (via Open-Data CKAN).
Highlights Persistent Areas Aggregates tickets into 200 m grid tiles—recurring hotspots glow brighter.
Focused Citizen Reporting Users:
• Upload a photo
• Choose size (Small/Med/Large) & type (Furniture, Bags…)
• Capture GPS with one tap.
Persistent Cloud Storage • Metadata → Supabase (Postgres)
• Images → Google Cloud Storage
Admin Workflow Password-protected sidebar lets staff view reports, change status (“New / Reviewed / Cleaned”), or delete errors.

❓ Why another uploader when 311 already accepts photos?

Extra value from TrashGuard Why 311 alone isn’t always enough Status
Visual context on a live map 311 form shows no heat-map; TrashGuard gives instant context & confirmation. ✅
GPS precision Mistyped 311 addresses default to city centroid; we use device GPS. ✅
Structured severity data 311 text is generic; we collect Size/Type plus photo. ✅
Single-purpose UX 311 covers dozens of services; TrashGuard is dumping-only, super-fast. ✅
Enriched analytics fields Adds structured size/type/location/status & direct image link. ✅
Foundation for duplicate detection Precise GPS + timestamp + photo enable auto-merge later. Enabled
Gamified lifecycle Watch your marker change status live—future enhancement. Future

Think of TrashGuard as a specialised overlay that enriches 311 data and visualises urgency.


🛠️ How I Built It

Layer Tech Key Steps
Data Retrieval Python + CKAN SQL API Query “Service Type = 'Illegal Dumping'”.
Processing Pandas / NumPy Parse “Date Created”, filter 90 days, clean lat/lon, bin to 200 m tiles.
Caching @st.cache_data Speed up reloads, cut API calls.
Map UI Streamlit + HTML component Embed Google Maps HeatmapLayer; tune radius & maxIntensity.
Geo-Location streamlit-js-eval Grab navigator.geolocation coords.
Metadata DB Supabase (Postgres) CRUD for reports + status updates.
Photo Storage Google Cloud Storage Upload via service account, retrieve public URL.
Admin Panel Streamlit sidebar List reports, show image, status dropdown, delete button.
Modularity Python packages data_handler, db_handler, storage_handler, utils.
Deploy Streamlit Cloud Secrets for Maps, CKAN, Supabase, GCS in .streamlit/secrets.toml.

📚 What I Learned

  • Cloud integration: Streamlit can talk to Supabase + GCS with service keys.
  • GCS IAM nuances: Uniform vs fine-grained ACLs, public read vs backend write.
  • Supabase Python client: Great for CRUD but needs careful error handling.
  • streamlit-js-eval bridges browser APIs (GPS) back to Python.
  • Modular design keeps the codebase sane and testable.
  • st.session_state is vital for sticky messages across st.rerun().

🚧 Challenges

  • Swapped storage stack twice (temp → SQLite → Supabase + GCS).
  • Debugged GCS permissions (needed Storage Object Creator role).
  • Managed multiline JSON service keys in Streamlit secrets.
  • JS ↔️ Python messaging for geolocation took trial & error.
  • Ensured state persistence around st.rerun() calls.

🏆 Accomplishments

  • Solo-built a full-stack, cloud-persisted app in under a day.
  • Integrated CKAN, Google Maps, Supabase, GCS within Streamlit.
  • Delivered a live hotspot map + structured photo reports + admin workflow.
  • Modularised code for future contributors.

🚀 What’s Next

  • Richer admin UI – filtering, search, sortable columns.
  • Notifications – email/SMS on new reports & status changes.
  • Duplicate detection – auto-merge reports at same GPS/timestamp.
  • ML triage – classify image volume/type for priority scoring.
  • Clickable map reporting – pick location first, then photo.
  • User accounts – Supabase Auth for report history & gamified feedback.
  • City pilot – package docs & pitch to BeautifySJ.

TrashGuard shows how open data, cloud tools, and a focused UX can extend 311 and put cleaner streets within reach. 🌱

Share this project:

Updates

Submission history