Design a Pendency Tracking System

Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2025-01-10

Problem Statement

Design a Pendency Tracking System that helps an organization track and manage pending tasks, approvals, or actions assigned to users across various departments or services.


🔷 Functional Requirements:

1.Add a Pendency:
•A pendency can be created with a unique ID, title, description, creation time, due date, and assigned user.
•It can be associated with a particular category (e.g., KYC, Legal, IT, HR, etc.)
2.Update Pendency:
•Users should be able to update the status of a pendency (e.g., OPEN, IN_PROGRESS, RESOLVED, EXPIRED).
•Also allow adding comments or attachments.
3.Get All Pending Items for a User:
•Retrieve all open/in-progress pendencies assigned to a specific user, optionally filtered by category or due date.
4.Escalation Mechanism:
•If a pendency is not resolved before the due date, it should be marked as EXPIRED and escalated (e.g., notify manager/escalation list).
5.Search & Reporting:
•Provide ability to search pendencies by category, status, or assigned user.
•Support pagination and sorting.


🔷 Constraints & Assumptions:

•Pendencies are assigned to individual users, but could also later be extended to teams.
•You do not need to implement authentication, persistence, or actual notifications — simulate using in-memory structures.
•Ensure your system is modular, extensible, and follows OOP principles.
•Handle idempotent updates gracefully.


🔶 Expected Design Focus:

•Define clear class structure (e.g., Pendency, User, PendencyService, EscalationService)
•Use Enums or constants for status and categories.
•Apply SOLID principles:
•Open/Closed for category or status addition.
•Single Responsibility for services.
•Prefer interfaces for external systems like notification or escalation.


🔷 Bonus (Optional):

•Add a scheduler simulation that marks expired pendencies and triggers escalation.
•Add support for priority levels (LOW, MEDIUM, HIGH) and sort accordingly.


✅ Sample Use Case:

1plaintext 2CopyEdit 31. Add a pendency titled "Upload KYC Docs" assigned to user U1, due in 2 days. 42. User U1 updates the status to IN_PROGRESS. 53. After 3 days, the system escalates it since it's not resolved.


Solution

Comments