A robust, hackathon-ready emergency notification and response system. Features an AI-driven Django backend and a Real-time Flutter Dashboard with WebSocket synchronization.
- Backend (
/backend): Python Django + Django Channels server.- AI Engine: TensorFlow/Keras Dense Neural Network for intent and severity classification.
- Database: Django ORM with SQLite for local persistence.
- Real-time: WebSockets (via Daphne) for instant incident broadcasting and live chat.
- Frontend (
/frontend): Flutter Cross-Platform App.- Dashboard: Live feed of active incidents categorized by severity.
- Triage: Detail view with live team chat and incident resolution.
Ensure you have Python 3.8+ installed (3.12 recommended).
# Navigate to backend
cd backend
# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtCreate a .env file in the backend/ directory by copying the example:
cp .env.example .envEnsure you fill out any required settings inside backend/.env.
Run the initial Django migrations to set up the SQLite database:
python manage.py migrateAlertNest utilizes a dual-model AI architecture:
- NLP Classifier (
nlp_model.keras): Categorizes text intents (FIRE, MEDICAL, SECURITY). - Emergency Priority Engine (
epe_model.keras): A dual-input regression model that ranks incidents by severity, risk, and urgency.
The repository includes pre-trained weights for both models. You do not need to re-train them unless you modify the training datasets.
Since pre-trained weights are included, you can start the system immediately:
- Start the Backend:
python manage.py runserver(The models load into memory automatically). - Test Inference: Run
python demo_epe.pyto see the AI prioritize emergencies without any setup.
Note: You only need to run the scripts in the "Optional Training" section below if you want to rebuild the AI logic from scratch.
If you wish to update or re-train the models with new data:
1. Base NLP Classifier:
# GPU (Recommended)
python train_model.py
# CPU Fallback
python train_model_cpu.py2. Emergency Priority Engine (EPE):
# Generate synthetic priority data first
python generate_epe_data.py
# Train the EPE regression model
python train_epe.pyStart the Django ASGI development server (so WebSockets and HTTP requests work simultaneously):
python manage.py runserver 0.0.0.0:8000- API Base:
http://127.0.0.1:8000/ - Websocket:
ws://127.0.0.1:8000/ws/ - Tandem Model Demo: Run
python demo_epe.pyto see the NLP Classifer and Priority Engine work in tandem—the output will show both the incident type and its priority score in a single ranked JSON payload.
In a new terminal, ensure you have the Flutter SDK installed.
# Navigate to frontend
cd frontend
# Fetch dependencies
flutter pub get
# (Linux Users Only) Enable Desktop Support if testing natively
flutter config --enable-linux-desktop
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-devYou can run the app on your connected device, emulator, or as a native desktop/web app:
flutter run(If testing web compatibility, you can serve using flutter run -d web-server or flutter run -d chrome)
- Smart AI Classification: Text input like "Smoke in the lobby" ➔ Categorized as [FIRE] - HIGH SEVERITY instantly via TensorFlow.
- Live Desk: The dashboard updates instantly via WebSockets without refreshing.
- One-Click Resolve: Responding to an incident clears it from all connected responder screens in real-time.
backend/: Django project (alertnest), Channels WebSocket routing (core), models, and TensorFlow model scripts.frontend/: Flutter source code, UI components, and platform runners.backend/tokenizer.json: Word index mapping for the AI engine.backend/nlp_model.keras: Base classifier weights.backend/epe_model.keras: Emergency Priority Engine weights (fully trained).