Skip to content

CIVIC-SOS/rapidassist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

56 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ†˜ RapidAssist - Emergency Response Platform

Version React Vite Firebase License

Quick Help When You Need It Most

A comprehensive emergency response and civic issue reporting platform with real-time tracking, AI-powered analysis, and multi-agency coordination.

Demo โ€ข Features โ€ข Installation โ€ข Usage โ€ข Architecture


๐Ÿ“– Overview

RapidAssist is a modern emergency services platform designed to provide instant access to emergency services (Police, Ambulance, Fire), enable community issue reporting, and provide real-time status tracking. The platform connects citizens with emergency responders and local authorities seamlessly.

โœจ Features

๐Ÿšจ Emergency SOS System

  • One-tap SOS activation with 7-second countdown
  • Automatic location sharing using GPS
  • Multimedia evidence capture - automatically captures 5 images + 7-second audio recording
  • Shake-to-activate emergency alerts
  • Real-time Firebase sync for instant responder notification
  • Emergency contact notification system

๐Ÿค– AI-Powered Features

  • Gemini AI Integration for civic issue analysis
  • Automatic issue categorization from photos
  • AI-generated user health summaries for emergency responders
  • Smart priority assessment for reported issues

๐Ÿ“ Location Services

  • Interactive Leaflet maps for precise location marking
  • Reverse geocoding for address resolution
  • Real-time location tracking during emergencies
  • Accuracy indicators for GPS positioning

๐Ÿ‘ฎ Admin Control Centers

  • Police Control Center (/police-admin)
  • Ambulance Control Center (/ambulance-admin)
  • Fire Control Center (/fire-admin)
  • Central Admin Dashboard (/admin)
  • Real-time SOS monitoring with live updates
  • Quick-view health summary popups
  • **One-click case assignment and status updates

๐Ÿ˜๏ธ Community Reporting

  • Civic issue reporting with photo evidence
  • AI-powered issue analysis and categorization
  • Upvote/downvote system for community prioritization
  • Status tracking from submission to resolution
  • Multiple categories: Roads, Street Lights, Water, Drainage, Garbage, Safety, Noise

๐Ÿ‘ค User Management

  • Mobile number registration with OTP verification
  • Medical profile storage (blood group, conditions, allergies)
  • Emergency contacts management
  • User dashboard for tracking submitted reports

๐Ÿ› ๏ธ Tech Stack

Category Technology
โš›๏ธ Frontend React 18, React Router DOM 6
โšก Build Tool Vite 5
๐Ÿ”ฅ Backend Firebase Realtime Database
๐Ÿ—„๏ธ Storage Supabase Storage, ImgBB
๐Ÿ—บ๏ธ Maps Leaflet, React-Leaflet
๐Ÿค– AI Google Gemini API
๐ŸŽจ Styling Custom CSS with CSS Variables

๐Ÿ“ Project Structure

rapidassist/
โ”œโ”€โ”€ ๐Ÿ“„ index.html              # Entry HTML file
โ”œโ”€โ”€ ๐Ÿ“ฆ package.json            # Dependencies & scripts
โ”œโ”€โ”€ โš™๏ธ vite.config.js          # Vite configuration
โ”œโ”€โ”€ ๐ŸŒ vercel.json             # Vercel deployment config
โ”œโ”€โ”€ ๐Ÿ“‚ public/
โ”‚   โ”œโ”€โ”€ manifest.json          # PWA manifest
โ”‚   โ””โ”€โ”€ sw.js                  # Service worker
โ””โ”€โ”€ ๐Ÿ“‚ src/
    โ”œโ”€โ”€ ๐Ÿš€ main.jsx            # React entry point
    โ”œโ”€โ”€ ๐Ÿ“ฑ App.jsx             # Main app with routing
    โ”œโ”€โ”€ ๐Ÿ”ฅ firebase.js         # Firebase configuration
    โ”œโ”€โ”€ ๐Ÿ—„๏ธ supabase.js         # Supabase configuration
    โ”œโ”€โ”€ ๐Ÿ“‚ components/
    โ”‚   โ”œโ”€โ”€ ๐ŸŽต AudioEvidencePlayer/   # Audio playback for evidence
    โ”‚   โ”œโ”€โ”€ ๐Ÿšจ EmergencyCard/         # Emergency service cards
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Header/                # Navigation header
    โ”‚   โ”œโ”€โ”€ ๐Ÿ—บ๏ธ LocationMap/           # Leaflet map component
    โ”‚   โ”œโ”€โ”€ ๐Ÿ” LoginForm/             # Authentication form
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“ RegistrationForm/      # User registration
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“‹ ReportCard/            # Issue report display
    โ”‚   โ”œโ”€โ”€ ๐Ÿ†˜ SOSButton/             # SOS activation button
    โ”‚   โ””โ”€โ”€ ๐Ÿ“Š StatusTracker/         # Status timeline
    โ”œโ”€โ”€ ๐Ÿ“‚ context/
    โ”‚   โ”œโ”€โ”€ ๐Ÿ”’ AuthContext.jsx        # Authentication state
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“‘ ReportsContext.jsx     # Reports & SOS state
    โ”‚   โ””โ”€โ”€ ๐Ÿ”” ToastContext.jsx       # Notification system
    โ”œโ”€โ”€ ๐Ÿ“‚ pages/
    โ”‚   โ”œโ”€โ”€ ๐Ÿ  Home.jsx               # Landing page
    โ”‚   โ”œโ”€โ”€ ๐Ÿ” Login.jsx              # Login page
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Register.jsx           # Registration page
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“Š Dashboard.jsx          # User dashboard
    โ”‚   โ”œโ”€โ”€ ๐Ÿ†˜ SOS.jsx                # Emergency SOS page
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“‹ ReportIssue.jsx        # Issue reporting
    โ”‚   โ”œโ”€โ”€ ๐Ÿ˜๏ธ Community.jsx          # Community issues feed
    โ”‚   โ”œโ”€โ”€ ๐Ÿ‘ค UserProfile.jsx        # User profile management
    โ”‚   โ”œโ”€โ”€ ๐Ÿ›ก๏ธ AdminDashboard.jsx     # Central admin panel
    โ”‚   โ”œโ”€โ”€ ๐Ÿ‘ฎ PoliceAdmin.jsx        # Police control center
    โ”‚   โ”œโ”€โ”€ ๐Ÿš‘ AmbulanceAdmin.jsx     # Ambulance control center
    โ”‚   โ””โ”€โ”€ ๐Ÿš’ FireAdmin.jsx          # Fire control center
    โ”œโ”€โ”€ ๐Ÿ“‚ styles/
    โ”‚   โ”œโ”€โ”€ ๐ŸŽจ index.css              # Base styles
    โ”‚   โ””โ”€โ”€ โœจ enhanced.css           # Component styles
    โ””โ”€โ”€ ๐Ÿ“‚ utils/
        โ”œโ”€โ”€ ๐Ÿค– civicAnalyzer.js       # Gemini AI integration
        โ”œโ”€โ”€ ๐Ÿ“ก sendingSOS.js          # SOS evidence capture
        โ””โ”€โ”€ โš™๏ธ constants.js           # App constants

๐Ÿš€ Installation

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Firebase project
  • Supabase project (for audio storage)
  • Gemini API key (for AI features)

Setup

  1. Clone the repository

    git clone https://github.com/yourusername/rapidassist.git
    cd rapidassist
  2. Install dependencies

    npm install
  3. Configure environment variables

    Create a .env file in the root directory:

    # Firebase Configuration
    VITE_FIREBASE_API_KEY=your_firebase_api_key
    VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
    VITE_FIREBASE_PROJECT_ID=your_project_id
    VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
    VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
    VITE_FIREBASE_APP_ID=your_app_id
    
    # Supabase Configuration
    VITE_SUPABASE_URL=https://your-project.supabase.co
    VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
    
    # AI Configuration
    VITE_GEMINI_API_KEY=your_gemini_api_key
  4. Start development server

    npm run dev
  5. Build for production

    npm run build

๐Ÿ“ฑ Usage

For Citizens

Action Description
๐Ÿ†˜ Emergency SOS Press the SOS button, select service type, and wait 7 seconds for automatic alert
๐Ÿ“ธ Report Issue Take a photo, AI analyzes and categorizes it, then submit
๐Ÿ˜๏ธ Community Browse issues, upvote important ones, add your own posts
๐Ÿ‘ค Profile Manage medical info and emergency contacts

For Admins

Login Credentials
๐Ÿ‘ฎ Police police / police123
๐Ÿš‘ Ambulance ambulance / ambulance123
๐Ÿš’ Fire fire / fire123
๐Ÿ›ก๏ธ General Admin admin / admin123

๐Ÿ”„ Data Flow

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   ๐Ÿ‘ค Citizen    โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  ๐Ÿ“ฑ RapidAssist  โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  ๐Ÿ”ฅ Firebase    โ”‚
โ”‚                 โ”‚     โ”‚     Frontend      โ”‚     โ”‚  Realtime DB    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚                         โ”‚
                                โ–ผ                         โ–ผ
                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                        โ”‚  ๐Ÿค– Gemini AI    โ”‚     โ”‚  ๐Ÿ‘ฎ Admin       โ”‚
                        โ”‚  Analysis        โ”‚     โ”‚  Dashboards     โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽจ Key Components

๐Ÿ†˜ SOS System Flow

  1. User presses SOS button
  2. 7-second countdown begins (cancelable)
  3. Camera/microphone permissions requested
  4. Parallel capture: 5 images + 7s audio recording
  5. Media uploaded to ImgBB (images) + Supabase (audio)
  6. Emergency data pushed to Firebase with:
    • Location (GPS coordinates + address)
    • User profile & medical info
    • AI-generated health summary
    • Emergency contacts
    • Evidence URLs
  7. Real-time notification to admin dashboards
  8. Admin can view, assign, and manage cases

๐Ÿค– AI Integration

  • Civic Issue Analysis: Upload a photo โ†’ Gemini analyzes โ†’ Returns structured JSON with category, priority, description
  • User Health Summary: Generates concise emergency summary from user's medical profile during registration

๐Ÿ”ง Configuration

Firebase Rules (Example)

{
  "rules": {
    "emergencies": {
      ".read": true,
      ".write": true
    },
    "reports": {
      ".read": true,
      ".write": true
    },
    "users": {
      "$uid": {
        ".read": true,
        ".write": true
      }
    }
  }
}

Supabase Storage Bucket

Create a bucket named sos-recordings with public access for audio evidence storage.


๐ŸŒ Deployment

Vercel (Recommended)

npm run build
vercel --prod

The vercel.json is pre-configured for SPA routing.


๐Ÿ“Š Emergency Services

Service Number Color Use Case
๐Ÿ‘ฎ Police 100 ๐Ÿ”ต Blue Crime, accidents, security
๐Ÿš‘ Ambulance 108 ๐Ÿ”ด Red Medical emergencies
๐Ÿš’ Fire 101 ๐ŸŸ  Orange Fire, rescue operations

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments


Made with โค๏ธ for INVENTO 2026

๐Ÿ†˜ Your Safety, Our Priority ๐Ÿ†˜

About

CivicSOS is a civic-tech platform combining crowdsourced issue reporting with a one-tap emergency SOS system. Citizens report issues via AI-powered classification, track resolution in real time, and trigger SOS with medical data for faster emergency response.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors