Skip to content

Shogun05/ReadyIndiaAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ReadyIndia AI - Multilingual Disaster Alert System

A production-ready full-stack AI-powered disaster alert assistant that provides real-time disaster alerts in 8 Indian languages with AI simplification and safety instructions.

πŸš€ Features

Core Features

  • Real-time Disaster Alerts: Fetches live data from USGS (Earthquakes), GDACS (Global Disasters), and INCOIS (Tsunami warnings)
  • AI-Powered Simplification: Uses Google Gemini AI to convert complex technical alerts into simple, actionable language
  • Multilingual Support: Available in 8 languages - English, Hindi, Marathi, Tamil, Telugu, Kannada, Bengali, Gujarati
  • Geolocation-Based Alerts: Shows disasters near user's location
  • Safety Instructions: AI-generated step-by-step safety guidance for each disaster type
  • PWA Support: Works offline with service worker caching
  • Interactive Map: Visual representation of disaster locations using Leaflet

Technical Features

  • Scheduled Data Fetching: Automatic alert fetching every 30 minutes using APScheduler
  • MongoDB Storage: Persistent storage of alerts with full translations
  • Responsive Design: Mobile-first design with Tailwind CSS + ShadCN UI
  • Type Safety: Pydantic models for backend validation
  • i18n Integration: react-i18next for seamless language switching

πŸ“ Project Structure

ReadyIndia AI/
β”œβ”€β”€ backend/                    # Node.js/Express Backend
β”‚   β”œβ”€β”€ models/                # Data models
β”‚   β”‚   β”œβ”€β”€ alert.js          # Alert model with disaster types
β”‚   β”‚   β”œβ”€β”€ index.js          # Model exports
β”‚   β”‚   └── safety_step.js    # Safety steps model
β”‚   β”œβ”€β”€ routers/              # API route handlers
β”‚   β”‚   β”œβ”€β”€ alerts.js         # Alert CRUD operations
β”‚   β”‚   β”œβ”€β”€ ai.js             # AI simplification endpoints
β”‚   β”‚   β”œβ”€β”€ languages.js      # Language support
β”‚   β”‚   └── index.js          # Router exports
β”‚   β”œβ”€β”€ services/             # Business logic
β”‚   β”‚   β”œβ”€β”€ alert_fetcher.js  # External API fetching
β”‚   β”‚   β”œβ”€β”€ gemini_client.js  # Gemini AI integration
β”‚   β”‚   β”œβ”€β”€ index.js          # Service exports
β”‚   β”‚   β”œβ”€β”€ logger.js         # Logging utility
β”‚   β”‚   └── translation_service.js # Translation handling
β”‚   β”œβ”€β”€ logs/                 # Application logs
β”‚   β”œβ”€β”€ package.json          # Node dependencies
β”‚   β”œβ”€β”€ server.js             # Express/Node application
β”‚   └── requirements.txt      # (Legacy) Python dependencies reference
β”‚
β”œβ”€β”€ frontend/                  # React Frontend
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   β”œβ”€β”€ index.html        # HTML entry point
β”‚   β”‚   β”œβ”€β”€ manifest.json     # PWA manifest
β”‚   β”‚   └── service-worker.js # Offline caching
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/       # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ AlertCard.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Footer.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ LanguageSwitcher.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MapComponent.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
β”‚   β”‚   β”‚   └── ui/           # ShadCN UI components
β”‚   β”‚   β”œβ”€β”€ hooks/            # Custom React hooks
β”‚   β”‚   β”‚   └── use-toast.js
β”‚   β”‚   β”œβ”€β”€ lib/              # Utility functions
β”‚   β”‚   β”‚   └── utils.js
β”‚   β”‚   β”œβ”€β”€ pages/            # Route pages
β”‚   β”‚   β”‚   β”œβ”€β”€ AlertDetail.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Alerts.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Explain.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”‚   └── Settings.jsx
β”‚   β”‚   β”œβ”€β”€ i18n/             # i18n translation files
β”‚   β”‚   β”‚   β”œβ”€β”€ en.json
β”‚   β”‚   β”‚   └── hi.json
β”‚   β”‚   β”œβ”€β”€ i18n.js           # i18next configuration
β”‚   β”‚   β”œβ”€β”€ App.css           # Global styles
β”‚   β”‚   β”œβ”€β”€ App.js            # Main application
β”‚   β”‚   β”œβ”€β”€ index.css         # Root styles
β”‚   β”‚   └── index.js          # React entry point
β”‚   β”œβ”€β”€ lingo/                # Lingo.dev translations (auto-generated)
β”‚   β”‚   β”œβ”€β”€ en.json
β”‚   β”‚   β”œβ”€β”€ hi.json
β”‚   β”‚   └── .versions
β”‚   β”œβ”€β”€ plugins/              # Custom webpack plugins
β”‚   β”‚   β”œβ”€β”€ health-check/     # Health check plugin
β”‚   β”‚   └── visual-edits/     # Visual edits plugin
β”‚   β”œβ”€β”€ craco.config.js       # Create React App config
β”‚   β”œβ”€β”€ lingo.config.js       # Lingo.dev configuration
β”‚   β”œβ”€β”€ tailwind.config.js    # TailwindCSS config
β”‚   β”œβ”€β”€ postcss.config.js     # PostCSS config
β”‚   β”œβ”€β”€ jsconfig.json         # JavaScript config
β”‚   β”œβ”€β”€ components.json       # Component registry
β”‚   β”œβ”€β”€ package.json          # Node dependencies
β”‚   β”œβ”€β”€ .env                  # Environment variables
β”‚   β”œβ”€β”€ .env.local            # Local overrides (git ignored)
β”‚   └── README.md             # Frontend documentation
β”‚
β”œβ”€β”€ tests/                    # Testing directory
β”‚   └── __init__.py          # Test initialization
β”‚
β”œβ”€β”€ lingo.config.js          # Root Lingo.dev configuration
β”œβ”€β”€ README.md                 # Project documentation
β”œβ”€β”€ package.json              # Root package (if monorepo)
└── .gitignore                # Git ignore rules

πŸ› οΈ Tech Stack

Backend

  • Node.js 22: JavaScript runtime
  • Express.js: Fast, minimal web framework
  • MongoDB: NoSQL database
  • Google Gemini AI: Text simplification and translation
  • APScheduler: Scheduled task execution (Node version)
  • Axios: HTTP client for API calls
  • Dotenv: Environment variable management

Frontend

  • React 19: UI library with hooks
  • React Router: Client-side routing
  • TailwindCSS: Utility-first CSS framework
  • ShadCN UI: Beautiful component library
  • Lingo.dev: AI-powered automatic multilingual translation
  • Leaflet: Interactive maps
  • Axios: HTTP client
  • Sonner: Toast notifications

πŸ“‘ API Endpoints

Alerts

  • GET /api/alerts - Get all alerts (with filters)
  • GET /api/alerts/{id} - Get specific alert
  • GET /api/alerts/nearby - Get alerts near location
  • POST /api/alerts - Create new alert

AI

  • POST /api/ai/simplify - Simplify disaster alert text

Languages

  • GET /api/languages/{lang} - Get translations for language
  • GET /api/languages - Get all supported languages

🌐 Data Sources

  1. USGS Earthquake Feed

    • Real-time earthquake data
    • Global coverage
    • Magnitude, location, time information
  2. GDACS (Global Disaster Alert and Coordination System)

    • Multiple disaster types (floods, cyclones, earthquakes)
    • RSS feed format
    • Global disaster monitoring
  3. INCOIS (Indian National Centre for Ocean Information Services)

    • Tsunami warnings
    • Seismic activity data
    • Indian Ocean region focus

πŸš€ Deployment

The application is designed for deployment on your preferred platform.

Services

Both frontend and backend can be deployed as services:

  • Backend: FastAPI on port 5000 (or configurable)
  • Frontend: React on port 3000 (or configurable)

Environment Variables

Backend (.env):

MONGO_URL=mongodb://localhost:27017
DB_NAME=readyindia_db
CORS_ORIGINS=*
GEMINI_API_KEY=<your-gemini-api-key>
USGS_API_URL=https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson
INCOIS_API_URL=https://www.incois.gov.in/geoportal/webservices/seismology/seismology.json
GDACS_API_URL=https://www.gdacs.org/xml/rss.xml

Frontend (.env):

REACT_APP_BACKEND_URL=http://localhost:5000
GOOGLE_API_KEY=<your-google-api-key>

πŸ’‘ Key Features Implementation

1. AI Simplification

# Gemini AI converts complex alerts to simple language
result = await gemini_client.simplify_alert(alert_text)
# Returns: { "simple": "...", "steps": [...] }

2. Multilingual Translation

# Automatic translation to 7 Indian languages
translations = await translation_service.translate_to_all_languages(text)
# Returns: { "hi": "...", "mr": "...", "ta": "...", ... }

3. Scheduled Data Fetching

# Runs every 30 minutes
scheduler.add_job(fetch_and_process_alerts, 'interval', minutes=30)

4. PWA Support

  • Service worker caches static assets
  • Offline fallback page
  • Installable on mobile devices
  • Manifest.json for app metadata

5. Geolocation Alerts

// Get alerts within radius
GET /api/alerts/nearby?lat=20.5937&lon=78.9629&radius_km=500

🎨 Design System

Color Palette

  • Primary: Orange (#ea580c) - Urgency and safety
  • Secondary: Red (#dc2626) - Critical alerts
  • Success: Green (#16a34a) - Safety instructions
  • Neutral: Gray shades for text and backgrounds

Typography

  • Headings: Playfair Display (serif) - Elegance and authority
  • Body: Inter (sans-serif) - Readability and modernity

Components

  • Built with ShadCN UI for consistency
  • Fully accessible with ARIA labels
  • Responsive breakpoints (mobile, tablet, desktop)

πŸ“± Pages Overview

1. Home (/)

  • Hero section with tagline
  • Feature cards
  • Call-to-action buttons

2. Alerts (/alerts)

  • Interactive map with markers
  • Filter by disaster type and severity
  • Nearby alerts based on geolocation
  • Grid of alert cards

3. Alert Detail (/alerts/:id)

  • Full alert information
  • AI-simplified summary
  • Step-by-step safety instructions
  • Location map

4. Explain Alert (/explain)

  • Text input for custom alerts
  • AI simplification
  • Multi-language tabs
  • Safety steps generation

5. Settings (/settings)

  • Language selection
  • Location preferences
  • Notification settings (planned)
  • About information

πŸ”’ Security & Performance

Security

  • Environment variables for sensitive data
  • CORS configuration
  • Input validation with Pydantic
  • No hardcoded credentials

Performance

  • Async/await throughout backend
  • MongoDB indexing on query fields
  • Caching of translations
  • Lazy loading of map components
  • Optimized images and assets

πŸ§ͺ Testing Strategy

Backend Testing

  • Unit tests for models and services
  • Integration tests for API endpoints
  • Mock external API calls
  • Test data validation

Frontend Testing

  • Component testing with data-testid attributes
  • E2E testing with Playwright
  • Responsive design testing
  • Accessibility testing

πŸ“Š Database Schema

Alerts Collection

{
  id: string,
  type: "earthquake" | "flood" | "cyclone" | ...,
  severity: "low" | "medium" | "high" | "critical",
  raw_text: string,
  ai_summary: string,
  ai_steps: string[],
  languages: {
    hi: { simple: string, steps: string[] },
    mr: { ... },
    // ... other languages
  },
  location: string,
  latitude: float,
  longitude: float,
  magnitude: float (optional),
  source: "USGS" | "GDACS" | "INCOIS",
  created_at: datetime
}

🌟 Future Enhancements

  1. Push Notifications: Real-time browser notifications for critical alerts
  2. User Accounts: Personalized alert preferences
  3. Alert History: Track past disasters and responses
  4. Community Reports: User-submitted disaster reports
  5. SMS Integration: Send alerts via SMS for offline users
  6. Voice Alerts: Audio announcements in regional languages
  7. Evacuation Routes: AI-suggested safe routes
  8. Emergency Contacts: Quick access to helpline numbers

πŸ“ License

This project is built as a demonstration of full-stack development capabilities and disaster management solutions.

πŸ™ Acknowledgments

  • USGS for earthquake data
  • GDACS for global disaster alerts
  • INCOIS for tsunami warnings
  • Google Gemini for AI capabilities
  • Lingo.dev for automatic multilingual translation

Built with ❀️ for India's safety and preparedness

About

Ready India AI uses lingo.dev to build a real time disaster notification platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •