Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

83 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿšจ EmergencyConnect-AI

AI-Powered Emergency Assistance Backend built with Django REST Framework, Gemini AI & Supabase

Django CI Python Django DRF Gemini AI Supabase Swagger MkDocs


๐Ÿ“Œ Overview

EmergencyConnect-AI is an intelligent emergency assistance backend that leverages Generative AI to provide quick emergency classification and first-aid guidance.

Given a user's emergency description, the system:

  • ๐Ÿš‘ Classifies the emergency type
  • โš ๏ธ Determines the priority level
  • ๐Ÿ“ Generates a concise emergency summary
  • ๐Ÿฉบ Provides immediate first-aid recommendations
  • โ˜๏ธ Stores AI responses for future analysis

โœจ Features

Feature Description
๐Ÿค– AI Emergency Analysis Understands natural language emergencies
๐Ÿš‘ Emergency Classification Identifies emergency category
โš ๏ธ Priority Detection LOW / MEDIUM / HIGH / CRITICAL
๐Ÿฉบ First Aid Assistance Immediate safety recommendations
๐Ÿ“š Swagger Documentation Interactive API testing
๐Ÿ“– MkDocs Documentation Complete project documentation
โ˜๏ธ Supabase Integration Cloud database logging
๐Ÿ”„ Retry & Fallback Logic Handles AI/API failures gracefully

๐Ÿ›  Tech Stack

Category Technologies
Backend Python, Django, Django REST Framework
AI Gemini AI
Database Supabase, PostgreSQL, SQLite
Documentation Swagger (drf-spectacular), MkDocs

๐Ÿ— Architecture

             User
                โ”‚
                โ–ผ
       Django REST API
                โ”‚
                โ–ผ
         Gemini AI Service
                โ”‚
                โ–ผ
      Emergency Classification
                โ”‚
                โ–ผ
        Structured JSON Output
                โ”‚
                โ–ผ
         Supabase Logging



๐Ÿ“‚ Project Structure

backend/
โ”‚
โ”œโ”€โ”€ ai_assistant/
โ”œโ”€โ”€ emergency/
โ”œโ”€โ”€ users/
โ”œโ”€โ”€ emergencyconnect/
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ index.md
โ”‚   โ”œโ”€โ”€ installation.md
โ”‚   โ”œโ”€โ”€ api.md
โ”‚   โ”œโ”€โ”€ ai_module.md
โ”‚   โ””โ”€โ”€ deployment.md
โ”‚
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ mkdocs.yml
โ””โ”€โ”€ README.md

๐Ÿš€ Installation

Follow these steps to set up EmergencyConnect-AI on your local machine.

1๏ธโƒฃ Clone the Repository

git clone https://github.com/akeren12/EmergencyConnect-AI.git
cd EmergencyConnect-AI/backend

2๏ธโƒฃ Create a Virtual Environment

python -m venv venv

3๏ธโƒฃ Activate the Virtual Environment

๐ŸชŸ Windows

venv\Scripts\activate

๐Ÿง Linux / ๐ŸŽ macOS

source venv/bin/activate

4๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

5๏ธโƒฃ Apply Database Migrations

python manage.py migrate

6๏ธโƒฃ Start the Development Server

python manage.py runserver

๐ŸŽ‰ Open in Your Browser

http://127.0.0.1:8000/

โœ… You're Ready!

Your local instance of EmergencyConnect-AI is now running and ready for development and testing.


๐Ÿ“ธ Project Screenshots

Swagger UI MkDocs Documentation
Swagger UI MkDocs Documentation
docs/images/mkdocs-home.png

๐Ÿ“ก API Endpoints

Method Endpoint Description
POST /api/ai/analyze/ Analyze emergency description
GET /api/schema/ OpenAPI Schema
GET /api/schema/swagger-ui/ Swagger Documentation

๐Ÿ“š API Documentation

Swagger UI

http://127.0.0.1:8000/api/schema/swagger-ui/

Interactive OpenAPI documentation generated using drf-spectacular.

Postman Collection

Available in:

docs/postman/EmergencyConnect-AI.postman_collection.json

๐Ÿค– Sample Request

{ "description": "A person is unconscious and not breathing." }


โœ… Sample Response

{ "emergency_type": "Cardiac Arrest", "priority": "CRITICAL", "summary": "The person appears to be in cardiac arrest.", "first_aid": [ "Call emergency services immediately.", "Begin CPR if trained.", "Use an AED if available." ] }

๐Ÿงช Test Coverage

EmergencyConnect-AI includes a comprehensive automated testing suite built with pytest.

Test Summary

  • โœ… 27 Passing Tests
  • โœ… Serializer Tests
  • โœ… View Tests
  • โœ… Authentication Flow Tests
  • โœ… AI Integration Tests (Gemini API Mocked)
  • โœ… 95% Overall Test Coverage

Coverage Report

Screenshot 2026-06-19 130526

๐Ÿ“š Documentation

Documentation Link
Swagger UI /api/schema/swagger-ui/
OpenAPI Schema /api/schema/
MkDocs mkdocs serve

๐Ÿš€ Current Status

Module Status
Django Backend โœ… Completed
REST APIs โœ… Completed
Gemini AI Integration โœ… Completed
Swagger Documentation โœ… Completed
MkDocs Documentation โœ… Completed
Supabase Integration โœ… Completed
Retry & Fallback Logic โœ… Completed
Deployment ๐Ÿ”„ In Progress

๐Ÿ”ฎ Future Enhancements

  • ๐Ÿ“ฑ One-Tap SOS
  • ๐ŸŽค Voice Emergency Detection
  • ๐Ÿฅ Nearby Hospital Locator
  • ๐Ÿฉธ Blood Bank Recommendations
  • ๐Ÿ’Š Pharmacy Recommendations
  • ๐ŸŒ Multilingual Support
  • ๐Ÿ“ Live Location Sharing
  • ๐Ÿšจ AI-generated SOS Messages

๐ŸŒ Live Demo

Live URL: https://emergencyconnect-ai-production-ae23.up.railway.app/login


## ๐Ÿ‘ฉโ€๐Ÿ’ป Author

**Aksa Elsa Jose**

B.Tech Computer Science & Engineering (Data Science)

**AI โ€ข Django โ€ข REST APIs โ€ข Generative AI**

---

<div align="center">

โญ If you found this project useful, consider giving it a star!

Built with โค๏ธ using Django REST Framework & Gemini AI

</div>

About

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages