Skip to content

Repository files navigation

Smart Flood PH: AI-Optimized Relief Allocation with Real-Time Monitoring and Blockchain

A comprehensive flood monitoring and disaster response system for the Philippines, featuring real-time monitoring, AI-powered predictions, and blockchain-based transparent relief distribution.

🎯 Project Overview

This system addresses the critical challenges of flood management in the Philippines through:

  • Real-time Flood Monitoring: IoT sensors and community reporting
  • AI-Powered Predictions: Machine learning models for flood risk assessment
  • Emergency Alert System: Multi-channel notifications and evacuation guidance
  • Blockchain Transparency: Immutable relief distribution tracking
  • Cross-Platform Access: Web and mobile applications for all stakeholders

πŸ—οΈ Architecture

β”œβ”€β”€ web-app/              # React.js web application
β”œβ”€β”€ mobile-app/           # Flutter mobile application
β”œβ”€β”€ backend-api/          # Node.js/Express API server
β”œβ”€β”€ ai-prediction/        # Python Flask AI service
β”œβ”€β”€ blockchain-contracts/ # Ethereum smart contracts
└── iot-monitoring/       # IoT sensor integration (future)

πŸš€ Features

Real-Time Monitoring

  • IoT water level sensors integration
  • Crowdsourced flood reporting with GPS
  • Weather data integration (PAGASA API)
  • Real-time dashboard updates via WebSocket

AI-Powered Predictions

  • Machine learning flood risk assessment
  • 6-24 hour flood predictions
  • Location-specific warnings
  • Historical data analysis

Emergency Response

  • Automated alert notifications (SMS, Push, Email)
  • Evacuation route planning
  • Emergency shelter locator
  • Multi-language support

Relief Distribution

  • Blockchain-verified aid tracking
  • QR code beneficiary verification
  • Transparent distribution records
  • Donor contribution monitoring

πŸ› οΈ Technology Stack

Frontend

  • Web: React.js, Material-UI, Chart.js, Socket.io
  • Mobile: Flutter, Provider (state management)

Backend

  • API Server: Node.js, Express.js, Socket.io
  • Database: MongoDB Atlas
  • Authentication: JWT, bcrypt

AI/ML

  • Framework: Python Flask
  • Libraries: scikit-learn, pandas, numpy
  • Models: Random Forest for flood prediction

Blockchain

  • Network: Ethereum Testnet (Sepolia)
  • Language: Solidity
  • Tools: Hardhat, Ethers.js

πŸ“‹ Prerequisites

  • Node.js 16+
  • Python 3.8+
  • MongoDB
  • Flutter SDK
  • Hardhat
  • Git

πŸš€ Installation & Setup

1. Clone and Setup Project Structure

git clone <repository-url>
cd smart-flood-system

2. Backend API Setup

cd backend-api
npm install
cp .env.example .env  # Configure your environment variables
npm start

Environment Variables (.env):

PORT=5000
MONGODB_URI=mongodb://localhost:27017/smart-flood
JWT_SECRET=your-secret-key
PAGASA_API_KEY=your-api-key

3. AI Prediction Service

cd ../ai-prediction
pip install -r requirements.txt
python app.py

4. React Web Application

cd ../web-app
npm install
npm start

5. Flutter Mobile App

cd ../mobile-app
flutter pub get
flutter run

6. Blockchain Contracts

cd ../blockchain-contracts
npm install
npx hardhat compile
npx hardhat run scripts/deploy.js --network sepolia

πŸ”§ Configuration

Database Setup

  1. Install MongoDB locally or use MongoDB Atlas
  2. Update connection string in backend .env
  3. Run database migrations (if any)

IoT Sensor Integration

For IoT sensor integration:

// Example sensor data format
const sensorData = {
  sensorId: "SENSOR_001",
  barangay: "Centro",
  location: {
    latitude: 14.5995,
    longitude: 120.9842
  },
  waterLevel: 2.5, // meters
  temperature: 28.5,
  humidity: 75,
  rainfall: 12.5,
  batteryLevel: 85
};

Blockchain Configuration

Update hardhat.config.js with your network settings:

networks: {
  sepolia: {
    url: process.env.SEPOLIA_URL,
    accounts: [process.env.PRIVATE_KEY]
  }
}

πŸ“± Usage

Web Application

  • Access at http://localhost:3000
  • Login with user credentials
  • Monitor flood data in real-time
  • Manage relief distribution
  • View analytics and reports

Mobile Application

  • Install on Android/iOS device
  • Login with same credentials
  • Receive push notifications
  • Submit flood reports with photos
  • Track relief distribution

API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/profile - Get user profile

Flood Monitoring

  • GET /api/flood/status - Get all barangay flood status
  • POST /api/flood/sensor-data - Record sensor data
  • POST /api/flood/report - Submit crowd report

Relief Tracking

  • GET /api/relief - Get relief items
  • POST /api/relief - Create relief item
  • PUT /api/relief/:id/distribute - Record distribution

AI Predictions

  • POST /ai/predict - Get flood prediction
  • GET /ai/predict/:barangay - Get barangay prediction

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

πŸ“Š Testing

Backend Tests

cd backend-api
npm test

AI Model Validation

cd ai-prediction
python test_model.py

Smart Contract Tests

cd blockchain-contracts
npx hardhat test

πŸ”’ Security

  • JWT authentication with refresh tokens
  • Input validation and sanitization
  • Rate limiting on API endpoints
  • Secure blockchain transactions
  • Encrypted data storage

πŸ“ˆ Performance

  • Real-time WebSocket connections
  • Database query optimization
  • Caching layer for predictions
  • CDN for static assets
  • Mobile app offline capabilities

πŸ“ž Support

For support and questions:

  • Create an issue in the repository
  • Contact the development team
  • Check the documentation

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Philippine Atmospheric, Geophysical and Astronomical Services Administration (PAGASA)
  • Local Government Units (LGUs)
  • Disaster response organizations
  • Open-source community

Built for SDG 11: Sustainable Cities and Communities

Transforming flood disaster response through technology and transparency.

VibeCodedGuideForCapsMobile-AI-ML-IOT-Block

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages