Skip to content

gesengi/crisismap

Repository files navigation

πŸ—ΊοΈ CrisisMap

Community-powered infrastructure damage reporting for sudden-onset crises.

Live Demo License TRL

Built for the UNDP "Build the Future of Crisis Mapping" Challenge β€” enabling communities to submit geotagged damage reports with on-device AI classification within the critical 48-hour post-crisis window.


🌍 Live Application

https://crisismap-cfa82.web.app

No installation required. Works in any modern browser on any device.

Coordinator login (demo):

Email:    admin@crisismap.org
Password: password123

✨ Key Features

Feature Details
πŸ“Έ 4-step Report Wizard Photo upload β†’ AI classify β†’ structured form β†’ map pin
πŸ€– Edge AI Classification TensorFlow.js COCO-SSD runs on-device, no server required
πŸ—ΊοΈ Building Footprint Geolocation Microsoft ML + OSM footprints for building-level precision
πŸ“Ά Offline-First IndexedDB queue + Service Worker background sync
🌐 6 UN Languages AR (RTL), ZH, EN, FR, RU, ES β€” full layout switching
πŸ”’ Anonymous Reporting No PII ever required or stored
πŸ“Š Coordinator Dashboard Vetting queue, analytics charts, spatial heatmaps
πŸ“¦ GIS Export CSV, GeoJSON, Shapefile, GeoPackage, REST API
πŸ… Gamification Badge rewards on verified submissions (anti-spam design)
πŸ”„ Report Versioning Same-building submissions tracked with full damage history

πŸ—οΈ Tech Stack

Frontend

  • React 19 + Vite 8
  • Leaflet.js + React-Leaflet (interactive maps)
  • TensorFlow.js + COCO-SSD (on-device AI)
  • Progressive Web App (Service Worker + IndexedDB)

Backend

  • Google Cloud Firestore (auto-scaling NoSQL)
  • Firebase Storage (photo hosting)
  • Firebase Auth (anonymous + email/password)
  • Firebase Hosting (global CDN)

Export / GIS

  • GeoJSON, Shapefile (shpjs), GeoPackage, CSV
  • RAPIDA-compatible data schema

πŸš€ Getting Started (Local Development)

Prerequisites

  • Node.js 18+
  • npm 9+
  • A Firebase project (or use Mock Mode without one)

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/crisismap.git
cd crisismap

2. Install dependencies

npm install

3. Configure environment variables

cp .env.example .env

Edit .env with your Firebase project credentials.
Leave it empty to run in Mock Mode (local storage, no Firebase needed).

4. Start development server

npm run dev

Open http://localhost:5173

5. Build for production

npm run build

6. Deploy to Firebase Hosting

npx firebase deploy --only hosting

πŸ“ Project Structure

crisis-map/
β”œβ”€β”€ public/               # Static assets, PWA manifest, service worker
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/       # Reusable UI components (Navbar, Map, Toast...)
β”‚   β”œβ”€β”€ pages/            # Route-level pages (Home, Report, Map, Admin...)
β”‚   β”œβ”€β”€ services/         # Firebase, AI classifier, report service
β”‚   β”œβ”€β”€ utils/            # Constants, translations, mock footprints
β”‚   └── App.jsx           # Root component + routing
β”œβ”€β”€ .env.example          # Environment variable template
β”œβ”€β”€ firestore.rules       # Firestore security rules
β”œβ”€β”€ storage.rules         # Firebase Storage security rules
β”œβ”€β”€ firebase.json         # Firebase hosting config
└── vite.config.js        # Vite build config

🌐 Environment Variables

Copy .env.example to .env and fill in your Firebase config:

VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id

Note: If these are missing, the app runs in Mock Mode using localStorage β€” fully functional for demos without a Firebase account.


πŸ”’ Security

  • Community reporters use anonymous authentication β€” no email, name, or personal data required
  • Coordinates are anonymized to the building footprint centroid β€” individual GPS precision never stored
  • Firestore security rules prevent reporters from reading other reports
  • Only coordinators with verified email credentials can access the vetting dashboard
  • All data transmitted over HTTPS / TLS 1.3

πŸ“Š Data Schema (RAPIDA-Compatible)

Every submitted report stores:

{
  "damageSeverity": "completely_damaged",
  "infrastructureTypes": ["community"],
  "infrastructureName": "St. FranΓ§ois Clinic",
  "crisisTypes": ["earthquake"],
  "debrisRequired": "yes",
  "description": "Free text in any language",
  "lat": -18.7443,
  "lng": -72.3384,
  "footprintId": "way/123456789",
  "createdAt": "2025-01-15T14:23:00Z",
  "aiConfidence": 0.87,
  "status": "verified",
  "buildingVersionHistory": [...]
}

🀝 Contributing

  1. Fork this repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m "feat: add your feature"
  4. Push to the branch: git push origin feature/your-feature
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License β€” see LICENSE for details.

Built for UNDP's humanitarian mission. Free to use, adapt, and deploy for crisis response.


πŸ™ Acknowledgements

About

Community-powered infrastructure damage reporting for sudden-onset crises | UNDP Crisis Mapping Challenge

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors