This is the official submission of team 4Stack for HACKOUT'25 organised by Dhirubhai Ambani University (formerly DAIICT)
The challenge track was coast warning system with dashboard, interactive map and notification system
The team members were Tirth Patel, Divy Mevada github, Lakshya Mehta github
Website Demonstration - Drive
A comprehensive real-time coastal monitoring and alert system that combines machine learning predictions with live data feeds to provide early warnings for coastal hazards.
The Coastal Alarm System is designed to monitor coastal conditions in real-time, predict potential risks using machine learning, and alert users to dangerous conditions. The system integrates multiple data sources including NOAA and USGS APIs to provide accurate, timely information about coastal threats.
coastal-alarm-system/
βββ π± coastal-dashboard/ # React Frontend Application
β βββ src/
β β βββ components/ # React components
β β βββ services/ # API integration
β β βββ contexts/ # React contexts (Auth, etc.)
β β βββ data/ # Static data and configurations
β βββ public/ # Static assets
β βββ package.json # Frontend dependencies
βββ π§ coastal_backend/ # Django Backend API
β βββ coastal_backend/ # Main Django project
β βββ monitoring/ # Core monitoring application
β βββ ml_integration/ # ML model integration
β βββ ml_models/ # Machine learning model files
β βββ requirements.txt # Backend dependencies
βββ π INTEGRATION_GUIDE.md # Detailed integration instructions
βββ π README.md # This file
- Real-time Dashboard: Live metrics and status indicators
- Interactive Map: Visual representation of monitoring locations
- Alert Management: Real-time alert notifications and resolution
- Data Visualization: Charts and graphs for sensor data
- User Authentication: Secure login and signup system
- Responsive Design: Works on desktop and mobile devices
- RESTful API: Comprehensive API for all system operations
- Real-time Data Ingestion: Automated data collection from NOAA/USGS
- ML Integration: Seamless integration with machine learning models
- Alert System: Automated alert generation and management
- Background Processing: Celery-based task queue for data processing
- Admin Interface: Django admin for system management
- Risk Prediction: ML models for coastal risk assessment
- Customizable Models: Easy integration of your own trained models
- Real-time Processing: Continuous risk evaluation
- Historical Analysis: Trend analysis and pattern recognition
- Frontend: Node.js 16+ and npm
- Backend: Python 3.8+ and pip
- Optional: Redis (for production background tasks)
git clone <your-repository-url>
cd coastal-alarm-systemcd coastal_backend
# Install dependencies
pip install -r requirements.txt
# Set up database
python manage.py makemigrations
python manage.py migrate
# Create sample data
python manage.py seed_data
# Create admin user (optional)
python manage.py createsuperuser
# Start the server
python start_system.pyThe backend will be available at http://localhost:8000
cd coastal-dashboard
# Install dependencies
npm install
# Start development server
npm startThe frontend will be available at http://localhost:3000
cd coastal_backend
python test_integration.pyFrontend Dashboard (http://localhost:3000)
- π Metrics Cards: Active locations, alerts, risk areas, and latest data
- πΊοΈ Interactive Map: 5 coastal monitoring locations with risk indicators
- π Data Charts: Real-time sensor data visualization
- π¨ Alert Panel: Active alerts with resolution capabilities
- π Auto-refresh: Data updates every 30 seconds
Backend API (http://localhost:8000)
- API Documentation: Available endpoints and usage
- Admin Panel:
/admin/- Full system management interface - Health Check:
/api/health/- System status monitoring
- Framework: React 19.1.1
- Routing: React Router DOM 7.8.2
- HTTP Client: Axios 1.11.0
- Authentication: Google OAuth + JWT
- Styling: CSS3 with responsive design
- Framework: Django 5.2.5
- API: Django REST Framework 3.16.1
- Database: SQLite (development) / PostgreSQL (production)
- Background Tasks: Celery 5.5.3
- Cache/Message Broker: Redis 6.4.0
- ML Libraries: Pandas, NumPy, Scikit-learn
- NOAA Tides and Currents API: Water levels and meteorological data
- USGS Water Services: Stream gauge and water quality data
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health/ |
System health check |
| GET | /api/dashboard/ |
Dashboard overview data |
| GET | /api/locations/ |
List all monitoring locations |
| GET | /api/alerts/active/ |
Get active alerts |
| GET | /api/sensor-data/ |
Retrieve sensor measurements |
| POST | /api/sensor-data/ |
Add new sensor data |
| GET | /api/risk-assessments/ |
Get ML risk predictions |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/locations/{id}/ |
Get location details |
| POST | /api/locations/{id}/run_prediction/ |
Trigger ML prediction |
| GET | /api/locations/{id}/sensor_data/ |
Get location sensor data |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/alerts/ |
List all alerts (filterable) |
| POST | /api/alerts/{id}/resolve/ |
Resolve an alert |
-
Prepare Your Model:
- Ensure it accepts pandas DataFrame with standard coastal data columns
- Implement
predict_proba()method for risk assessment - Save as
.pklor.joblibfile
-
Integrate the Model:
cd coastal_backend python integrate_your_model.py -
Model Requirements: Your model should process these input features:
water_level,wave_height,wind_speed,wind_directionair_pressure,water_temperature,hour_of_day,day_of_year
# Example of how your model should be structured
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
class CoastalRiskModel:
def __init__(self):
self.model = RandomForestClassifier()
def predict_proba(self, X):
# X is a pandas DataFrame with coastal data
return self.model.predict_proba(X)-
Environment Variables:
cp coastal_backend/.env.example coastal_backend/.env
-
Edit
.envfile:SECRET_KEY=your-secret-key DEBUG=True NOAA_API_KEY=your-noaa-api-key USGS_API_KEY=your-usgs-api-key ALERT_THRESHOLD=0.7
- API URL (for production):
Edit
coastal-dashboard/src/services/api.js:const API_BASE_URL = 'https://your-backend-domain.com/api';
cd coastal_backend
# Run all tests
python manage.py test
# Test API endpoints
python test_api.py
# Test integration
python test_integration.pycd coastal-dashboard
# Run React tests
npm test
# Build production version
npm run build-
Production Settings:
- Set
DEBUG=False - Configure PostgreSQL database
- Set up Redis for Celery
- Configure proper security settings
- Set
-
Web Server Setup:
# Using gunicorn pip install gunicorn gunicorn coastal_backend.wsgi:application --bind 0.0.0.0:8000 -
Background Tasks:
# Start Celery worker celery -A coastal_backend worker --loglevel=info # Start Celery beat (scheduler) celery -A coastal_backend beat --loglevel=info
-
Build for Production:
cd coastal-dashboard npm run build -
Deploy: Upload
build/folder to your hosting service (Netlify, Vercel, AWS S3, etc.) -
Update CORS: Configure backend CORS settings for your production domain
-
Backend Development:
cd coastal_backend python manage.py startapp new_feature # Add your models, views, and URLs python manage.py makemigrations python manage.py migrate
-
Frontend Development:
cd coastal-dashboard # Create new components in src/components/ # Add new routes in src/App.js # Update API calls in src/services/api.js
- Data Ingestion: Backend fetches data from NOAA/USGS APIs
- ML Processing: Models analyze data and generate risk scores
- Alert Generation: High-risk conditions trigger automatic alerts
- Frontend Display: Dashboard shows real-time data and alerts
- User Interaction: Users can view details and resolve alerts
β Backend won't start
# Check if port 8000 is in use
netstat -an | findstr :8000
# Or use a different port
python manage.py runserver 8001β Frontend can't connect to backend
- Ensure Django server is running on http://localhost:8000
- Check browser console for CORS errors
- Verify API URL in
coastal-dashboard/src/services/api.js
β No data in dashboard
cd coastal_backend
python manage.py seed_dataβ ML predictions not working
- Check if model file exists in
ml_models/directory - Run
python create_dummy_model.pyto create a test model - Verify model format matches expected interface
- Health Check:
GET /api/health/ - Admin Interface: Monitor system status via Django admin
- Logs: Check Django and Celery logs for issues
- Cleanup: Old data is automatically cleaned up via scheduled tasks
- Backup: Regular database backups recommended for production
- Monitoring: Set up alerting for system failures
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Make your changes
- Test thoroughly: Run both frontend and backend tests
- Submit a pull request
- Follow existing code style and patterns
- Add tests for new functionality
- Update documentation for API changes
- Ensure CORS and security considerations
[Add your license information here]
[Add team member information here]
For help and support:
- Check the Integration Guide for detailed setup instructions
- Review API documentation in the backend README
- Check existing issues in the repository
- Create a new issue with detailed error information
- Integration Guide: Detailed setup and integration instructions
- Backend README: Backend-specific documentation
- Frontend README: Frontend-specific documentation
π Built for coastal safety and environmental monitoring