DEV Community

 Ayush Kumar
Ayush Kumar

Posted on

Kavach: Building a Real-Time Parametric Insurance System for the Gig Economy

Why We Built This

Gig workers operate in one of the most unpredictable environments. A delivery rider facing a 48°C heatwave or sudden flooding doesn’t just have a “bad day”—they lose their entire day’s income.

Existing insurance systems don’t address this problem well:

Claims take days or weeks
Policies are expensive and rigid
Micro-duration risks (like a single day of extreme weather) are ignored

We wanted to design something fundamentally different:
a real-time, automated, low-cost insurance system that reacts instantly to environmental risk.

That’s how Kavach was born.

*What is Kavach?
*

Kavach is a parametric insurance platform designed specifically for gig workers.

Instead of manual claims, payouts are triggered automatically when predefined conditions are met.

Key Design Goals

  • Low cost: Affordable daily subscription model
  • Instant payouts: No claim filing or manual approval
  • Fraud-resistant: Hardware-backed verification
  • Scalable: Built on a modular MERN + AI architecture

System Overview

At a high level, Kavach works through three tightly coupled layers:

Weather Data → Risk Model → Fraud Detection → Payout Engine

+-------------------+ +---------------------+
| Weather API | -----> | Climate Oracle AI |
| (Temperature, etc)| | (Random Forest) |
+-------------------+ +----------+----------+
|
v
+--------+--------+
| GDI Calculator |
+--------+--------+
|
GDI > 0.85 → | Trigger
v
+-------------------+ +---------------------+
| Mobile Sensors | -----> | Sentry-AI |
| (Motion, Temp) | | (Fraud Detection) |
+-------------------+ +----------+----------+
|
v
+--------+--------+
| Risk Controller |
| (Node.js Backend)|
+--------+--------+
|
v
+--------+--------+
| Payout Engine |
| (UPI / Wallet) |
+------------------+

We call this the “Sword & Shield” architecture:

  • Sword: Detects real-world risk
  • Shield: Verifies the authenticity of the claim

    ⚔️ Sword (Risk Detection)
    

    Weather Data → AI Model → GDI Score
    |
    v
    Is Risk High?

                     ↓ YES
    
    🛡️ Shield (Fraud Detection)
    

    Sensor Data → Motion Check
    → Thermal Check
    → EV Filter
    |
    v
    Is User Legit?

                     ↓ YES
    
    💸 Payout Triggered Instantly
    

Layer 1: Climate Oracle (Risk Detection Engine)

We built a Random Forest model that processes real-time weather data from external APIs.

  • Inputs
  • Temperature
  • Humidity
  • Wind speed
  • Output

A computed score called the Gig Disruption Index (GDI).

GDI > 0.85 → Red Alert
Automatically flags a high-risk event
Why Random Forest?
Handles nonlinear relationships well
Robust against noisy environmental data
Works efficiently with tabular inputs

This layer answers:
👉 “Is the environment actually dangerous enough to disrupt work?”

Layer 2: Sentry-AI (Fraud Detection via Sensor Fusion)

Parametric systems are vulnerable to exploitation if not validated.
We addressed this with a sensor-driven verification layer.

Core Idea

Don’t just trust external data—verify the user’s physical context.

Signals Used

  • Accelerometer (Kinetic Jitter)
  • Detects motion patterns consistent with riding
  • Filters out idle or stationary devices
  • Battery Temperature (Thermal Correlation)
  • Compared with external temperature
  • Detects “indoor spoofing” (e.g., AC room fraud)
  • Edge Case Handling
  • EV-specific logic to avoid false positives from charging heat
  • Outcome
    Only users who are:

  • Actually active

  • Physically exposed to conditions

…are eligible for payouts.

Layer 3: Risk Controller (Liquidity & Payout Engine)

The backend ensures the system remains financially stable while delivering instant payouts.

  • Responsibilities
  • Monitor liquidity pool in real time
  • Prioritize high-risk users during peak events
  • Prevent over-disbursement
  • Implementation
  • Built into a Node.js + Express service layer
  • Uses MongoDB for:
  • User risk profiles
  • Subscription tracking
  • Transaction logs Tech Stack Breakdown
Layer Technology
Frontend React.js (Web Sensor APIs)
Backend Node.js + Express
Database MongoDB
AI Engine Python (Scikit-learn, .joblib)

Why This Stack?
MERN enables rapid prototyping and scalability
Python integrates seamlessly for ML inference
Web APIs allow direct hardware signal capture

Phase 1: What We Achieved
Built a working end-to-end MERN prototype
Implemented real-time sensor data ingestion
Integrated dual AI layers (risk + fraud detection)
Validated system behavior against spoofing scenarios

Key Engineering Challenges
1. Bridging Web Apps with Hardware Signals

Accessing reliable sensor data in a browser environment required careful handling of:

  • Permissions
  • Data sampling rates
  • Noise filtering

2. Synchronizing AI Pipelines

We needed a clean handshake between:

  • Weather-based risk scoring
  • Sensor-based validation Ensuring both layers agreed before triggering payouts was critical.

3. Designing for Real-Time Decisions

The system had to:

  • Process inputs quickly
  • Avoid false positives
  • Trigger payouts without delay

What’s Next (Phase 2)

We’re moving toward a mobile-first architecture.

Planned Improvements

  • Native mobile app for better sensor fidelity
  • Background telemetry collection
  • One-tap UPI payouts (<60 seconds target)

This will significantly improve reliability and user experience.

Final Thoughts

Kavach is an attempt to rethink insurance from the ground up.
By combining:

  • Real-time environmental data
  • On-device sensor validation
  • Automated payouts

…we’re building a system that aligns with how gig workers actually live and work.

The goal isn’t just innovation—it’s impact.

Top comments (0)