Skip to content

Ujj-CodeX/jeevandaan

Repository files navigation

JeevanDaan+

Django DRF Python PostgreSQL Twilio JWT Cloudinary License


What is JeevanDaan+?

Every 2 seconds, someone in India needs blood. JeevanDaan+ is the backend infrastructure that bridges that gap — a multi-role REST API connecting donors, blood banks, and patients' families on one platform, with real-time geo-matching, Aadhaar-verified identities, and a reliability engine that rewards the selfless.


Who Uses It

Role What They Do
🧑 Donor Registers, gets Aadhaar-verified, receives geo-targeted SMS/WhatsApp alerts when a nearby hospital needs their blood group
🏥 Partner Hospital or blood bank — manages live stock, posts donation requests, runs camps, verifies donations
🤝 Attender Patient's family — raises a blood request fulfilled by a direct donor or via inter-partner exchange

Core Features

📍 Geo-Matching Engine Bounding-box SQL pre-filter trims the candidate set first, then geodesic distance via geopy gives precision. Finds nearby donors and partners independently. Distance-sorted, 10km default radius, fully configurable.

🔔 Multi-Channel Notification Engine SMS + WhatsApp via Twilio on every critical event. Fallback call queued if both channels fail. All notifications run in background threads — they never block the HTTP response.

🔐 OTP Donation Verification On donor acceptance a unique 6-digit OTP is generated and delivered to the partner. Scanned at donation time. Donation history, scores, and member tags update atomically.

🏕️ Donation Camp System Partners schedule camps, donors within 20km are auto-notified. Dashboard freezes post-camp until stock is updated — enforcing accountability. CSV enrollment download on camp date.

🔄 Inter-Partner Blood Exchange Hospital A has no stock? The system finds the nearest Hospital B within 20km with available units and auto-raises a transfer request between them.

⏰ Background Scheduler Four APScheduler jobs run silently — expires stale requests every 15 min, auto-unlocks accounts every hour, cleans unvisited assignments every 30 min.


Donor Reliability Engine

Event Effect
Donation verified by bank +10 score
Cancellation −10 score
3+ cancellations Account locked 30 days
Lock period ends Auto-unlocked by scheduler
2+ donations 🥉 Bronze Donor
5+ donations 🥇 Gold Donor
10+ donations 💎 Platinum Donor

Request Lifecycle

Partner posts open request
        │
        ▼
Nearby donors notified via SMS + WhatsApp  ← background thread
        │
        ▼
Donor accepts → status: assigned → OTP generated & sent to partner
        │
        ├── Donor cancels → status: open again, score −10, lock check
        │
        ▼
Donor arrives → Partner scans OTP → arrival confirmed
        │
        ▼
Partner verifies donation → status: fulfilled
DonationHistory created → score +10 → member tag upgraded
        │
        ▼
Donor rates partner ⭐  |  Partner rates donor ⭐

Architecture

jeevandaan-plus/
├── config/              # Settings, JWT auth backends, permissions
├── users/               # Donor accounts, geo engine, scoring
├── partners/            # Hospital accounts, camps, inter-partner flows
├── requests_app/        # Full request lifecycle management
├── stock/               # Blood units per partner × blood group
├── donations/           # Donation history, verification, leaderboard
├── notifications/       # Twilio dispatch + notification models
├── chat/                # Donor ↔ Partner in-request messaging
└── scheduler.py         # APScheduler job definitions

Security

  • Passwords hashed with bcrypt — never stored in plain text
  • JWT tokens are short-lived (1 hour access, 7-day refresh)
  • Donor and partner are completely separate identity systems
  • Aadhaar numbers excluded from all serializer outputs
  • Admin panel is fully read-only on sensitive fields
  • Partners cannot go live without manual admin approval
  • Accounts auto-lock after 3 cancellations

Tech Stack

Framework Django 5.1.7 + Django REST Framework 3.17
Auth PyJWT + bcrypt
Database PostgreSQL via psycopg2
Media Cloudinary
Notifications Twilio — SMS + WhatsApp
Geo Engine geopy — geodesic distance matching
Scheduler APScheduler + django-apscheduler
Static Files WhiteNoise
Server Gunicorn with preload
Runtime Python 3.11.9

Built to save lives. Every donation matters.

🇮🇳 Made in India

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors