WaveSafe

Platform for Smarter Coastal Travel and Safety

Repo
WaveSafe banner

About

## The problem it solves

# 🌊 Wave-Safe

> **A Unified Platform for Smarter Coastal Travel and Safety**

Wave-Safe is a unified web-based coastal safety and intelligence platform that combines real-time ocean and weather intelligence, trip planning, emergency coordination, and rescue tracking into one coastal travel experience.

## πŸ‘₯ Team

**Team Name:** LazyCoders

- **Arvind Kumar** β€” Team Leader

- **Om Kushwaha** - **Rishabh Pal**

---

## 🚨 Problem Statement

India has over **7,500 km of coastline**, but there is no unified digital platform that provides tourists with real-time beach safety intelligence and coordinated emergency response.

### Current Challenges

  • No simple real-time **Safe / Caution / Unsafe** signal for beaches.
  • Visitors may lack current information about ocean conditions, rip-current risks, and official hazard advisories.
  • Emergency assistance can depend on a chain of separate phone calls.
  • Hospitals, lifeguards, police, coast guard, rescue posts, and jurisdictions operate through disconnected records.
  • There is no single system to automatically identify and coordinate the appropriate responder for an incident.
  • Existing ocean and weather data is available, but it is not converted into one simple decision for a beach visitor.

---

## πŸ’‘ Solution

**Wave-Safe** bridges the gap between **real-time risk awareness and emergency response**.

The platform is designed as a travel website first, with safety intelligence integrated throughout the user's journey.

### Predict β†’ Plan β†’ Protect β†’ Track

  • **Predict:** Calculate a live beach safety verdict from ocean and weather data.
  • **Plan:** Identify risky travel windows and suggest safer alternatives.
  • **Protect:** Provide one-tap SOS with location sharing and coordinated emergency dispatch.
  • **Track:** Provide live rescue tracking, acknowledgements, and ETAs.

---

## ✨ Features

### 🟒 Live Beach Safety

Provides a live:

- **SAFE**

- **CAUTION** - **UNSAFE**

verdict for beaches using real ocean and weather data.

### πŸ—“οΈ Smart Trip Planning

  • Evaluates risk across planned time windows.
  • Flags potentially dangerous slots.
  • Suggests safer alternative beaches.

### πŸ†˜ One-Tap SOS

A single SOS trigger can share the user's exact location with:

- 112 / emergency response

- Nearest hospital - Coast guard / marine police - Lifeguard post

### πŸš‘ Emergency Dispatch & Tracking

Tracks an incident through:

```text

Created β†’ Dispatched β†’ Acknowledged β†’ En Route β†’ Arrived β†’ Resolved ```

### πŸ—ΊοΈ Hospital & Authority Routing

  • Capability-filtered hospital matching.
  • Jurisdiction-matched authority routing.
  • Defined response roles.
  • Parallel emergency dispatch.

### πŸ“ Live Rescue Tracking

  • Location pings.
  • ETA tracking.
  • Stale-session detection.
  • Rescue progress visibility.

### πŸ”” Notifications

  • SMS notifications.
  • Web Push notifications.
  • Localized templates.
  • English fallback.

### πŸ“΄ Offline Support

  • Offline-capable Progressive Web App.
  • Local action queue.
  • Automatic synchronization after reconnect.

### πŸ” Authentication

  • Phone + OTP login.
  • Defined OTP expiry.

### 🏒 Admin & Operations

  • Beach management.
  • Jurisdiction management.
  • Hospital management.
  • Incident dashboards.
  • Acknowledgement dashboards.
  • Risk-rule tuning.
  • Log export.

### 🌊 Data Ingestion & Risk Engine

  • INCOIS + SACHET connectors.
  • Manual beach closures.
  • Data normalization and unit conversion.
  • Redis-based deduplication.
  • Risk scoring.
  • Time-series hazard outlook.

---

## 🧠 Risk Engine

The Risk Engine combines multiple inputs into an explainable risk score.

### Inputs

- Wave height

- Current speed - Wind - Tide - Water quality - Forecast trend - Lifeguard coverage

### Risk Formula

```text

R = Οƒ( Ξ£ wα΅’zα΅’ + Ξ£ wα΅’β±Όzα΅’zβ±Ό + λ₁Δtrend + Ξ»β‚‚Ξ”tide ) ```

### Risk Classification

| Risk Score | Verdict |

|---:|---| | `R < 0.33` | 🟒 SAFE | | `0.33 – 0.66` | 🟑 CAUTION | | `R β‰₯ 0.66` | πŸ”΄ UNSAFE |

Active **tsunami, storm surge, or evacuation** conditions override normal scoring and force:

```text

R = 1 β†’ UNSAFE ```

---

## πŸ› οΈ Tech Stack

### Frontend

- **React**

- **Next.js (SSR)** - **Mapbox GL JS / Google Maps API** - **Progressive Web App (PWA)**

### Backend

- **Python**

- **FastAPI** - **REST APIs** - **WebSockets** - **Celery**

### Database & Storage

- **PostgreSQL 16**

- **PostGIS** - **Redis 7** - **S3-compatible object storage**

### Infrastructure & DevOps

- **Docker**

- **Kubernetes** - **Kafka / RabbitMQ** - **GitHub Actions CI/CD** - **AWS / GCP**

### External APIs & Data Sources

- **INCOIS** β€” Ocean & advisory data

- **SACHET** β€” CAP / RSS alerts - **112 ERSS** β€” Emergency di

## Challenges we ran into

# The Bug That Almost Slipped Into Production

**Project:** WaveSafe β€” Coastal Safety Platform **Where it hit:** `POST /v1/admin/beaches` **Found during:** Final Swagger E2E testing, hours before deployment

## The Crash

```

psycopg2.errors.InvalidParameterValue: Geometry type (Point) does not match column type (Polygon) ```

A clean 500. Not a validation error β€” a raw database exception leaking straight to the client.

## Why It Happened

Swagger's auto-generated example payload showed a generic GeoJSON `Point`. Following it felt natural β€” but the `beaches` table stores each beach as a **Polygon** (a boundary, not a pin drop). The API had no validation layer checking the GeoJSON `type` before handing it to PostGIS. The request sailed straight through FastAPI β†’ SQLAlchemy β†’ Postgres, where the *database* finally said no β€” the hard way.

## The Fix

**Immediate:** Rebuilt the payload as a proper closed-ring Polygon (5 coordinate pairs, first == last). Confirmed the endpoint logic itself was fine β€” it was purely an input-shape problem.

**Real fix (queued, non-blocking):** Add a Pydantic validator on the GeoJSON `type` field so bad input returns a clean `422` before it ever touches the DB.

## The Pattern

This wasn't a one-off. The same root cause β€” **the database was the only validation layer** β€” surfaced twice more in the same session:

| Endpoint | Expected | Got |

|---|---|---| | `admin/beaches` | 422 (wrong geometry) | 500 crash | | `admin/activity-thresholds` | 409 (duplicate key) | 500 crash | | `safezone/guidance` | 422 (empty-string UUID) | 500 crash |

All three: the app layer trusted the input and let Postgres be the bouncer. Postgres did its job perfectly β€” data integrity held. But the *caller* got a stack trace instead of a sentence.

## The Takeaway

> A database constraint enforcing correctness is not the same as an API > validating input. One protects your data. The other protects your users > from a 500 page.

None of the three were blockers β€” all admin/internal-only, zero impact on the core user flow (SOS trigger β†’ dispatch β†’ tracking), which stayed clean through every test. But they're first on the list for the next patch.

Team

From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.