{"id":26898366,"url":"https://github.com/arshtiwari2004/sahyog","last_synced_at":"2025-05-13T01:49:10.421Z","repository":{"id":283965615,"uuid":"952107294","full_name":"ArshTiwari2004/Sahyog","owner":"ArshTiwari2004","description":"Centralized Disaster Response and Inventory Management System that leverages AI and Google Cloud Technologies to predict disasters, optimize resource management, and provide real-time coordination.","archived":false,"fork":false,"pushed_at":"2025-05-10T12:13:56.000Z","size":14894,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T01:48:56.893Z","etag":null,"topics":["adam-optimizer","apache-kafka","apache-spark","cnn-classification","docker","efficientnetb4","gan-models","gcp-storage","gcs","gemini-api","hyperledger-fabric","keras-classification-models","l2-regularization","lstm-model","numpy","opencv","tensorflow","twilio","vertex-ai","yolov8-detection"],"latest_commit_sha":null,"homepage":"https://sahyog-project.vercel.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArshTiwari2004.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-20T18:38:45.000Z","updated_at":"2025-05-10T12:14:00.000Z","dependencies_parsed_at":"2025-05-10T13:33:14.261Z","dependency_job_id":null,"html_url":"https://github.com/ArshTiwari2004/Sahyog","commit_stats":null,"previous_names":["arshtiwari2004/sahyog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArshTiwari2004%2FSahyog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArshTiwari2004%2FSahyog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArshTiwari2004%2FSahyog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArshTiwari2004%2FSahyog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArshTiwari2004","download_url":"https://codeload.github.com/ArshTiwari2004/Sahyog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253856615,"owners_count":21974576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adam-optimizer","apache-kafka","apache-spark","cnn-classification","docker","efficientnetb4","gan-models","gcp-storage","gcs","gemini-api","hyperledger-fabric","keras-classification-models","l2-regularization","lstm-model","numpy","opencv","tensorflow","twilio","vertex-ai","yolov8-detection"],"created_at":"2025-04-01T05:46:41.205Z","updated_at":"2025-05-13T01:49:10.398Z","avatar_url":"https://github.com/ArshTiwari2004.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sahyog: Centralized Disaster Response and Inventory Management System 🌍\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://sahyog-project.vercel.app/\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Live%20Now-0066FF?style=for-the-badge\u0026logo=vercel\u0026logoColor=white\" alt=\"Live Now\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Status-Deployed-brightgreen\" alt=\"Status\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue\" alt=\"License\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Team-CodeCanvas-orange\" alt=\"Team\"\u003e\n\u003c/p\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n\n[![GitHub Issues](https://img.shields.io/github/issues/ArshTiwari2004/Recap)](https://github.com/ArshTiwari2004/Sahyog/issues)\n[![GitHub Forks](https://img.shields.io/github/forks/ArshTiwari2004/Recap)](https://github.com/ArshTiwari2004/Sahyog/network)\n[![GitHub Stars](https://img.shields.io/github/stars/ArshTiwari2004/Recap)](https://github.com/ArshTiwari2004/Sahyog/stargazers)\n[![Contributors](https://img.shields.io/github/contributors/ArshTiwari2004/Recap)](https://github.com/ArshTiwari2004/Sahyog/graphs/contributors)\n[![License](https://img.shields.io/github/license/ArshTiwari2004/Sahyog)](LICENSE)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/m/ArshTiwari2004/Sahyog)\n![GitHub last commit](https://img.shields.io/github/last-commit/ArshTiwari2004/Sahyog)\n\n\u003c/div\u003e\n\n---\n\n## 📝 Problem Statement\n\nIndia faces significant challenges in disaster management, including:\n- **Delayed Response**: Lack of real-time data to predict and respond to disasters.\n- **Inefficient Resource Allocation**: Mismanagement of relief materials and response teams.\n- **Poor Communication**: Ineffective coordination between authorities, responders, and citizens.\n- **Lack of Predictive Insights**: Absence of AI-powered models to predict disasters and mitigate damage.\n\nIn large-scale disasters like floods, earthquakes, and cyclones, these inefficiencies result in increased casualties, prolonged suffering, and immense economic loss.\n\n---\n\n## 💡 Solution Overview\n\n**Sahyog** is an AI-powered disaster response platform designed to enhance preparedness, efficiency, and coordination in disaster management. It leverages **Google Cloud Technologies** and **AI models** to predict disasters, optimize resource management, and provide real-time coordination.\n\n### Key Features:\n- **Disaster Prediction and Early Warnings** using AI models deployed on Vertex AI.\n- **Incident Reporting and Monitoring** through mobile and web apps using Gemini APIs for image, video, and text analysis.\n- **Resource Inventory Management** with real-time tracking using RFID sensors and transparent logging through Hyperledger Fabric.\n- **Task Allocation and Response Management** using AI algorithms to assign the nearest responders.\n- **Multi-channel Communication** for real-time notifications using Twilio and Firebase Cloud Messaging.\n- **Post-Disaster Analysis** to generate actionable insights for future disaster management.\n\n---\n\n## 🛠️ Tech Stack\n\n### AI and Machine Learning\n| **Technology**       | **Purpose**                                                                 |\n|-----------------------|-----------------------------------------------------------------------------|\n| **Vertex AI**         | Training and deploying AI models (LSTMs, CNNs, GANs) for disaster prediction.|\n| **Gemini APIs**       | Multimodal analysis of images, videos, and text for damage assessment.      |\n| **OpenCV**            | Image processing and damage detection from satellite and drone imagery.     |\n\n### Backend\n| **Technology**       | **Purpose**                                                                 |\n|-----------------------|-----------------------------------------------------------------------------|\n| **Node.js + Express** | Building RESTful APIs for the backend.                                      |\n| **FastAPI**           | Serving AI models and handling AI-related requests.                         |\n| **Apache Kafka**      | Real-time data streaming from satellites, sensors, and drones.             |\n| **Apache Spark**      | Large-scale data processing and post-disaster analysis.                     |\n\n### Frontend\n| **Technology**       | **Purpose**                                                                 |\n|-----------------------|-----------------------------------------------------------------------------|\n| **React.js**          | Building the web dashboard for real-time monitoring and visualization.      |\n| **Flutter**           | Developing the mobile app for citizen reporting and alerts.                 |\n\n### Database\n| **Technology**       | **Purpose**                                                                 |\n|-----------------------|-----------------------------------------------------------------------------|\n| **PostgreSQL**        | Storing structured data like incident reports and resource details.         |\n| **MongoDB**           | Storing unstructured data like images, videos, and sensor logs.             |\n\n### Resource Management\n| **Technology**       | **Purpose**                                                                 |\n|-----------------------|-----------------------------------------------------------------------------|\n| **RFID Sensors**      | Real-time tracking of relief resources like medical kits and food supplies. |\n| **Hyperledger Fabric**| Blockchain-based transparent logging of resource distribution.              |\n\n### Communication\n| **Technology**       | **Purpose**                                                                 |\n|-----------------------|-----------------------------------------------------------------------------|\n| **Twilio**            | Sending SMS and voice alerts to citizens and authorities.                   |\n| **Firebase Cloud Messaging** | Push notifications for real-time updates.                              |\n\n### Visualization\n| **Technology**       | **Purpose**                                                                 |\n|-----------------------|-----------------------------------------------------------------------------|\n| **Google Maps API**   | GIS-based visualizations for disaster-affected areas and resource allocation.|\n| **Google Data Studio**| Generating real-time reports and insights for stakeholders.                 |\n\n### Infrastructure\n| **Technology**       | **Purpose**                                                                 |\n|-----------------------|-----------------------------------------------------------------------------|\n| **Google Cloud Storage (GCS)** | Storing satellite images, sensor data, and AI models.                  |\n| **Docker**            | Containerization of backend and AI services.                               |\n| **Kubernetes**        | Orchestrating containerized applications for scalability.                  |\n| **Terraform**         | Infrastructure as Code (IaC) for managing cloud resources.                 |\n\n---\n\n## 🔄 Workflow\n\n1. **Data Collection**: Real-time data from satellites, sensors, and drones is streamed via **Apache Kafka** and stored in **Google Cloud Storage (GCS)**.\n2. **Disaster Prediction**: **Vertex AI** trains and deploys AI models (LSTMs, CNNs, GANs) for disaster prediction using real-time data.\n3. **Incident Reporting**: Citizens report incidents via a **Flutter app**, and **Gemini APIs** analyze images, text, and voice inputs for severity assessment.\n4. **Decision Making**: AI models process predictions and reports to generate alerts using **Vertex AI** and **Gemini APIs**.\n5. **Alert Generation**: Multilingual alerts are sent via **Twilio** (SMS/calls) and **Firebase Cloud Messaging** (push notifications).\n6. **Resource Management**: Resources are tracked using **RFID sensors**, and **Hyperledger Fabric** ensures transparent distribution.\n7. **Task Allocation**: AI optimizes task assignments using **Dijkstra’s Algorithm** and real-time data from **Google Maps API**.\n8. **Post-Disaster Analysis**: Data is aggregated using **Apache Spark**, and **Vertex AI** generates insights for future preparedness.\n\n\n\n\n## Explaining the ai-service folder in detail \n\nThis AI service powers the core intelligence layer of the Sahyog disaster management system, providing:\n\n- **Real-time disaster prediction** using satellite/drone/sensor data\n- **Multimodal damage assessment** (images, text reports, sensor data)\n- **Optimal resource allocation** during emergencies\n- **Automated reporting \u0026 alerting**\n\n\n\n### 🛠️ Technology Stack\n\n| Component       | Technology                          | Purpose                          |\n|-----------------|-------------------------------------|----------------------------------|\n| Core Framework  | Python 3.9, FastAPI                 | API development                  |\n| AI/ML           | TensorFlow 2.12, Vertex AI          | Model training/deployment        |\n| Multimodal AI   | Gemini API                          | Text/image analysis              |\n| Cloud Services  | GCP (Storage, BigQuery, PubSub)     | Data pipeline                    |\n| Optimization    | OR-Tools                            | Resource allocation              |\n| Containerization| Docker, Gunicorn                    | Production deployment            |\n\n\n### Prerequisites\n- Google Cloud account with:\n  - Vertex AI enabled\n  - Service account with AI Platform Admin role\n- Docker installed\n\n\n### Step-by-Step Setup\n\n1. **Configure Environment Variables**\n```bash\n   # Required Variables\n   export GCP_PROJECT_ID=\"your-project-id\"\n   export GCP_REGION=\"us-central1\"\n   export GEMINI_API_KEY=\"your-api-key\"\n   export GCS_BUCKET=\"your-bucket-name\"\n   \n   # Optional Overrides\n   export DAMAGE_MODEL_ENDPOINT=\"projects/.../locations/.../endpoints/...\"\n   export RESOURCE_MODEL_ENDPOINT=\"projects/.../locations/.../endpoints/...\"\n```\n2.  **Build Docker Image**\n\n```bash\ndocker build -t sahyog-ai-service \\\n  --build-arg GCP_PROJECT_ID=$GCP_PROJECT_ID \\\n  --build-arg GEMINI_API_KEY=$GEMINI_API_KEY \\\n  -f ai-service/Dockerfile .\n```\n\n3.  **Run Container**\n```bash\ndocker run -d \\\n  -p 8000:8000 \\\n  -e GCP_PROJECT_ID=$GCP_PROJECT_ID \\\n  -e GEMINI_API_KEY=$GEMINI_API_KEY \\\n  -e GCS_BUCKET=$GCS_BUCKET \\\n  --name sahyog-ai \\\n  sahyog-ai-service\n```\n\n4. Verify Deployment\n```bash\ncurl http://localhost:8000/\n# Expected: {\"status\":\"healthy\",\"services\":{\"vertex\":true,\"gemini\":true,\"gcp\":true}}\n```\n\n**Ensure you have these enviornment variables**\n\n| Variable                 | Required | Description                                                      |\n|---------------------------|----------|------------------------------------------------------------------|\n| GCP_PROJECT_ID            | Yes      | Your Google Cloud Platform project ID                           |\n| GEMINI_API_KEY            | Yes      | API key for Google Gemini services                              |\n| GCS_BUCKET                | Yes      | Default Google Cloud Storage bucket for disaster data           |\n| GCP_REGION                | No       | GCP region (default: us-central1)                               |\n| DAMAGE_MODEL_ENDPOINT     | No       | Vertex AI endpoint for pre-trained damage assessment model     |\n| RFID_API_ENDPOINT         | No       | URL for RFID inventory tracking system                         |\n| MAX_CONCURRENT_TASKS      | No       | Limits parallel processing (default: CPU cores * 2)            |\n\n\n**Models used with architecture**\n\n### **📊 Complete Model Inventory**\n\n#### **1. Disaster Prediction Models**\n| Model File         | Architecture       | Input Shape      | Output                          | Pretrained Weights |\n|--------------------|--------------------|------------------|---------------------------------|--------------------|\n| `lstm_model.py`    | Stacked LSTM       | (24, 5)          | Binary probability              | No                 |\n| `cnn_model.py`     | EfficientNetB4     | (256, 256, 3)    | 5-class disaster                | ImageNet           |\n| `gan_model.py`     | DCGAN              | (100,) latent dim| (256, 256, 3) synthetic images  | No                 |\n\n#### **2. Damage Assessment Models**\n| Model File            | Architecture | Input Shape      | Output                     | Key Features       |\n|-----------------------|--------------|------------------|----------------------------|--------------------|\n| `image_classifier.py` | EfficientNetB4 | (512, 512, 3)   | 4 damage levels            | Transfer learning  |\n| `object_detector.py`  | YOLOv8x      | (640, 640, 3)    | BBox + 6 classes           | COCO pretrained    |\n\n#### **3. Resource Optimization Models**\n| Model File            | Architecture       | Input Features       | Output                  | Optimization Method |\n|-----------------------|--------------------|-----------------------|-------------------------|---------------------|\n| `predictive_model.py` | Hybrid LSTM-RF     | 7 temporal features  | 5 resource demands      | Adam + Gini impurity|\n| `allocation_model.py` | OR-Tools MIP       | Demand constraints   | Allocation plan         | Linear Programming  |\n\n\n\n\n## **Performace comparision for the models deployed**\n\n| Endpoint                | Avg Latency | Throughput (req/s) |\n|--------------------------|-------------|---------------------|\n| Disaster Prediction      | 320ms       | 45                  |\n| Damage Assessment        | 480ms       | 32                  |\n| Resource Optimization    | 210ms       | 68                  |\n\n*Tested on: n1-standard-4 VM, 100 concurrent requests*\n\n\nNote: This can vary , I have taken avg latency to get this\n\n\n\n\n\n## 🚀 Installation\n\nTo set up the project locally, follow these steps:\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/CodeCanvas/Sahyog.git\n   cd Sahyog\n\n### 2. Install dependencies\n\n### For the backend\n```bash\ncd backend/api\nnpm install\n```\n\n### For the AI service\n```bash\ncd ../ai-service\npip install -r requirements.txt\n```\n\n### For the frontend\n```bash\ncd ../../frontend/web\nnpm install\n```\n\n### 3. Set up environment variables\n```bash\ncp .env.example .env\n```\nCopy .env.example to .env and fill in the required values.\n\n### 4. Run the project\n\n### Start the backend server\n```bash\ncd ../../backend/api\nnpm start\n```\n\n### Start the AI service\n```bash\ncd ../ai-service\nuvicorn main:app --reload\n```\n\n### Start the frontend\n```bash\ncd ../../frontend/web\nnpm start\n```\n\n### Implementing docker for Sahyog\n\n#### To deploy:\n\nBuild the image: \n\n```bash\ndocker build -t sahyog-ai-service \n```\n\nThen run the command:\n\n```bash\ndocker run -p 8000:8000 -e GCP_PROJECT_ID=your-project sahyog-ai-service\n```\n\n## 📂 Project Structure\n\n```bash\nSahyog/\n├── backend/  \n│   ├── api/               # Main API server (Node.js + Express)  \n│   ├── ai-service/        # AI model service (Python + FastAPI)  \n│   ├── data-pipeline/     # Data processing pipeline  \n│   └── blockchain/        # Hyperledger Fabric setup  \n│\n├── frontend/  \n│   ├── web/               # React.js web application  \n│   └── mobile/            # Flutter mobile application  \n│\n├── infrastructure/  \n│   ├── terraform/         # Infrastructure as Code  \n│   ├── docker/            # Docker configurations  \n│   └── kubernetes/        # Kubernetes configs  \n│\n├── docs/                  # Documentation  \n├── scripts/               # Utility scripts  \n├── .env.example           # Example environment variables  \n├── .gitignore             # Git ignore file  \n└── README.md              # Project overview  \n```\n\n\n## 📊 Diagrams\n\n### Process Flow Diagram\n\u003cp align=\"center\"\u003e \u003cimg src=\"https://via.placeholder.com/800x400.png?text=Process+Flow+Diagram\" alt=\"Process Flow Diagram\" width=\"800\"/\u003e \u003c/p\u003e\n\n### Use Case Diagram\n\u003cp align=\"center\"\u003e \u003cimg src=\"https://via.placeholder.com/800x400.png?text=Use+Case+Diagram\" alt=\"Use Case Diagram\" width=\"800\"/\u003e \u003c/p\u003e\n\n### Architeture Diagram\n\u003cp align=\"center\"\u003e \u003cimg src=\"https://via.placeholder.com/800x400.png?text=Architecture+Diagram\" alt=\"Architecture Diagram\" width=\"800\"/\u003e \u003c/p\u003e\n\n\n## 🤝 Contributing\nContributions to project Sahyog are always welcome! Please follow these steps:\n\n1. Fork the repository.\n\n2. Create a new branch (git checkout -b feature/YourFeatureName).\n\n3. Commit your changes (git commit -m 'Add some feature').\n\n4. Push to the branch (git push origin feature/YourFeatureName).\n\n5. Open a pull request.\n\n\n### 📄 License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farshtiwari2004%2Fsahyog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farshtiwari2004%2Fsahyog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farshtiwari2004%2Fsahyog/lists"}