A Django-based system for managing tasks with support for complex dependencies, automatic status updates, and circular dependency detection.
- Backend: Django 4.x, Django REST Framework
- Frontend: React 18, Tailwind CSS, Axios
- Database: SQLite (default) / MySQL
- Language: Python 3.x, TypeScript
The frontend is a lightweight, single-page application built with React and Tailwind CSS. It features:
- Task List & Form: Intuitive interface for managing tasks and dependencies.
- Graph Visualization: Custom SVG-based graph view with hierarchical layout, zoom, pan, and node highlighting.
- UX Polish: Comprehensive validation, error handling, and loading states for a seamless experience.
All tasks from the assignment specification have been fully implemented and verified.
- Task Management: Create, update, and delete tasks with statuses (pending, in_progress, completed, blocked).
- Dependency Management: Define dependencies between tasks with strict validation.
- Circular Dependency Detection: Prevents cycles (e.g., A -> B -> A) using DFS and returns the cycle path.
- Auto Status Updates:
- Task becomes
blockedif any dependency isblocked. - Task becomes
in_progress(ready) only when all dependencies arecompleted. - Updates propagate recursively to dependent tasks.
- Task becomes
- Dependency Visualization: Interactive, hierarchical SVG graph to visualize task relationships.
- Robust UX:
- Edge-case handling (e.g., impact analysis warning when deleting tasks).
- Real-time feedback and loading states for all actions.
- Defensive validation to prevent invalid states (e.g., self-dependencies).
-
Clone the repository:
git clone <repository_url> cd "Task Dependency Management System"
-
Create and activate a virtual environment:
python -m venv venv # Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Install dependencies:
pip install django djangorestframework django-cors-headers mysqlclient
-
Apply migrations:
python manage.py migrate
-
Run the server:
python manage.py runserver
POST /api/tasks/{task_id}/dependencies/
Adds a dependency where {task_id} depends on the task specified in the body.
Request Body:
{
"depends_on_id": 5
}Response (Success - 201):
{
"status": "Dependency added"
}Response (Error - Circular Dependency - 400):
{
"error": "Circular dependency detected",
"path": [1, 5, 2, 1]
}PATCH /api/tasks/{task_id}/
Updates a task's status. Triggers automatic status updates for any dependent tasks.
Request Body:
{
"status": "completed"
}Response (Success - 200):
{
"id": 1,
"title": "Task A",
"status": "completed",
...
}Run the unit tests to verify logic:
python manage.py test tasks