FlushLa

Inspiration

We've all experienced the frustration of encountering dirty public toilets. The problem isn't just unpleasant—it's a public health issue. We noticed that there's zero accountability for toilet cleanliness and facility managers have no real-time visibility into which facilities need attention. We asked ourselves: what if we could gamify hygiene and create a system where everyone benefits from cleaner spaces? FlushLa was born from the idea of combining AI vision technology with behavioral incentives to solve a problem everyone faces but nobody talks about.

What it does

FlushLa is an AI-powered toilet accountability platform that transforms public restroom management through gamification and real-time monitoring.

For Users:

  • Scan a QR code with their digital wallet pass (Apple/Google Pay)
  • AI automatically captures and analyzes toilet cleanliness using computer vision
  • Earn points (+5) for maintaining clean facilities or lose points (-5 to -15) for leaving messes
  • Progress through Bronze, Silver, and Gold tiers based on their hygiene score
  • Find nearby clean toilets and view their cleanliness ratings
  • Track their inspection history with AI-annotated images

For Facility Managers:

  • Real-time dashboard showing all toilet cleanliness scores
  • Instant alerts when facilities fall below acceptable standards
  • Identify repeat offenders and top performers
  • Data-driven insights for optimizing cleaning schedules
  • Track trends and patterns across multiple locations

AI Detection: Our computer vision system detects and scores six types of cleanliness issues with 85-95% accuracy:

  • Feces stains (-35 points)
  • Pee stains (-20 points)
  • Wet seats (-10 points)
  • Water puddles (-10 points)
  • Toilet paper on floor (-5 points)
  • Trash on floor (-5 points)

How we built it

Tech Stack:

  • Backend: FastAPI (Python) for high-performance async API
  • AI Vision: Multi-provider support (OpenAI GPT-4 Vision, Google Cloud Vision, Vertex AI Gemini) with automatic fallback
  • Database: Supabase (PostgreSQL) for user data, inspection records, and authentication
  • Storage: Supabase Storage for AI-annotated images
  • Real-time: WebSocket connections for instant camera triggering
  • Frontend: Tailwind CSS for responsive, modern UI
  • Digital Passes: PassCreator API integration for Apple/Google Wallet
  • Deployment: Render.com for cloud hosting

Architecture:

  1. Workflow Orchestration: Built a session-based system that coordinates QR scanning → camera trigger → photo capture → AI analysis → database storage → score updates
  2. WebSocket Communication: Real-time bidirectional communication between inspection page and camera client
  3. Image Processing Pipeline: Capture → AI analysis → bounding box annotation → cloud storage → URL generation
  4. Scoring Algorithm: Dynamic point calculation based on cleanliness thresholds with tier progression
  5. Admin Analytics: Aggregated statistics, trend analysis, and performance metrics

Key Features Implemented:

  • Automated inspection workflow with status polling
  • Multi-provider AI vision with graceful fallback
  • Tier-based gamification system (Bronze/Silver/Gold)
  • Real-time admin dashboard with comprehensive statistics
  • User profile with visit history and AI result visualization
  • Nearby toilets finder with tier filtering
  • Scoring guide with detailed point breakdown
  • Digital wallet pass integration for seamless access

Challenges we ran into

1. WebSocket Coordination: Getting the camera page to reliably receive capture signals while maintaining session context was tricky. We solved this by implementing a session-based workflow system that tracks state across multiple endpoints.

2. AI Vision Reliability: OpenAI's API documentation had inconsistencies, causing initial failures. We built a multi-provider system supporting OpenAI, Google Cloud Vision, and Vertex AI with automatic fallback, making the system more robust.

3. Image Upload & Storage: Supabase RLS policies initially blocked image uploads. We resolved this by using the admin client for storage operations while maintaining security for other operations.

4. Real-time Status Updates: Polling for inspection status without blocking the UI required careful async handling and progress simulation to provide smooth user feedback.

5. Deployment Issues: The hardcoded WebSocket URL (ws://localhost:8000) broke in production. We implemented dynamic URL generation that adapts to the deployment environment (ws:// for local, wss:// for production).

6. Score Calculation Edge Cases: Handling null values in cleanliness scores across aggregations caused crashes. We added comprehensive null-checking throughout the analytics pipeline.

Accomplishments that we're proud of

Fully Functional MVP in 24 Hours: Not just mockups—every feature works end-to-end from QR scan to AI analysis to score updates

Multi-Provider AI System: Built a resilient architecture that supports three different AI vision providers with automatic fallback

Real-time Workflow Orchestration: Successfully coordinated WebSocket communication, async processing, and state management across multiple components

Professional UI/UX: Created a polished, responsive interface with smooth animations, clear feedback, and intuitive navigation

Comprehensive Analytics: Built a full admin dashboard with statistics, trends, top performers, and problem identification

Digital Wallet Integration: Successfully integrated with PassCreator API for seamless Apple/Google Wallet passes

Production-Ready Deployment: Solved real-world deployment challenges and got the app running on Render with proper WebSocket support

Gamification That Works: Designed a tier system and scoring algorithm that genuinely incentivizes good behavior

What we learned

Technical Skills:

  • Advanced FastAPI patterns for async workflows and WebSocket management
  • Computer vision API integration and multi-provider architecture design
  • Real-time state management across distributed components
  • Supabase RLS policies and admin client usage patterns
  • Production deployment considerations for WebSocket applications

Product Design:

  • Gamification mechanics that balance rewards and penalties
  • The importance of clear user feedback during multi-step processes
  • How to design admin dashboards that provide actionable insights
  • Mobile-first design considerations for public facility use cases

Problem-Solving:

  • Building resilient systems with fallback mechanisms
  • Debugging WebSocket connection issues across environments
  • Handling edge cases in data aggregation and null values
  • Balancing feature completeness with time constraints

Soft Skills:

  • Breaking down complex workflows into manageable components
  • Prioritizing features for maximum impact in limited time
  • Iterating quickly based on testing and feedback
  • Communicating technical concepts through UI/UX

What's next for FlushLa

Phase 1 (3 months) - Campus Pilot:

  • 📱 Native mobile apps (iOS/Android) for better camera integration
  • 🔔 Push notifications for inspection reminders and tier changes
  • 🎯 Pilot program at NUS with 10-15 high-traffic toilets
  • 📊 A/B testing different reward structures and point thresholds

Phase 2 (6 months) - Market Expansion:

  • 🏬 Partner with 3-5 shopping malls in Singapore
  • 🎁 Rewards marketplace (redeem points for vouchers, discounts)
  • 🤖 Predictive maintenance AI (forecast when toilets need cleaning)
  • 📈 Advanced analytics (peak usage times, cleaning efficiency metrics)
  • 🌐 Multi-language support for international deployment

Phase 3 (12 months) - Scale & Monetization:

  • 🚀 Expand to 100+ venues across Singapore and Malaysia
  • 💼 Enterprise SaaS platform for facility management companies
  • 🔬 Research partnerships for public health studies
  • 🌍 International expansion (airports, transit hubs, universities)
  • 🤝 Integration with existing facility management systems (CMMS)

Technical Roadmap:

  • Edge AI for faster, offline-capable analysis
  • Blockchain-based reputation system for tamper-proof scores
  • IoT sensor integration (occupancy, air quality, supply levels)
  • Machine learning for personalized toilet recommendations
  • API platform for third-party integrations

Vision: Make FlushLa the standard for public hygiene accountability worldwide, creating cleaner, healthier spaces through the power of AI and behavioral incentives.

Built With

  • fastapi
  • passcreator
  • python
  • render
  • supabase
  • tailwind
Share this project:

Updates