Skip to content

bhavanaharshan/DEVTrails

Repository files navigation


BCR IRDAI DPDP Act Zero Trust Docker UPI

Worker Dashboard Admin Dashboard

Why Jugaad?

Bharat Harshan - a 28 year old Zomato rider from Kurla, Mumbai.
It's Tuesday, 6 PM. Peak delivery hour. Then the monsoon hits. In 20 minutes, orders in his zone crash by 70%. Customers pay surge pricing. The platform keeps earning. Ravi ends the night with barely ₹90.

He didn’t fail to work. The weather failed him. That’s why Jugaad exists.

Rainfall crosses 25 mm/hr. The trigger fires. GPS verifies his zone. ₹680 lands in his UPI. No forms. No claims. No waiting.

Because insurance shouldn’t begin after the crisis. It should respond the moment the crisis starts.



Table of Contents

🌧️ What is Jugaad?

Jugaad is a fully automated parametric income insurance platform for India's 5–8 million food delivery workers.

When weather stops deliveries, their income shouldn't stop too.

Traditional insurance requires filing claims, waiting weeks, proving loss. Jugaad doesn't. An objective weather threshold is crossed → GPS verifies the rider is in the affected zone → ₹ lands in their UPI wallet. Under 2 hours. Zero paperwork. Zero human intervention.

External disruption fires  →  GPS verified in real-time  →  ₹ transferred via UPI in < 2 hrs
         (objective API)          (zero-trust engine)           (Razorpay sandbox)

Parametric insurance pays on a measurable event — not on proving loss. No forms. No agents. No waiting. The algorithm pays — instantly, fairly, automatically.

Why food delivery workers?

Pain Point The Reality
💸 Fixed costs never pause Bike EMI ₹2,800–3,200/month + fuel ₹180–220/day — due whether they work or not
🎯 The incentive trap One 2-hr rain event → miss weekly slab → lose ₹800 bonus on top of lost orders
⚠️ No safety net 90% have zero savings buffer; 68% spend more than they earn
🌧️ Platforms profit, riders don't Zomato charges 40% surge in rain — riders receive ₹0 extra

⛈️ The 7 Scenarios We Cover

Every trigger uses objective, third-party, government-verified data. No forms. No calls.

# Scenario Trigger Payout Data Source
🌡️ 1 Extreme Heat IMD Red Alert + heat index ≥44°C for 2+ hrs 70% avg daily earnings IMD + Open-Meteo
🌧️ 2 Heavy Rain & Flooding Rainfall ≥25mm/hr for 90+ min in rider's zone 70% shift earnings + Slab Shield IMD + Open-Meteo
🌫️ 3 Dense Winter Fog IMD Dense Fog advisory + visibility <100m for 3+ hrs Half-shift income (7–11 PM) IMD Fog Bulletins
😷 4 Severe AQI Pollution CPCB AQI ≥400 for 3+ consecutive hours Health Safety Supplement CPCB API (free, hourly)
🚫 5 Bandh / Curfew NewsAPI 3+ sources confirmed + zone orders drop ≥65% Full declared shift income GNews API + platform mock
🚧 6 Metro / Congestion Avg travel time >200% of historical mean Per-hour Congestion Supplement OSRM (open-source)
💀 7 Platform App Outage Downdetector 500+ reports + outage >45 min peak hours Hourly rate × outage duration Downdetector (independent)

The Jugaad Principle: Every payout is triggered by objective, third-party, government-verified or publicly monitored data. The worker never has to prove anything. The insurer never has to investigate anything. The algorithm pays — instantly, fairly, automatically.


⚖️ Coverage Scope & The Golden Rules

  • Income Loss Protection Only: This platform is strictly designed as a safety net for lost hours and unearned wages due to external events.
  • 🚫 Exclusions: We strictly exclude any coverage for health issues, life insurance, accidents, or vehicle repairs.

🏗️ System Architecture


image

🔗 Core Backend APIs

Endpoint Purpose
/api/users/active Returns live active workers with location
/api/claims/trigger Receives validated triggers and records payouts
/api/admin/metrics Dashboard stats + fraud queue

Claim Trigger Webhook

POST /api/claims/trigger
Content-Type: application/json

{
  "user_id": "worker_123",
  "scenario": "heavy_rain",
  "confidence": 0.91,
  "payout": 680
}

🌍 Geospatial Query Engine (PostGIS)

