跳到正文
DEV Community· Agampreet Singh·· 4 小時前AI 評分37

Raktsetu:以 YugabyteDB 與 Retell AI 建構自主超本地緊急血液網絡

Raktsetu: Autonomous Hyperlocal Emergency Blood Grid with YugabyteDB & Retell AI

AI 導讀

Raktsetu 建立結合地理位置配對、分散式 SQL 及印地語對話式 AI 的自主緊急血液網絡,連接 Delhi 的醫院與血液中心。捐血者未在 7 秒內回應 Telegram 通知時,系統會自動致電;確認捐血後,醫院應用程式會在 3 秒內更新。YugabyteDB 用於避免血液配額重複分配,TimescaleDB 則預測 48 小時內的區域血液短缺。

正文

What I Built

In acute trauma emergencies, maternal hemorrhages, and cardiac surgeries, every 60 seconds of transfusion delay increases patient mortality by up to 5%. In India alone, over 1.4 million clinical blood units fall short every year. In metropolitan regions like Delhi NCR, finding rare blood units (O-, AB-, B-) during the critical "Golden Hour" (the first 30–60 minutes after trauma) is a chaotic, fragmented nightmare.

Today, family members waste 2 to 4 desperate hours calling blood banks and begging for replacement donors. Meanwhile:

  1. Isolated Data Silos: Over 80 licensed blood banks across Delhi operate on disconnected legacy software without cross-hospital visibility.
  2. Double-Allocation Disasters: When scarce blood units run low, multiple casualty wards compete for the exact same units simultaneously. Standard single-node relational databases suffer concurrency race conditions, resulting in over-committed stock and fatal cancellations.
  3. Muted Alert Drop-off: Volunteer donors receive generic SMS or push notifications that are easily muted, buried, or ignored.

To solve this, we built RAKTSETU (रक्तसेतु) — an autonomous, distributed emergency blood grid combining geospatial matching, distributed SQL, predictive time-series telemetry, and autonomous Hindi conversational AI.

How Raktsetu Works

[Casualty Ward: 1-Tap Emergency Broadcast]
                       │
                       ▼
       [Geospatial Clinical Matcher]
  (ABO/Rh Compatibility + Haversine Radius)
                       │
                       ▼
   [Instant Telegram Dispatch (@Raktsetu1_bot)]
                       │
        ┌──────────────┴──────────────┐
  (Accepted in <7s)             (Unanswered after 7s)
        │                               │
        ▼                               ▼
 [Request Fulfilled]         [Autonomous Hindi Voice Call]
                             (Retell AI + Twilio "Asha")
                                        │
                                        ▼
                            [Verbal Assent: "हाँ, आ रहा हूँ"]
                                        │
                                        ▼
                        [Instant App Update in 3 Seconds]
  1. Hyperlocal Geospatial Dispatch: When a doctor triggers a Code Red request, our matching engine evaluates ABO/Rh clinical compatibility and calculates real-time road proximity across 50 Delhi hospitals and 82 licensed blood centers centered around Rohini Sector 16.
  2. Multi-Channel Alerting: Instant rich interactive alerts dispatch to on-call donors via Telegram (@Raktsetu1_bot) with 1-tap [⚡ Accept Request] buttons.
  3. Autonomous 7-Second Hindi Voice Escalation: If an alert remains unaccepted for 7 seconds, our background watchdog wakes up and triggers an outbound phone call directly to the donor's mobile number via Retell AI and Twilio. Our custom AI agent "Asha" speaks in natural Hindi: > "नमस्ते! मैं रक्तसेतु से आशा बोल रही हूँ। मैक्स हॉस्पिटल में एक मरीज़ को तुरंत O- नेगेटिव खून की ज़रूरत है। क्या आप अभी रक्तदान के लिए उपलब्ध हैं?"
  4. Closed-Loop Verbal Recognition: The backend actively listens for verbal confirmation ("हाँ / yes / उपलब्ध हूँ"), instantly commits the transaction, and updates the hospital's Flutter app to "🎉 Request Accepted by Donor!" with verified donor credentials in under 3 seconds.
  5. Zero Race-Condition Concurrency: Powered by YugabyteDB Cloud, eliminating double-booking hazards during concurrent peak-hour trauma requests.
  6. Predictive Shortage Intelligence: Powered by TimescaleDB / Tiger Data, forecasting regional blood stock depletion 48 hours in advance.

