Skip to content

Lalith-Reddy-22/Task-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Smart Task Analyzer

A Django-based web application that intelligently prioritizes tasks using a custom scoring algorithm. This tool helps users decide what to work on first by analyzing task properties like due dates, importance, effort, and dependencies.

Django Python Docker Tests

🌟 Features

Core Features

  • Smart Prioritization Algorithm - Multi-factor scoring system
  • Multiple Sorting Strategies - Smart, Deadline, Importance, Quick Wins, Eisenhower
  • Top 3 Suggestions - Personalized recommendations with explanations
  • Edge Case Handling - Gracefully handles missing data, overdue tasks, invalid inputs

Advanced Features

  • πŸ“Š Eisenhower Matrix - Visual 2D grid (Urgent vs Important) with 4 quadrants
  • πŸ”— Dependency Graph - Visualize task dependencies with circular dependency detection
  • πŸ“… Date Intelligence - Considers weekends and holidays in urgency calculation
  • 🧠 Learning System - Feedback-based algorithm adjustment
  • βœ… Comprehensive Tests - 62 unit tests covering all functionality

Technical Features

  • 🐳 Docker Support - Containerized deployment ready
  • Modern UI - Dark theme with responsive design and animations
  • REST API - Clean JSON endpoints for all operations

πŸš€ Quick Start

Option 1: Local Development

# Navigate to project
cd task-analyzer

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Mac/Linux
# venv\Scripts\activate   # Windows

# Install dependencies
pip install -r requirements.txt

# Run migrations
python manage.py migrate

# Start server
python manage.py runserver

Open: http://127.0.0.1:8000/

Option 2: Docker

cd task-analyzer

# Build and run with Docker Compose
docker-compose up --build

# Or run in background
docker-compose up -d --build

# Stop
docker-compose down

Open: http://localhost:8000/

🧠 The Scoring Algorithm

The Smart Task Analyzer uses a weighted multi-factor algorithm to calculate priority scores. Higher scores indicate higher priority.

Scoring Components

Factor Weight Max Points Description
Urgency 40% 100 Based on working days until due date
Importance 30% 50 User-defined priority (1-10) Γ— 5
Effort 20% 15 Quick wins bonus for small tasks
Dependencies 10% 20 Bonus for blocking tasks

Urgency Scoring (with Date Intelligence)

Overdue                β†’ +100 points (MAXIMUM URGENCY)
Due Today              β†’ +75 points
Due in 1-2 work days   β†’ +60 points
Due in 3-5 work days   β†’ +40 points
Due in 6-10 work days  β†’ +20 points
Due in 11+ work days   β†’ +0 points

* Weekends and holidays are excluded from working days
* Tasks due after a long weekend get urgency boost

Priority Labels

Label Score Range Meaning
CRITICAL β‰₯150 Requires immediate attention
HIGH 100-149 Should be done soon
MEDIUM 60-99 Normal priority
LOW <60 Can wait

Eisenhower Matrix Classification

Tasks are also classified into 4 quadrants:

Quadrant Criteria Action
Q1: DO FIRST Urgent & Important Handle immediately
Q2: SCHEDULE Not Urgent & Important Plan time for these
Q3: DELEGATE Urgent & Not Important Delegate or batch
Q4: ELIMINATE Not Urgent & Not Important Consider removing

πŸ“‘ API Reference

Core Endpoints

Method Endpoint Description
POST /api/tasks/analyze/ Analyze and sort tasks
POST /api/tasks/suggest/ Get top suggestions
POST /api/tasks/eisenhower/ Get Eisenhower Matrix
POST /api/tasks/dependencies/ Get dependency graph
POST /api/tasks/feedback/ Submit learning feedback
DELETE /api/tasks/feedback/ Reset learning system

Example: Analyze Tasks

Request:

POST /api/tasks/analyze/
{
  "tasks": [
    {
      "id": 1,
      "title": "Complete report",
      "due_date": "2024-12-31",
      "importance": 8,
      "estimated_hours": 3,
      "dependencies": []
    }
  ],
  "strategy": "smart",
  "use_date_intelligence": true,
  "use_learning": true
}

Response:

{
  "success": true,
  "tasks": [
    {
      "id": 1,
      "title": "Complete report",
      "score": 125,
      "status_label": "HIGH",
      "eisenhower": { "quadrant": "Q1", "label": "DO FIRST" },
      "date_context": "3 working days (5 calendar days)",
      ...
    }
  ],
  "strategy": "smart",
  "count": 1
}

Sorting Strategies

Strategy Description
smart Balanced algorithm using all factors (default)
deadline Sort by due date, closest first
importance Sort by importance level, highest first
quick_wins Sort by duration, shortest first
eisenhower Sort by Eisenhower quadrant (Q1β†’Q2β†’Q3β†’Q4)

πŸ›‘οΈ Edge Case Handling

Scenario Handling
Missing due_date Treated as low urgency (0 points)
Missing importance Defaults to 5 (medium)
Missing estimated_hours Defaults to 2 hours
Past due dates (e.g., 1990) Marked as overdue with maximum urgency
Circular dependencies Detected and flagged visually
Weekend due dates Adjusted urgency based on working days
Invalid JSON Returns clear error message

πŸ“ Project Structure

task-analyzer/
β”œβ”€β”€ backend/                  # Django Project Configuration
β”‚   β”œβ”€β”€ settings.py          # Django settings
β”‚   β”œβ”€β”€ urls.py              # Main URL routing
β”‚   └── wsgi.py              # WSGI config
β”œβ”€β”€ tasks/                    # Tasks Application
β”‚   β”œβ”€β”€ models.py            # Task model definition
β”‚   β”œβ”€β”€ scoring.py           # ⭐ Scoring algorithm with all features
β”‚   β”œβ”€β”€ views.py             # API views
β”‚   β”œβ”€β”€ urls.py              # API URL routing
β”‚   └── tests.py             # 62 unit tests
β”œβ”€β”€ frontend/                 # Frontend Files
β”‚   β”œβ”€β”€ index.html           # Main HTML page
β”‚   β”œβ”€β”€ styles.css           # Dark theme styling
β”‚   └── script.js            # JavaScript interactivity
β”œβ”€β”€ Dockerfile               # Docker container config
β”œβ”€β”€ docker-compose.yml       # Docker Compose config
β”œβ”€β”€ .dockerignore            # Docker ignore rules
β”œβ”€β”€ requirements.txt         # Python dependencies
β”œβ”€β”€ manage.py                # Django management
└── README.md                # This file

πŸ§ͺ Running Tests

# Run all tests
python manage.py test tasks

# Run with verbose output
python manage.py test tasks --verbosity=2

Test Coverage:

  • Date parsing (9 tests)
  • Urgency calculation (6 tests)
  • Date intelligence - weekends/holidays (7 tests)
  • Importance scoring (3 tests)
  • Effort scoring (4 tests)
  • Dependency graph & cycles (5 tests)
  • Eisenhower Matrix (5 tests)
  • Complete task scoring (5 tests)
  • Task analysis strategies (4 tests)
  • Suggestions (3 tests)
  • API endpoints (5 tests)
  • Edge cases (6 tests)

🎨 Frontend Features

  • Dark Theme - Easy on the eyes with amber accent colors
  • Two Input Modes - Form-based entry or JSON paste
  • Real-time Validation - Immediate feedback on input
  • Animated Results - Smooth card animations
  • Priority Color Coding:
    • πŸ”΄ Red = Critical
    • 🟠 Orange = High
    • 🟑 Yellow = Medium
    • 🟒 Green = Low
  • Responsive Design - Works on desktop and mobile
  • Modal Views - Eisenhower Matrix and Dependency Graph popups

🐳 Docker Details

Build & Run

docker-compose up --build

Docker Image Features

  • Python 3.12 slim base (small image size)
  • Auto-runs migrations on build
  • Health checks included
  • SQLite database support
  • Volume mounting for development

πŸ“ License

This project is created for educational purposes as part of the Singularium Assignment.


Built with using Django, Vanilla JavaScript, and Docker

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published