To enable precise, ward-level trigger validation, we implemented native spatial queries using PostGIS.

-- Convert raw coordinates into geographic points
SELECT ST_SetSRID(ST_MakePoint(longitude, latitude), 4326);

-- Find workers within 500m of trigger zone
SELECT *
FROM workers
WHERE ST_DWithin(
    location,
    ST_SetSRID(ST_MakePoint(:lon, :lat), 4326),
    500
);

Trigger → Payout flow (60 seconds to 2 hours)


image

🤖 ML & AI Engine

Jugaad's intelligence layer does three things: price risk fairly each week, predict disruptions before they hit, and validate every trigger before a payout fires.

Every data source used is free, open, or government-published — zero paid API dependency.

The six models

┌─────────────────────────────────────────────────────────────────────────────┐
│                        ML PIPELINE (runs every Sunday)                      │
│                                                                             │
│  1. Earnings DNA Profiler   →  Gradient Boosted Regressor                  │
│     Personalised income fingerprint per rider at onboarding                │
│     Powers Slab Shield: predicts if disruption kills weekly bonus          │
│                                                                             │
│  2. Dynamic Premium Engine  →  XGBoost                                     │
│     11 risk factors → weekly risk score (0–1) → premium ₹29–₹99           │
│     Runs Sunday midnight · Premium confirmed in DB by 6 AM                 │
│                                                                             │
│  3. Risk Zone Classifier    →  Random Forest                               │
│     Labels every delivery zone: LOW / MEDIUM / HIGH per scenario           │
│     Kurla ≠ Powai — same city, different zone, different premium           │
│                                                                             │
│  4. Disruption Predictor    →  Prophet                                     │
│     Forecasts P(trigger) per scenario per zone for next 7 days             │
│     P > 0.40 → seasonal multiplier rises + Sunday rider alert fires        │
│                                                                             │
│  5. Claim Trigger Validator →  Rule engine + ML hybrid                     │
│     Hard threshold check → dual-source confirm → confidence score          │
│     ≥ 0.85 → auto-pay · < 0.85 → human review queue                       │
│                                                                             │
│  6. Continuous Learning     →  Weekly retraining loop                      │
│     Actual loss / Expected loss → nudges all models ±15% per week          │
│     Basis risk shrinks every monsoon, every fog winter, every heatwave     │
└─────────────────────────────────────────────────────────────────────────────┘

BCR simulation — financial proof

14-day monsoon stress test
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Premium inflow     →  tracked daily across simulated user pool
Payout outflow     →  weather-driven triggers, zone-by-zone
Fraud losses       →  ML-flagged + blocked by kinematic engine

Calibrated BCR  =  0.67
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Sustainable band: 0.6 – 0.7
✓ Pool remains solvent under 14-day continuous extreme stress
✓ Not exploitative (< 0.8), not loss-making (> 0.5)
image
image

🛡️ Zero-Trust Security & Anti-Spoofing

"GPS alone is dead. We require five independent signal layers — all of which must agree before a rupee leaves the pool."

The hardware handshake

Every session: live HTML5 device coordinates are sent — not stored, not cached, not user-typed. Declared city is geocoded via Nominatim. Distance delta triggers lockout if violated.

User types "Bangalore" at onboarding
              ↓
Nominatim geocodes → 12.97°N, 77.59°E
              ↓
Device GPS reads → 8.52°N, 76.93°E   ← actual location: Trivandrum
              ↓
Distance delta: 743 km
              ↓
🔴 KINEMATIC VIOLATION — Security Lockout fires on dashboard entry

This is live and demoed. Type Bangalore. Be in Trivandrum. Watch the red screen fire.

Four defense layers

Layer 1 — Device Trust
  Mock-location flags · rooted/tampered device detection · Android Play Integrity
  If the device environment is compromised → GPS output rejected outright

Layer 2 — Mobility Authenticity
  Last 15–30 min GPS telemetry analyzed · teleport jumps flagged
  Route matched against real road network via OSRM
  Accelerometer/gyroscope used as soft motion corroboration

Layer 3 — Operational Eligibility
  Active delivery session required · recent order acceptance checked
  Last trusted platform event timestamp + location verified
  Worker at home with no active trip → does not qualify, regardless of GPS

