1. Inspiration
Urgence‑Sang was born from a clear and urgent problem: when a patient needs a transfusion, the time required to find compatible blood can be decisive. We built this project to shorten those delays, reduce the emotional overload on clinical teams, and make citizen solidarity fast and actionable. The fragmentation of paper records and decentralized blood stock information made a software solution both obvious and necessary.
2. What the project does
Urgence‑Sang streamlines the blood response chain for hospitals:
- Accepts an emergency alert from a hospital and records the need (blood type, urgency).
- Ranks available donors by probability of response (distance, donation history, traffic conditions).
- Sends short, personalized notifications to mobilize the most useful donors quickly.
- Provides a short conversational pre‑screening to verify donor eligibility before they travel.
- Exposes a modular API and a frontend ready for Docker‑based deployment.
Key code components: ai_service/app.py (AI endpoints), ai_service/matcher.py (ranking), ai_service/chat_engine.py (pre‑screening & messages), and the backend integration at backend/internal/services/ai_service.go.
3. How we built it
Architecture and stack:
- Frontend: React + TypeScript with Vite (mobile‑first UI).
- Backend: Go (compiled binary), Fiber framework, JWT authentication, PostgreSQL for persistence.
- AI microservice: Python 3.11 + Flask exposing
/rank,/chat,/motivatefor ranking, conversational pre‑screening and notification generation. - Database and migrations: PostgreSQL with PostGIS for geospatial queries (
backend/db/migrations.sql). - Containerization: Dockerfiles provided for the backend and AI service (see
backend/Dockerfileandai_service/Dockerfile).
Design choices:
- Clear separation of concerns — the Go backend orchestrates and persists state, the Python AI microservice handles ranking and natural‑language tasks.
- Resilience — all external calls (LLM, push services) have timeouts and fallbacks to deterministic logic.
- Simplicity and explainability — ranking uses a transparent formula based on normalized distance, donation history and a traffic heuristic.
4. Challenges encountered
- External LLM availability and latency — we implemented rule‑based fallbacks.
- Handling and protecting sensitive medical data (blood type, contact data).
- Crafting notification text that is urgent but not alarming.
- Network variability and geolocation precision across devices.
- Calibrating scoring parameters (radius, weights) so results are operationally useful.
5. Accomplishments we're proud of
- A working end‑to‑end prototype (UI, API, AI microservice, dockerized deployments).
- A simple, reproducible ranking algorithm that is easy to audit.
- Personalized push messages and a conversational pre‑screening flow that improve engagement.
- Modular architecture that eases testing and deployment.
- Robust fallbacks to ensure service continuity even without an LLM.
6. Role of AI and justification
Concrete AI functions in Urgence‑Sang:
- Conversational pre‑screening:
ai_service/chat_engine.pyattempts to use an LLM (Gemini) to conduct a short, one‑question‑at‑a‑time healthy‑donor screening in French. If the LLM is unavailable, a deterministic rule‑based flow is used. - Notification generation:
generate_motivation(...)uses the LLM to craft short, human‑sounding push notifications adapted to the donor's name, blood type, distance and urgency, with a template fallback if needed. - Ranking assistance: the core ranking is deterministic in
ai_service/matcher.py(distance, history, traffic). AI can later be used to refine personalization and prioritize donors using richer signals.
Why AI is appropriate here:
- Natural language generation produces concise, empathetic messages that increase response rates compared to rigid templates.
- Adaptive dialogue accelerates pre‑screening by asking the right follow‑up question instead of a long checklist.
- The LLM acts as an assistant; medical rules remain explicit and auditable, and safe fallbacks are always available.
Formulas and logic (implemented in ai_service/matcher.py):
Haversine distance between two GPS points (radius in meters, $R=6{,}371{,}000$ m): $$ \begin{aligned} \Delta\phi &= \phi_2 - \phi_1, \qquad \Delta\lambda = \lambda_2 - \lambda_1 \ a &= \sin^2\left(\frac{\Delta\phi}{2}\right) + \cos\phi_1\,\cos\phi_2\,\sin^2\left(\frac{\Delta\lambda}{2}\right) \ d &= 2R\,\arcsin\bigl(\sqrt{a}\bigr) \end{aligned} $$
Ranking score (current implementation): $$ S = w_d\,D(d) + w_h\,H(h) + w_t\,T(t) $$ with default weights $w_d=0.4$, $w_h=0.3$, $w_t=0.3$ and a distance normalization $$ D(d)=\begin{cases} 1 - \dfrac{d}{R_{\max}}, & d < R_{\max}, \[4pt] 0, & d \ge R_{\max}. \end{cases} $$
Here $D$ is proximity (closer → higher), $H$ is normalized donation history (more donations → higher), and $T$ is a traffic heuristic based on time of day.
Ethics & safety: AI supports information gathering and engagement but does not make unattended medical decisions. Fallbacks and explicit rules ensure conservative behavior.
7. What we learned
- Every external dependency (LLM, push services) needs a clear fallback plan.
- Asking one clear question at a time greatly reduces confusion and speeds up screening.
- Transparent algorithms (normalization + weighted sum) help clinicians trust the system.
- User experience and tone are as important as technical accuracy to motivate donors.
8. Surplus in the application — "Passeport Vital"
Title: The Smartphone as a Vital Passport — A Preventive Health Innovation
Concept
As an optional extension, we propose a "Passeport Vital" module that turns the smartphone into a secure container for critical medical data (blood type, allergies, emergency contacts). Its purpose is to give first responders immediate access to verified vital information when a patient cannot communicate.
Key benefits:
- Reduced time to care (the "Golden Hour"): vital information is immediately available to caregivers.
- Individual and public protection: every registered user secures their own emergency data while strengthening community resilience.
- Increased utility of smartphones: the device becomes a public‑health tool in areas where paper records are often missing.
- AI‑assisted optimization: combining blood type data and geolocation can connect needs and resources with high precision.
Conclusion on the surplus
The "Passeport Vital" is a natural, optional extension that enhances the chain of survival. Its adoption requires additional work on encryption, consent, and verifiable data integrity.
9. Future prospects
- Supervised learning to adapt ranking weights from historical response data.
- A/B testing and bandit algorithms to optimize notification wording for higher response rates.
- End‑to‑end encryption and verifiable credentials for the Passeport Vital data.
- Multi‑language and culturally adapted messaging.
- Offline mode and delayed synchronization for low‑connectivity regions.
- A management dashboard for hospitals to monitor alerts, responses and blood stock in real time.
If you want, I can:
- produce a concise English pitch (one page),
- export this document as a PDF ready for presentation, or
- generate a
docker‑compose.ymlto run the whole stack locally for demos.
Tell me which option you prefer and I'll prepare it immediately.
Built With
- docker
- flask
- golang
- jwt
- postgresql
- python
- react-native
- talwindcss
Log in or sign up for Devpost to join the conversation.