AI-powered emergency detection and response app built for hackathon
Seraphim is a two-mode mobile app (Victim and Helper) that detects emergencies through device sensors and AI camera analysis, generates objective reports free of panic or emotion, and automatically alerts operators via Telegram voice messages.
When a victim's phone detects a fall or the camera recognizes a disaster, Seraphim builds a structured emergency report β including GPS location and health vitals β converts it to speech, and sends it directly to an operator on Telegram.
- π¨ Automatic Emergency Detection β Fall detection via accelerometer, disaster recognition via camera + Gemini AI
- π Smart Reporting β AI-filtered objective reports (removes panic/emotion from raw data)
- π Telegram Alerts β Automated voice messages and text alerts to emergency operators
- β€οΈ Health Integration β Apple HealthKit & Google Health Connect support (heart rate, blood oxygen, blood glucose)
- π― Helper Mode β AI-powered first-aid guidance for bystanders
- π· Camera AI β Real-time disaster classification (fire, flood, crash, medical emergency, violence)
- π£οΈ Text-to-Speech β Emergency reports narrated via Google TTS for voice delivery
| Layer | Technology |
|---|---|
| Mobile App | React Native 0.83 Β· Expo 55 Β· TypeScript |
| Navigation | React Navigation (native stack + bottom tabs) |
| State | Zustand |
| AI / Vision | Google Gemini (@google/generative-ai) |
| Sensors | expo-sensors (accelerometer), expo-camera, expo-location |
| Backend | Python 3.10+ Β· FastAPI Β· Uvicorn |
| Telegram | Telethon Β· py-tgcalls |
| TTS | gTTS (Google Translate TTS) |
βββββββββββββββββββββββββββββββββββββββββββββββ
β Mobile App (Expo) β
β β
β ββββββββββββ ββββββββββββ βββββββββββββ β
β β Sensors β β Camera + β β Health β β
β β (Fall β β Gemini β β (Apple / β β
β β Detect) β β AI β β Google) β β
β ββββββ¬ββββββ ββββββ¬ββββββ βββββββ¬ββββββ β
β β β β β
β ββββββββ¬ββββββββ΄βββββββββββββββ β
β βΌ β
β βββββββββββββββββββ β
β β Panic Filter + β β
β β Report Generatorβ β
β ββββββββββ¬βββββββββ β
ββββββββββββββββΌβββββββββββββββββββββββββββββββββ
β POST /emergency
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend (FastAPI) β
β β
β ββββββββββββββββββ βββββββββββββββββββββ β
β β Report β β TTS Service β β
β β Processor ββββ (gTTS β MP3) β β
β ββββββββββββββββββ ββββββββββ¬βββββββββββ β
β β β
β ββββββββββββΌβββββββββββ β
β β Telegram Caller β β
β β (Telethon) β β
β ββββββββββββ¬βββββββββββ β
βββββββββββββββββββββββββββββββββΌβββββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β Operator (Telegram) β
β π Voice message β
β π Text alert β
βββββββββββββββββββββββββ
Seraphim/
βββ app/ # React Native / Expo mobile app
β βββ src/
β β βββ components/
β β β βββ CameraView.tsx # Camera preview + AI trigger
β β β βββ EmergencyReport.tsx # Report display UI
β β β βββ FirstAidGuide.tsx # Helper mode first-aid steps
β β β βββ HealthMetrics.tsx # Vitals display
β β β βββ SensorMonitor.tsx # Real-time sensor readout
β β βββ hooks/
β β β βββ useEmergencyDetection.ts
β β β βββ useHealthData.ts
β β β βββ useSensors.ts
β β βββ navigation/
β β β βββ AppNavigator.tsx
β β β βββ MainTabs.tsx
β β βββ screens/
β β β βββ HomeScreen.tsx # Mode selection (Victim / Helper)
β β β βββ VictimDashboard.tsx # Sensor monitoring + alerts
β β β βββ HelperDashboard.tsx # First-aid guidance
β β β βββ EmergencyScreen.tsx # Active emergency view
β β β βββ SettingsScreen.tsx # API keys, backend URL
β β βββ services/
β β β βββ ai/
β β β β βββ GeminiService.ts # Gemini API wrapper
β β β β βββ DisasterDetector.ts # Camera frame classification
β β β β βββ PanicFilter.ts # Strips emotion from reports
β β β βββ sensors/
β β β β βββ FallDetector.ts # Accelerometer-based fall detection
β β β β βββ SensorManager.ts # Sensor lifecycle management
β β β βββ emergency/
β β β β βββ EmergencyManager.ts # Orchestrates detection β report β send
β β β β βββ ReportGenerator.ts # Builds structured report JSON
β β β βββ health/
β β β β βββ HealthProvider.ts # Abstract health interface
β β β β βββ AppleHealthProvider.ts # HealthKit integration
β β β β βββ GoogleHealthProvider.ts# Health Connect integration
β β β βββ api/
β β β βββ BackendClient.ts # HTTP client for FastAPI backend
β β βββ store/
β β β βββ useStore.ts # Zustand global state
β β βββ types/
β βββ App.tsx
β βββ package.json
βββ backend/ # Python FastAPI server
β βββ main.py # FastAPI app + endpoints
β βββ services/
β β βββ report_processor.py # Formats report for TTS narration
β β βββ tts_service.py # gTTS text-to-speech
β β βββ telegram_caller.py # Telethon voice messages + alerts
β βββ audio/ # Generated TTS audio files
β βββ .env.example # Environment variable template
β βββ requirements.txt
βββ LICENSE # MIT License
βββ README.md
- Node.js 18+
- Python 3.10+
- Expo account (free signup)
- Gemini API key β free from Google AI Studio
- Telegram API credentials β from my.telegram.org
cd app/
npm install
npx expo start --dev-client
# or build for a specific platform:
# npx expo run:android
# npx expo run:iosConfigure your Gemini API key in the app's Settings screen after launch.
cd backend/
# Create & activate virtual environment
python -m venv venv
# Windows:
venv\Scripts\activate
# macOS / Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env and fill in:
# TELEGRAM_API_ID, TELEGRAM_API_HASH, TELEGRAM_PHONE,
# OPERATOR_TELEGRAM_ID
# Run the server
python main.pyThe server starts at http://0.0.0.0:8000 with auto-reload enabled.
- Open Seraphim and choose Victim.
- The app begins monitoring the accelerometer for falls and (optionally) the camera for disaster scenes.
- When an emergency is detected, the app:
- Collects GPS location and available health data.
- Runs observations through the Panic Filter to keep the report objective.
- Sends the structured report to the backend.
- The backend converts the report to speech and delivers a voice message + text alert to the Telegram operator.
- Open Seraphim and choose Helper.
- The app provides AI-powered first-aid guidance: point your camera at the scene and receive step-by-step instructions for how to assist.
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check β returns server status and Telegram connection state |
POST |
/emergency |
Submit an emergency report; triggers TTS generation and Telegram alert |
GET |
/status/{call_id} |
Check the status of a previously initiated emergency call |
POST |
/test-call |
Send a test voice message to the operator to verify the pipeline |
Interactive API docs are available at /docs (Swagger UI) when the backend is running.
| Variable | Description |
|---|---|
TELEGRAM_API_ID |
Telegram API ID from my.telegram.org |
TELEGRAM_API_HASH |
Telegram API hash |
TELEGRAM_PHONE |
Phone number associated with the Telegram account |
OPERATOR_TELEGRAM_ID |
Telegram user ID of the operator who receives alerts |
HOST |
Server bind address (default 0.0.0.0) |
PORT |
Server port (default 8000) |
This project is licensed under the MIT License β see the LICENSE file for details.