Current blood bank systems rely on slow, reactive methods—spamming donors in a "dumb radius" only after a shortage hits.
LifeLine AI revolutionizes the blood donation supply chain using Machine Learning and Graph Theory. Instead of waiting for an emergency, the system predicts shortages before they happen based on real-world risk factors. When a hospital issues an urgent request, it mathematically calculates the perfect set of donors to dispatch based on actual traffic ETA instead of geographic distance.
- Predictive Modeling: Uses a custom dataset based on
RFMTCvariables combined with modern environmental factors (Accident_Risk,Weather_Severity,Is_Weekend). - Classification Engine (RandomForest): Predicts if a region will experience a shortage based on spikes in accident risk or severe weather.
- Regression Engine (XGBoost): Calculates exactly how many units of blood need to be mobilized to restock the local Cold Chain FIFO before a crisis occurs without over-drafting donors.
- Hopcroft-Karp Bipartite Matching: Replaces the "SMS blast to everyone" problem. It treats the hospital request and the available donor pool as a bipartite graph, finding the mathematically perfect "Maximum Match" of donors to fulfill the exact unit requirements.
- Open Source Routing Machine (OSRM): Discards straight-line "Haversine" distance. The system pings OSRM to calculate actual driving time on road networks, prioritizing donors with a faster traffic ETA over those who are physically closer but stuck in gridlock.
- Admin Command Portal: Live-updating prediction map showing localized AI "Radar" shortages in real-time alongside active Hopcroft-Karp hospital dispatch nodes. Built with Next.js and Leaflet maps.
- Hospital Dispatch Portal: Cold Chain unit tracking and instant "Urgent Request" broadcasting that directly pings the Hopcroft-Karp algorithm.
- Donor Portal: An interactive dashboard where donors can see real-time match requests targeting them based on their exact coordinate ETA, alongside gamification/leaderboard systems tracking lives saved.
- Frontend: Next.js (App Router), React, Tailwind CSS, shadcn/ui, Leaflet (React-Leaflet)
- Backend: Python FastAPI, Scikit-Learn, XGBoost, Uvicorn
- Algorithms: Hopcroft-Karp Bipartite Matching, OSRMs (Open Source Routing Machine)
- Navigate to the
backendfolder. - Initialize virtual environment:
python -m venv .venvand activate it. - Install dependencies:
pip install fastapi uvicorn scikit-learn xgboost pandas numpy - Run the ML Training pipeline:
python train_models.py(Generates the.pklmodels). - Start the server:
uvicorn app.main:app --reload --port 8000
- Navigate to the
frontendfolder. - Install dependencies:
npm install - Run the development server:
npm run dev