Demo

Key Demonstration Highlights:

  • Instant Code Red Dispatch: Casualty attendant creates an urgent request for 1 unit of O- blood on the Flutter mobile app.
  • Autonomous Escalation in 7 Seconds: The Telegram bot alert is left unresponded; at second 7, the autonomous background watchdog triggers Retell AI to dial the donor's real SIM phone.
  • Natural Hindi Dialogue & Live Fulfillment: The donor answers the incoming call from +1 (607) 270-3041, agrees to donate in Hindi ("हाँ, मैं आ रहा हूँ"), and the mobile app screen immediately transitions to fulfilled status with zero manual coordination needed.

Partner Technologies

1. YugabyteDB (Distributed SQL & ACID Transactions)

In an emergency trauma scenario where multiple hospital casualty departments concurrently request the last unit of rare blood (O- or AB-), traditional databases frequently encounter race conditions. This can result in two hospitals believing they have secured the same unit.

We integrated a live YugabyteDB Cloud cluster on AWS Mumbai (ap-south-1) communicating via PostgreSQL wire protocol (YSQL) on port 5433:

  • Distributed Row Locks: We implemented SELECT ... FOR UPDATE distributed row locking within atomic transactions. When multiple emergency wards trigger simultaneous allocations, YugabyteDB guarantees strict serializability with zero double-allocation faults.
  • Multi-AZ Fault Tolerance: In disaster response scenarios, database downtime cannot be tolerated. YugabyteDB's distributed Raft consensus ensures 99.999% high availability and <50ms query latency even if an entire cloud availability zone suffers an outage.

2. Tiger Data / TimescaleDB (Time-Series Telemetry & Predictive Analytics)

Predicting shortages before they occur is critical to saving lives. We utilized TimescaleDB / Tiger Data cloud infrastructure:

  • Telemetry Hypertables: High-throughput logging of emergency state transitions and donor response latencies (emergency_telemetry and inventory_snapshots) down to the millisecond.
  • Continuous Aggregates: Real-time materialized rollups (telemetry_hourly) aggregate donation volumes, regional depletion rates, and fulfillment velocity.
  • 48-Hour Shortage Forecasting: Using time-bucketed linear trend extrapolations, Raktsetu projects regional stock depletion 48 hours in advance across Delhi NCT, allowing blood centers to proactively schedule targeted voluntary drives.

3. Retell AI & Twilio Telephony

SMS and push notifications suffer from high drop-off rates during life-or-death emergencies. We engineered an autonomous voice bridge:

  • Retell AI Hindi Conversational Agent: Built custom agent "Asha" (retell-Cimo voice / DU Hindi) dynamically contextualized with hospital name, blood group, units, and distance.
  • Closed-Loop Polling & Webhooks: Sub-second recognition of natural Hindi responses converted automatically into database fulfillment events without human intervention.

Hackathon Experience

We built RAKTSETU during hackCBS 9.0 at Shaheed Sukhdev College of Business Studies (SSCBS), University of Delhi — one of India’s premier student hackathons and an official Major League Hacking (MLH) event!

The 24-hour sprint was an exhilarating rollercoaster. The venue buzzed with unmatched energy as hundreds of hackers brainstormed, coded, and iterated through the night.

What We Will Remember Most:

  • The 3:00 AM Breakthrough: After hours of debugging distributed database locks and configuring telephony webhooks across our mobile hotspot and ngrok tunnels, the room went completely silent as our real Android test phone rang on the desk. Hearing our Retell AI agent "Asha" speak fluent Hindi with the exact hospital and patient vitals we had just requested on the Flutter app was pure magic.
  • Cross-Disciplinary Teamwork: Synchronizing Flutter mobile UI, FastAPI backend services, distributed YugabyteDB nodes, TimescaleDB continuous aggregates, and live telephony carriers within 24 hours tested our architecture and debugging skills to their absolute limits.
  • Impact-Driven Purpose: Realizing that our code directly tackles the 60-second mortality curve in trauma care kept our adrenaline pumping without sleep.

A huge thank you to the hackCBS 9.0 organizing team, Major League Hacking (MLH), and partners like YugabyteDB and Tiger Data for providing the cutting-edge cloud infrastructure that made RAKTSETU possible!

來源:DEV Community · dev.to