Layer 4 — Ring Detection (Sybil Defense)
  500 workers becoming eligible in same short window → automatic flag
  Shared device fingerprints + shared UPI accounts → graph detection
  Synchronized teleport-into-zone patterns → cluster quarantine
  If real flood: real cancellation spike, real merchant impact exist.
  A syndicate has none of these. That absence is the signal.

Three-tier payout response

Tier Condition Action Worker sees
✅ Auto Approve All signals consistent. Device clean. Route plausible. Active trip confirmed. Payout fires < 2 min "₹680 credited. Stay safe."
⏳ Soft Hold Weak GPS in heavy rain, brief network drop, delayed sync Wait 10–15 min for signals to stabilize "Payout being verified. Usually resolves in 15 min."
🔴 Quarantine Low device trust + impossible route + no active trip + ring-risk Held → human review "Under quick review. We'll update you shortly."

The Soft Hold tier exists because honest workers in heavy rain will have degraded signals. Missing data ≠ fraud. Only contradictory evidence escalates.


image

⚙️ Fault Tolerance & Reliability

To ensure uninterrupted service during external API failures:

🧠 Safe Fallback Mechanism

  • If Open-Meteo / CPCB APIs fail: → Use last known valid data snapshot (cached in Redis)

  • If API latency exceeds threshold: → Trigger retry with exponential backoff

  • If all sources fail: → System enters grace mode → Critical payouts (SOS / high confidence cases) still processed

if (!weatherAPI.available()) {
    data = cache.get("last_valid_weather");
}

💰 Premium & Payout Model

A risk-adjusted, income-based micro-insurance framework. Premiums computed every Sunday, debited every Monday at 9 AM via UPI auto-mandate.

How premium is calculated

Step 1 — Base Premium
  Base = Weekly Income × Base Rate (1.5% – 2%)
  ML cross-checks declared income against zone average to prevent fraud at source

Step 2 — Risk Multipliers
  Adjusted = Base × City Risk (0.85–1.40×)
                  × Shift Factor (0.85–1.20×)
                  × Platform Factor (1.00–1.10×)
                  × Zone Factor (0.80–1.30×)

Step 3 — Affordability Cap
  Final = min(max(Adjusted, ₹29), ₹99)
  Hard floor ₹29 — always affordable even for part-time workers
  Hard ceiling ₹99 — never more than ~2.5% of full-time weekly income

Coverage tiers

Tier Weekly Premium Coverage Triggers Max Weekly Payout
🟡 Basic ₹29 – ₹49 60% daily income Any 3 of 7 ~₹720
🔵 Standard ✦ ₹49 – ₹79 70% daily income All 7 + Slab Shield ~₹1,400
🔴 Full Shield ₹79 – ₹99 80% daily income All 7 + Platform Bridge ~₹2,400

Dynamic weekly recalibration

New Premium = Old Premium × (Actual Loss / Expected Loss)
Change capped at ±15% per week — no premium shock

A dry November week costs less.
A monsoon July week costs more.
Workers see exactly why, every Sunday morning.

✅ IRDAI Compliance Checklist

# Requirement Status Implementation
1 Trigger objective & verifiable AQI >300 / rain ≥25mm/hr from CPCB + IMD — quantifiable, public, tamper-proof
2 Health, life & vehicle excluded Legal disclaimer hardcoded in UI: "Covers income loss from weather only"
3 Payout automatic Trigger → GPS verify → UPI transfer within 2 hours via cron
4 Pool financially sustainable BCR 0.67 — 14-day monsoon stress-tested, PDF artifact in /ml/reports/
5 Fraud detection on data, not behaviour GPS × login cross-check, kinematic ML, Sybil ring detection
6 Premium collection frictionless ₹29–₹99/week via UPI auto-mandate — zero manual steps
7 Dynamic pricing, not flat XGBoost: HIGH risk → +10% premium, LOW risk → discount, seasonal + zone adjustments
8 Adverse selection blocked 48-hour enrollment lockout before weather red alerts (FastAPI hard block)
9 Operational cost near zero Fully containerised straight-through processing, zero human in claims loop
10 Basis risk minimized Ward-level GPS mapping via Nominatim — not broad 15km city radius

🏛️ Legal & Regulatory Compliance

Social Security Code, 2020

The SS Code formally recognises gig workers as eligible for welfare benefits for the first time in India.

GigShield implements the 90/120-day engagement rule in backend math, not just UI:

Single platform worker  →  90 active days in FY  →  state-backed social security unlocked
Multi-apping worker     →  120 active days in FY →  state-backed social security unlocked

Progress bar in-app switches targets automatically based on platform sync data.

DPDP Act, 2023 — consent flow

Three data types collected. Each with an explicit, un-pre-checked consent box:

Data Purpose Consent Requirement Built?
📍 Continuous GPS Verify worker is in trigger zone Separate consent screen
🏦 Bank / UPI account Payout disbursement Explicit consent + KYC mention
📱 Platform activity Confirm active delivery days Data sharing agreement

image

📱 Offline Resilience — The SOS Protocol

Storms kill internet. Workers can't lose coverage when the network drops.

Worker loses internet during storm
              ↓
App detects network loss instantly
              ↓
Red fallback banner appears on screen
              ↓
SMS auto-populated with exact GPS coordinates
              ↓
POST /api/webhook/sms-sos (Twilio-compatible endpoint)
              ↓
Emergency ₹500 claim processed
Bypasses 2-minute cron timer entirely

No internet. Still covered. No action needed from the worker.


🖥️ Tech Stack

Frontend

Technology Purpose
React.js + Vite Component-based PWA with fast builds
Tailwind CSS Responsive, mobile-first styling
Framer Motion Smooth UI transitions and animations
Firebase Auth (Phone OTP) Secure, frictionless onboarding
Socket.io client Real-time payout notifications

Backend & API Layer

Technology Purpose
Node.js + Express Core API orchestration + policy CRUD
Socket.io Real-time frontend push (payout alerts)
node-cron Automated trigger engine (every 2 min)
FastAPI (Python) ML model serving + inference endpoints
JWT Secure session handling

ML / AI Engine

Model Purpose
XGBoost Dynamic premium calculation (11 risk factors)
Prophet Disruption probability forecasting (7-day)
Isolation Forest Anomaly + fraud detection
LightGBM Fraud scoring (tabular, handles missing data)
scikit-learn Pipelines + feature engineering
MLflow Experiment tracking + model versioning

Data Sources (all free / open / government-published)

Source Data
Open-Meteo Rain, heat index, fog, wind
CPCB / OpenAQ AQI (hourly, city-specific)
IMD Red alerts, fog bulletins, rainfall bulletins
GNews API Bandh / curfew keyword detection
OSRM Open-source travel time routing
Downdetector Platform outage signals (independent)
Nominatim Geocoding for ward-level location mapping

Infrastructure

Tool Purpose
PostgreSQL + PostGIS Structured storage with geographic coordinate support
Redis Real-time trigger caching + fast lookups
Docker + Docker Compose Full multi-container orchestration
GitHub Actions CI/CD pipeline
Razorpay Sandbox Instant payout simulation
Twilio SMS SOS webhook

Deployed App:

Worker Dashboard: https://jugaad-frontend-git-main-bhavanaharshans-projects.vercel.app/
Admin Dashboard (Password: admin123): https://devtrails-1-40gq.onrender.com/

🚀 Running Locally

Prerequisites

  • Docker + Docker Compose installed
  • Node.js 18+
  • Python 3.10+
  • Git

One-command setup

# 1. Clone the repository
git clone https://github.com/bhavanaharshan/DEVTrails.git
cd gigshield

# 2. Copy environment config
cp .env.example .env

# 3. Boot the entire stack
docker-compose up --build

👥 Meet the team

Member Domain Key Contributions
Priya ML / Data Science BCR simulation, XGBoost pricing engine, kinematic fraud model, monsoon stress test, adverse selection lockout API
Samridhi Geo / Backend Orchestration Ward-level GPS mapping, Nominatim integration, trigger cron orchestrator, fraud routing pipeline
Neema Backend / Infrastructure Express API, PostGIS migrations, Docker Compose, UPI auto-deduction architecture, admin hub
Bhavana Frontend / Compliance DPDP consent flow, kinematic lockout UI, real-time dashboard, offline SOS, WebSocket notifications

📦 Phase 3 Submission Checklist

Deliverable Status
✅ 5-minute demo video Watch here
✅ Pitch deck (PDF) [Click here]
✅ Source code (default branch) This repository
✅ Docker Compose (local setup) docker-compose up --build

Built with ❤️ for India's 8 crore invisible workers

"He kept riding next week. His family is okay. That's what insurance is really for."

DEVTrails 2026

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors