A real-time AI-powered emergency alert system that connects patients to the nearest hospital β automatically, intelligently, instantly.
π Features β’ π§ How It Works β’ βοΈ Tech Stack β’ π οΈ Setup β’ πΈ Screenshots β’ πΊοΈ Roadmap
LifeLine is an AI-powered emergency SOS web application built to bridge the critical gap between someone in distress and the nearest available hospital β in under 10 seconds.
When a user triggers an SOS:
- A 5-second countdown gives them a chance to cancel accidental triggers
- Their GPS location is captured automatically
- Their pre-registered medical conditions are sent to the API
- The AI finds the shortest-distance hospital using routing analysis
- The hospital receives an instant real-time alert with patient details and location
π‘ Built as a Hackathon project. Designed for real-world deployment in India's emergency response ecosystem.
| Feature | Description |
|---|---|
| π One-Tap SOS | Single button triggers the entire emergency flow |
| β±οΈ 5-Second Safety Countdown | Prevents accidental alerts with a cancellable timer |
| π Auto GPS Location Capture | Browser geolocation API captures exact coordinates |
| π§ AI Hospital Routing | Finds shortest-distance hospital using pre-registered medical data |
| π₯ Hospital Dashboard | Real-time alert receiver for hospital staff |
| πΊοΈ Live Alert Map | Real-time map showing active SOS locations |
| π Medical Profile Integration | Pre-registered conditions sent with every alert |
| π Encrypted Data | Patient data encrypted using cryptography library |
| β‘ Real-time Updates | Instant sender β receiver communication |
USER PRESSES SOS BUTTON
β
βΌ
βββββββββββββββββββββββ
β 5-Second Countdown β β User can cancel if accidental
β β±οΈ 5 4 3 2 1... β
ββββββββββ¬βββββββββββββ
β (not cancelled)
βΌ
βββββββββββββββββββββββ
β GPS Location β β Browser Geolocation API
β π lat, lng capture β
ββββββββββ¬βββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β AI Analysis (FastAPI Backend) β
β β’ Patient's pre-registered β
β medical conditions β
β β’ Location coordinates β
β β’ Distance to all registered β
β hospitals β
β β Returns: Nearest suitable hospitalβ
ββββββββββ¬βββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββ ββββββββββββββββββββββββ
β Patient sees: β β Hospital receives: β
β β
Alert sent β β π SOS Notification β
β π₯ Hospital name β β π Patient location β
β π Distance/ETA β β π©Ί Medical conditionsβ
β πΊοΈ Live map β β β° Time of alert β
βββββββββββββββββββββββ ββββββββββββββββββββββββ
| Technology | Purpose |
|---|---|
| Python 3.10+ | Core language |
| FastAPI | High-performance REST API framework |
| SQLAlchemy | ORM for database operations |
| SQLite | Lightweight database (upgradeable to PostgreSQL) |
| Uvicorn | ASGI server |
| cryptography | Patient data encryption |
| python-dotenv | Environment variable management |
| requests | External API calls for routing |
| Technology | Purpose |
|---|---|
| HTML5 / CSS3 | Structure and styling |
| JavaScript | SOS countdown, geolocation, real-time updates |
| Geolocation API | Browser GPS capture |
| Leaflet.js / Maps API | Live alert map visualization |
- Python 3.10+
- pip
- Git
git clone https://github.com/<your-username>/lifeline.git
cd lifelinepython -m venv .venv
# Windows PowerShell
.venv\Scripts\Activate.ps1
# Windows CMD
.venv\Scripts\activate.bat
# Mac / Linux
source .venv/bin/activatepip install fastapi uvicorn sqlalchemy requests python-dotenv cryptographycp .env.example .env
# Edit .env with your configurationpython -c "from newalert.backend.database import init_db; init_db()"# Development (localhost β allows browser geolocation)
python -m uvicorn newalert.backend.main:app --reload --host 127.0.0.1 --port 8000http://127.0.0.1:8000
β οΈ Note: Browsers require HTTPS for geolocation on non-localhost origins. Uselocalhostfor development or deploy with HTTPS for production.
lifeline/
βββ newalert/
β βββ backend/
β βββ main.py β FastAPI app entry point
β βββ database.py β SQLAlchemy models & DB init
β βββ routes/
β β βββ alert.py β SOS alert endpoints
β β βββ hospital.py β Hospital dashboard endpoints
β βββ utils/
β βββ geo.py β Distance calculation & routing
β βββ encrypt.py β Data encryption utilities
βββ frontend/
β βββ index.html β User SOS page
β βββ hospital.html β Hospital dashboard
β βββ static/
β βββ style.css
β βββ app.js β Countdown, geolocation logic
βββ .env.example
βββ .gitignore
βββ requirements.txt
βββ README.md
- β Patient medical data is encrypted before storage
- β
.env,certs/, andlifeline.dbare gitignored β never committed - β Location data is only used during active alert β not stored permanently
- β Hospital access is authenticated β no public access to patient data
- SOS button with 5-second countdown
- GPS location capture
- AI-powered nearest hospital routing
- Hospital real-time alert dashboard
- Live alert map
- Medical profile integration
- π SMS/WhatsApp notification to family contacts
- π Deploy on AWS EC2 with HTTPS
- π Mobile PWA (installable on phone)
- π Multi-language support (Tamil, Hindi)
- π Ambulance tracking integration
- π Voice-activated SOS trigger
Inter-College Hackathon 2025 β Problem Statement: AI Solutions for Rural Healthcare
π₯ Selected to represent college | Successfully built & demonstrated working prototype
Pull requests are welcome! For major changes, please open an issue first.
git checkout -b feature/your-feature-name
git commit -m "Add: your feature description"
git push origin feature/your-feature-nameRajanithi N
- π AI & Data Science Student β Dhanalakshmi Srinivasan University
- π§ rajanithiff@gmail.com
- π IBM | Google | Microsoft | AWS Certified (Coursera)
This project is licensed under the MIT License.
β If LifeLine helped or inspired you, give it a star!
Built with β€οΈ to save lives