From order to the right person at the door
When a booking needs a field collection, the core platform asks the engine: “who should take this job?” The engine pulls every eligible phlebotomist — both independent partners and center-employed staff — scores them against the job, and returns a ranked decision: assign, retry, or send to manual review. It runs synchronously for urgent jobs and over a BullMQ queue for throughput.
Geo-aware
Haversine distance ranks the field instantly; the top 5 are then refined with real OSRM driving distance & time for drivability-accurate ETAs.
Fair by design
A 20% workload weight actively spreads jobs across the team, preventing burnout and protecting service quality at peak.
Explainable
Every decision returns a confidence score, the reason, alternatives and an estimated arrival time — never a black box.
Five factors, one composite score (0–1)
Each eligible candidate earns a weighted score. Proximity dominates, but quality, fair load distribution and reliability all shape the outcome — and urgent jobs get a priority boost on top.
The decision pipeline
Hard eligibility filter
Online, KYC-verified, not blacklisted, license valid, free capacity, and serving the pickup pincode. Anyone who fails is out before scoring.
Enrich & check feasibility
Compute distance, active job count, and whether the candidate can physically reach the slot in time (travel time + 15-min arrival buffer).
Score & rank
Apply the 5-factor model; sort descending. Candidates beyond their service radius score zero on proximity.
Road-distance refine
Re-score the top 5 with real OSRM driving distance & duration — graceful fallback to straight-line if routing is unavailable.
Threshold & decide
If the best score clears the minimum (0.4), assign with alternatives + ETA. Otherwise trigger the fallback cascade.
Webhook the result
Async jobs post the decision back to the core API over an authenticated channel, with retries and a dead-letter trail.