An intelligent medical triage system that replaces slow manual matching with an automated graph-based engine. Features real-time urgency-based prioritization and strict algorithmic enforcement of ABO/Rh compatibility rules to eliminate human error and optimize scarce blood inventory.
The project utilizes a Priority-Based Greedy Allocation strategy rooted in graph theory:
- Priority Queue
O(N log N): Patients are sorted in descending order based on medical urgency (1-10) to ensure critical cases receive immediate allocation. - Adjacency Matrix
O(1): An 8x8 boolean matrix represents the directed edges of safe blood transfusions (e.g., O- is a universal donor). This allows for constant-timeO(1)compatibility lookups. - Greedy Selection
O(N * M): The algorithm iterates through the sorted patient queue and greedily assigns the highest-priority compatible blood bag from the available donor inventory.
- Core Logic Verification: C++ (
blood-match.cpp) - Frontend Dashboard: React, Vite, Tailwind CSS v4, Framer Motion
- Backend API: Python, FastAPI, Uvicorn
1. Start the Frontend UI:
cd frontend
npm install
npm run dev2. Start the Backend API (Optional):
cd backend
pip install -r requirements.txt
uvicorn main:app --reload(Note: The frontend contains a highly resilient JavaScript fallback engine. If the Python backend is offline or skipped during deployment, the React UI will natively execute the O(N log N) greedy graph logic directly in the browser without failure.)