Capstone Project 1

CLI To-Do Application

Build a feature-rich command-line task manager with Python. You will implement JSON storage for persistence, create categories and priorities, add productivity analytics, and import real-world task data from CSV files.

6-8 hours
Intermediate
400 Points
What You Will Build
  • Task class with OOP design
  • CRUD operations manager
  • JSON file persistence
  • CSV import/export
  • Productivity analytics
Contents
01

Project Overview

Build a professional command-line To-Do application that demonstrates your Python skills with file handling, data structures, object-oriented programming, and working with real dataset for productivity analytics. Your app will store tasks persistently in JSON format and include features like categories, priorities, due dates, and task statistics.

Skills Applied: This project tests your proficiency in Python OOP (classes, methods, properties), file handling (JSON, CSV), data structures (lists, dictionaries), user input validation, and modular programming.

What You Will Build

A fully functional CLI task manager that runs in the terminal:

$ python todo.py

==============================================
     TASKMASTER - CLI To-Do Application
==============================================

 [1] Add New Task       [5] Mark Complete
 [2] View All Tasks     [6] Delete Task
 [3] View by Category   [7] Task Statistics
 [4] View by Priority   [8] Import Tasks
 [9] Export Tasks       [0] Exit

Choose an option: 1

--- Add New Task ---
Title: Complete Python project
Category (work/personal/study/health): study
Priority (high/medium/low): high
Due date (YYYY-MM-DD or leave blank): 2025-01-20

Task added successfully! ID: #0015

Skills You Will Apply

Python Core

Functions, classes, decorators, and error handling

Data Storage

JSON file handling, CRUD operations, persistence

OOP Design

Classes, inheritance, encapsulation patterns

Analytics

Statistics, data analysis, CSV processing

Learning Objectives

Technical Skills
  • Build modular Python applications with multiple files
  • Implement persistent data storage using JSON
  • Create reusable classes with proper OOP design
  • Handle user input validation and error cases
  • Process and analyze CSV data from real datasets
Professional Skills
  • Structure code following best practices
  • Write clean, documented, maintainable code
  • Use Git for version control and collaboration
  • Create comprehensive README documentation
  • Test edge cases and handle exceptions gracefully
Ready to submit? Already completed the project? Submit your work now!
Submit Now
02

Project Scenario

ProductivityHub Inc.

You have been hired as a Python Developer at ProductivityHub, a startup building productivity tools. The company wants to create a lightweight, terminal-based task management tool that their developer users can run directly from the command line without needing a browser or GUI. The tool should integrate with existing task data and provide productivity insights.

"We need a simple but powerful CLI tool that developers will love. It should support categories, priorities, due dates, and most importantly - let users import their existing tasks from CSV files. Can you also add some cool statistics so users can track their productivity over time?"

Sarah Chen, Product Manager

Core Features Required

Task Management
  • Create tasks with title, description, category
  • Set priority levels (high, medium, low)
  • Add optional due dates
  • Mark tasks as complete or pending
Data Operations
  • Persist all tasks to JSON file
  • Import tasks from CSV files
  • Export tasks to CSV format
  • Search and filter tasks
Organization
  • Categorize tasks (work, personal, study, health)
  • View tasks by category or priority
  • List overdue tasks
  • Sort by date, priority, or status
Analytics
  • Show completion rate statistics
  • Display tasks per category breakdown
  • Track productivity trends
  • Analyze imported dataset for insights
Pro Tip: Think like a developer user! Your CLI should be intuitive with clear prompts, helpful error messages, and keyboard-friendly navigation. Consider adding color-coded output for better readability.
03

The Dataset

You will use a real-world productivity dataset from Kaggle to implement the import feature and analyze task completion patterns. Your app should be able to import this data and provide analytics based on it.

Dataset Download

Download the sample task datasets and save them to your project data folder. These files will help you test import functionality and analyze productivity patterns.

Original Data Source

This project uses task data inspired by the FitBit Fitness Tracker Data from Kaggle - one of the most popular datasets for learning daily activity tracking and personal productivity analysis. The dataset demonstrates real-world time tracking patterns that inspire our task management structure with categories, status tracking, and completion analytics.

Sample Data Info: 500+ task records | Categories: Work, Personal, Study, Health | Fields: task_id, title, description, category, priority, status, due_date, created_date, completed_date, time_spent_minutes
Dataset Schema

ColumnTypeDescription
task_idIntegerUnique task identifier (1-500)
titleStringTask title (max 100 chars)
descriptionStringDetailed task description
categoryStringwork, personal, study, health
priorityStringhigh, medium, low
statusStringpending, completed, overdue
due_dateDateTask deadline (YYYY-MM-DD)
created_dateDateWhen task was created
completed_dateDateWhen task was completed (nullable)
time_spentIntegerMinutes spent on task

ColumnTypeDescription
dateDateSummary date (YYYY-MM-DD)
tasks_createdIntegerNew tasks created that day
tasks_completedIntegerTasks completed that day
total_time_spentIntegerTotal minutes spent on tasks
completion_rateFloatPercentage of tasks completed (0-100)
most_productive_hourIntegerHour with most completions (0-23)
Sample Data Preview

Here is what a typical task record looks like:

task_idtitlecategoryprioritystatusdue_date
1Complete Python projectstudyhighpending2025-01-20
2Review team meeting notesworkmediumcompleted2025-01-15
3Morning workout routinehealthhighcompleted2025-01-14
Your JSON Storage Format: Your app should store user tasks in a similar format. Here is an example of how your tasks.json should look:
{
  "tasks": [
    {
      "id": 1,
      "title": "Complete Python project",
      "description": "Build CLI todo app with JSON storage",
      "category": "study",
      "priority": "high",
      "status": "pending",
      "due_date": "2025-01-20",
      "created_date": "2025-01-10",
      "completed_date": null
    }
  ],
  "metadata": {
    "total_tasks": 1,
    "last_updated": "2025-01-10T14:30:00"
  }
}
04

Project Requirements

Your project must include all of the following components. Structure your code with clear organization, proper documentation, and follow Python best practices.

1
Project Structure

Organize your code into the following structure:

todo-app/
├── todo.py              # Main entry point
├── task.py              # Task class definition
├── task_manager.py      # TaskManager class for CRUD operations
├── storage.py           # JSON file handling
├── analytics.py         # Statistics and reporting
├── utils.py             # Helper functions (validation, formatting)
├── data/
│   ├── tasks.json       # User tasks storage (auto-created)
│   ├── sample_tasks.csv # Sample data for import testing
│   └── productivity_data.csv
├── tests/
│   ├── test_task.py
│   └── test_manager.py
├── requirements.txt     # Dependencies (if any)
└── README.md            # Project documentation
Requirement: Each module should have a clear, single responsibility. Use proper imports and avoid circular dependencies.
2
Task Class (OOP)

Create a Task class with the following:

  • Attributes: id, title, description, category, priority, status, due_date, created_date, completed_date
  • Methods: mark_complete(), mark_pending(), to_dict(), from_dict()
  • Properties: is_overdue (computed), days_until_due (computed)
  • Validation: Validate category and priority values on assignment
  • Representation: Implement __str__ and __repr__ methods
class Task:
    CATEGORIES = ['work', 'personal', 'study', 'health']
    PRIORITIES = ['high', 'medium', 'low']
    
    def __init__(self, title, category='personal', priority='medium', 
                 due_date=None, description=''):
        self.id = None  # Set by TaskManager
        self.title = title
        self.category = category
        self.priority = priority
        self.status = 'pending'
        self.due_date = due_date
        self.created_date = datetime.now().isoformat()
        self.completed_date = None
        self.description = description
    
    @property
    def is_overdue(self):
        # Return True if past due date and not completed
        pass
    
    def mark_complete(self):
        self.status = 'completed'
        self.completed_date = datetime.now().isoformat()
3
TaskManager Class

Implement CRUD operations:

  • add_task(task): Add new task, assign ID, save to storage
  • get_task(id): Retrieve task by ID
  • get_all_tasks(): Return all tasks
  • update_task(id, **kwargs): Update task attributes
  • delete_task(id): Remove task from storage
  • filter_tasks(category=None, priority=None, status=None): Filter tasks
  • search_tasks(query): Search by title or description
Requirement: TaskManager should load tasks from JSON on init and save after every modification.
4
Storage Module

Handle JSON file operations:

  • load_tasks(filepath): Load tasks from JSON file
  • save_tasks(tasks, filepath): Save tasks to JSON file
  • import_csv(filepath): Import tasks from CSV file
  • export_csv(tasks, filepath): Export tasks to CSV
  • backup_data(): Create timestamped backup
import json
import csv
from datetime import datetime

def load_tasks(filepath='data/tasks.json'):
    """Load tasks from JSON file. Create if not exists."""
    try:
        with open(filepath, 'r') as f:
            data = json.load(f)
            return data.get('tasks', [])
    except FileNotFoundError:
        return []

def save_tasks(tasks, filepath='data/tasks.json'):
    """Save tasks to JSON file with metadata."""
    data = {
        'tasks': [task.to_dict() for task in tasks],
        'metadata': {
            'total_tasks': len(tasks),
            'last_updated': datetime.now().isoformat()
        }
    }
    with open(filepath, 'w') as f:
        json.dump(data, f, indent=2)
5
Analytics Module

Implement productivity statistics:

  • get_completion_rate(): Percentage of completed tasks
  • get_category_breakdown(): Tasks per category
  • get_priority_breakdown(): Tasks per priority level
  • get_overdue_tasks(): List of overdue tasks
  • get_productivity_summary(): Overall statistics
  • analyze_csv_data(filepath): Analyze imported dataset
Requirement: Display statistics in a formatted, readable manner using ASCII tables or aligned text output.
6
CLI Interface

Interactive menu-driven interface:

  • Main menu with numbered options
  • Clear screen and header for each view
  • Input validation with helpful error messages
  • Confirmation prompts for destructive actions
  • Color-coded output (optional but recommended)
  • Graceful exit with save confirmation
05

Feature Specifications

Implement the following features with proper validation. Each feature should be accessible from the main menu.

Add Task
  • Prompt for title (required, 1-100 chars)
  • Optional description
  • Select category from list
  • Select priority level
  • Optional due date (validate format)
  • Show confirmation with task ID
View Tasks
  • View all tasks in table format
  • Filter by category
  • Filter by priority
  • Filter by status (pending/completed)
  • Show overdue tasks highlighted
  • Sort by date, priority, or status
Update Task
  • Search/select task by ID
  • Show current values
  • Allow editing any field
  • Press Enter to keep current value
  • Validate new values
  • Save and confirm changes
Mark Complete
  • List pending tasks
  • Select by ID or multiple IDs
  • Set completed_date to now
  • Update status to completed
  • Show completion message
  • Option to undo (mark pending)
Delete Task
  • Search/select task by ID
  • Show task details
  • Confirm deletion (yes/no)
  • Remove from storage
  • Option to delete completed tasks
  • Cannot be undone warning
Statistics
  • Total tasks (pending/completed)
  • Completion rate percentage
  • Tasks per category chart
  • Tasks per priority level
  • Overdue tasks count
  • Average completion time
Sample Output: Task Statistics
================== TASK STATISTICS ==================

Total Tasks: 45
  - Pending:   18 (40%)
  - Completed: 27 (60%)
  - Overdue:   3

Category Breakdown:
  Work     : ████████████████ 16 (35.6%)
  Study    : ████████████     12 (26.7%)
  Personal : ████████         8  (17.8%)
  Health   : ████████████████ 9  (20.0%)

Priority Breakdown:
  High   : ████████     8  (17.8%)
  Medium : ████████████████████ 20 (44.4%)
  Low    : ████████████████ 17 (37.8%)

Average Completion Time: 2.3 days
Most Productive Day: Monday (8 completions)
=========================================================
06

Data Storage

Your application must persist data using JSON files. This ensures tasks are saved between sessions and can be backed up easily.

JSON Storage
Storage Location
data/tasks.json
Auto-Save Behavior
  • Save after every add/update/delete
  • Load on application start
  • Create file if not exists
Metadata Tracking
  • Total task count
  • Last updated timestamp
  • Next available ID
CSV Import/Export
Import Feature
  • Read sample_tasks.csv
  • Map CSV columns to Task fields
  • Handle missing/invalid values
  • Report success/error counts
Export Feature
  • Export all or filtered tasks
  • Include all task fields
  • Proper CSV formatting
  • Timestamped filename
JSON Storage Format
{
  "tasks": [
    {
      "id": 1,
      "title": "Complete Python project",
      "description": "Build CLI todo app with all required features",
      "category": "study",
      "priority": "high",
      "status": "pending",
      "due_date": "2025-01-20",
      "created_date": "2025-01-10T10:30:00",
      "completed_date": null
    },
    {
      "id": 2,
      "title": "Morning jog",
      "description": "30 minutes cardio",
      "category": "health",
      "priority": "medium",
      "status": "completed",
      "due_date": "2025-01-14",
      "created_date": "2025-01-13T08:00:00",
      "completed_date": "2025-01-14T07:45:00"
    }
  ],
  "metadata": {
    "total_tasks": 2,
    "next_id": 3,
    "last_updated": "2025-01-14T10:00:00",
    "version": "1.0"
  }
}
Important: Handle file errors gracefully. If the JSON file is corrupted, offer to create a backup and start fresh. Never lose user data without warning!
07

Submission Requirements

Create a public GitHub repository with the exact name shown below:

Required Repository Name
python-todo-cli
github.com/<your-username>/python-todo-cli
Required Project Structure
python-todo-cli/
├── todo.py              # Main entry point (run this)
├── task.py              # Task class
├── task_manager.py      # TaskManager class
├── storage.py           # JSON/CSV handling
├── analytics.py         # Statistics module
├── utils.py             # Helper functions
├── data/
│   ├── tasks.json       # Sample tasks (for testing)
│   └── sample_tasks.csv # Import test data
├── tests/
│   ├── test_task.py     # Unit tests for Task
│   └── test_manager.py  # Unit tests for TaskManager
├── screenshots/
│   ├── main_menu.png    # Screenshot of main menu
│   ├── add_task.png     # Screenshot of adding task
│   └── statistics.png   # Screenshot of statistics
├── requirements.txt     # Dependencies (if any)
└── README.md            # Project documentation
README.md Required Sections
1. Project Header
  • Project title and badges
  • Brief description
  • Your name and submission date
2. Features
  • List all implemented features
  • Highlight any bonus features
3. Installation
  • Clone command
  • Python version requirement
  • pip install requirements
4. Usage
  • How to run the app
  • Example commands
  • Screenshots
5. Project Structure
  • Explain each file's purpose
  • Module relationships
6. Data Format
  • JSON schema explanation
  • Example task object
7. Testing
  • How to run tests
  • Test coverage info
8. License and Contact
  • MIT License recommended
  • GitHub profile link
Do Include
  • All Python modules with docstrings
  • Sample tasks.json with test data
  • Unit tests for core functionality
  • Screenshots of app in action
  • Clear README with examples
  • requirements.txt (even if empty)
Do Not Include
  • __pycache__ folders
  • .pyc compiled files
  • Virtual environment folder
  • IDE configuration files
  • Personal/sensitive data in JSON
Important: Add a .gitignore file to exclude __pycache__, *.pyc, venv/, and .env files.
Submit Your Project

Enter your GitHub username - we will verify your repository automatically

08

Grading Rubric

Your project will be graded on the following criteria. Total: 400 points.

Criteria Points Description
Task Class (OOP) 60 Proper class design, attributes, methods, validation, properties
TaskManager (CRUD) 80 All CRUD operations, filtering, searching, proper error handling
Storage Module 60 JSON persistence, CSV import/export, error handling
Analytics Module 50 Statistics calculations, formatted output, CSV analysis
CLI Interface 60 User-friendly menu, input validation, clear prompts
Code Quality 40 Clean code, docstrings, proper naming, PEP 8 style
Documentation 30 README quality, screenshots, clear instructions
Testing 20 Unit tests for core functionality
Total 400
Grading Levels
Excellent
360-400

Exceeds all requirements

Good
300-359

Meets all requirements

Satisfactory
240-299

Meets minimum requirements

Needs Work
< 240

Missing key requirements

Bonus Points (up to 50 extra)
Colored Output

+15 points for using colorama

Due Date Reminders

+15 points for notification system

Fuzzy Search

+20 points for advanced search

Ready to Submit?

Make sure you have completed all requirements and reviewed the grading rubric above.

Submit Your Project