Implement a matching algorithm that pairs food surplus postings with nearby organizations that need them. The algorithm should: 1. Accept a list of surplus items (type, quantity, expiration date, location) and a list of needs (type, quantity needed, location, capacity) 2. Score matches based on: distance (closer = better), expiration urgency (sooner = higher priority), quantity fit (minimize partial matches) 3. Return ranked match suggestions with a confidence score 4. Handle edge cases: no matches available, expired items, over-capacity Input/output should be typed TypeScript interfaces. Include unit tests for the scoring logic.
No contributions yet.