> Windows To-do App Replica
// Created at: 30-07-2026
[Project Overview]
This application is a Task Management using Python and the Flask framework. Unlike standard, over-engineered web apps that rely on heavy relational SQL databases, this tool leverages an optimized flat-file storage engine (CSV database via Pandas) to execute real-time task mutations. The core system lets users organize tasks into default arrays (Today, Important, All Tasks) as well as dynamically generated Custom Lists. It serves as a centralized workflow controller where an operator can create task streams, edit schedules inline, track progression statuses (Active / Completed), delete records safely, and securely dispatch individual task data payloads across networks directly to email clients via protected SMTP Transport Layer Security (TLS) pipelines.
[_Case Study]
>__Integrated Application Architecture
The schematic tracks the lifecycle of HTTP request vectors passing through security wrappers, manipulating flat-file records, and triggering external network transmissions
+----------------------------------------------------------------------------------+
| INCOMING HTTP REQUEST STREAM |
| Flask intercepts URL routing parameters -> Enforces CSRF Protective Shields|
+----------------------------------------------------------------------------------+
|
+-------------------+-------------------+
| (GET Requests: View Rendering) | (POST Requests: Action Routing)
v v
+---------------------------------------+ +---------------------------------------+
| LAZY DATA INGESTION ENGINE | | MULTIPLE FORM ROUTING GATE |
| Loads spreadsheet entries via Pandas | | Intercepts parameters to determine |
| mapping custom list name definitions | | action: [newtask/edit/delete/mail] |
+---------------------------------------+ +---------------------------------------+
| |
| v
| +---------------------------+
| | MUTATION AND WRITING |
| | Direct flat-file row |
| | manipulation via Pandas |
| +---------------------------+
| |
| (SMTP Integration Vector Activated)
| v
| +---------------------------+
| | SMTP TLS PORTAL GIGABIT |
| | Opens `://gmail.com` |
| | Sends network payload text|
| +---------------------------+
| |
+-------------------+-------------------+
v
+---------------------------------------------------------------------------------+
| RENDER PERSISTENCE LAYER |
| Unifies context maps (date, headers, counters) -> Passes variables to Jinja2 |
+---------------------------------------------------------------------------------+
>__Function Architectural Breakdown
Data Helper Utilities ΓÇó def make_id() Role: Serves as an atomic primary key generator to prevent identity collision states. Mechanics: Reads the data matrix via Pandas, picks a random numeric integer token from 0 to 900, and runs an internal while loop check. If the token matches a pre-existing id, it keeps incrementing until it finds a unique primary key value. ΓÇó def get_csv_data() Role: Handles raw flat-file extraction and null-data mitigation. Mechanics: Calls pandas.read_csv() using the critical parameter keep_default_na=False to prevent the engine from misreading blank cells as faulty string "nan" floats. It packs row elements into an in-memory dictionary of dictionaries. ΓÇó def get_data(name_of_list) Role: Filters task records based on category constraints. Mechanics: Iterates through the output of get_csv_data(), pulling out only the dictionaries whose listname property matches the requested category token string. ΓÇó def length_tasks() & def get_all_tasks_len() Role: Act as analytical tracking metric counters. Mechanics: Loop through the categorical data slices in linear time O(N) to verify if the text body exists. They return raw numeric integers used to render indicators like nr_today_tasks directly on the sidebar. ΓÇó def date_time() Role: Generates a human-readable timestamp string. Mechanics: Pulls active system clock data via datetime.now() and formats it into an explicit string template (e.g., "Sunday, August 09, 2026"). ΓÇó def get_lists_names() Role: A dynamic category collector. Mechanics: Sweeps the entire spreadsheet matrix on launch. It filters out the static categories (today, important) and records unique string names to build a clean list of the user's custom categories. ΓÇó def get_all_tasks() Role: Builds a global fallback array mapping. Mechanics: Compiles all existing records into a unified list. If all task entries are cleared from storage, it appends an empty layout dictionary ({}) to force the frontend to display a clean screen instead of throwing a rendering crash.
def make_id():
'''Generates a random id for each task'''
data = pandas.read_csv("data.csv")
data_id = data['id']
id = random.randint(0,900)
while id in data_id:
id += random.randint(0,900)
return id
def get_data(name_of_list):
'''Returns list of dictionaries for each task in CSV'''
tasks = []
data = get_csv_data()
for index_dict in data:
if data[index_dict]['listname'] == name_of_list:
tasks.append(data[index_dict])
return tasks
def get_csv_data():
'''Reads the csv file and returns a dictionary of dictionaries to be used in get_data()'''
# Pandas reads empty cells as 'nan'
data = pandas.read_csv("data.csv", keep_default_na=False)
tasks = {}
for index, row in data.iterrows():
data_dict = {'listname':row.listname,
'body':row.body,
'date':row.built_date,
'due_date':row.due_date,
'task_status':row.task_status,
'id':row.id}
tasks[index] = data_dict
return tasks
def length_tasks():
today_len = 0
important_len = 0
today_data = get_data('today')
important_data = get_data('important')
for data_dict in today_data:
if data_dict['body']:
today_len += 1
for data_dict in important_data:
if data_dict['body']:
important_len += 1
# all_tasks = today_len + important_len
return (today_len, important_len)
def date_time():
now = dt.datetime.now()
formatted_date = now.strftime("%A, %B %d, %Y")
return formatted_date
def get_lists_names():
'''Returns list of names for all custom lists made by user'''
data = pandas.read_csv("data.csv")
lists_names = []
for index, row in data.iterrows():
if row.listname not in ['today', 'important'] and row.listname not in lists_names:
lists_names.append(row.listname)
return lists_names
def get_all_tasks():
'''Returns a list of dictionaries, one for each task in the csv'''
all_tasks = []
data = get_csv_data()
for index_dict in data:
if data[index_dict]['body']:
all_tasks.append(data[index_dict])
else:
# Append an empty dictionary for the case when all tasks are deleted and must be rendered an empty screen
all_tasks.append({})
return all_tasks
def get_all_tasks_len():
all_tasks_len = 0
data = get_csv_data()
for index_dict in data:
if data[index_dict]['body']:
all_tasks_len += 1
return all_tasks_len
>__Flask View Routes and Controllers
ΓÇó @app.route("/") [index] Role: The primary GET request view controller that serves the default entry point. Mechanics: Queries the persistent flat-file datastore for elements labeled 'today', packages the items, pulls system clock values, and serves the core variables to the template layer (index.html). ΓÇó @app.route("/<list_name>") [switch_views] Role: Handles dynamic view routing across categories .Mechanics: Intercepts category string parameters passed directly via URL parameters. It uses a clean conditional tree (if/elif) to redirect users to the index view if they click today, filter entries if they select important, or load specific custom columns if they select a custom category. ΓÇó @app.route("/custom-list", methods=['POST']) [create_new_list] Role: Spawns new custom category node items. Mechanics: Intercepts user inputs from request.form, assigns an empty data template containing a freshly compiled primary key tracking token, and invokes an incremental spreadsheet save operation (mode='a') to append the new row securely without modifying the existing content. ΓÇó @app.route("/<list_name>", methods=['POST']) [manage_data] Role: The core multi-form action router and pipeline modifier. Mechanics: This single route acts as an administrative gateway, using membership checks (in request.form) to distinguish between different forms submitting to the same path. It dynamically executes tasks across five separate operational sub-branches: > Add task: Detects if a list is empty or pre-populated. It either fills empty placeholder cells in-place (mode='w') or appends a new data row (mode='a'). > Complete task: Looks up the task id, updates the task_status cell token directly to 'Completed', and flushes the modified dataframe back to disk storage. > Send to mail: Implements a secure network tunnel. It extracts the raw task string text, packages it into a secure string template, hooks into the Google SMTP server gateway (://gmail.com), and forces an encrypted Transport Layer Security (TLS) connection handshake via .starttls() to transmit the payload safely. > Delete task: Evaluates list lengths. If multiple records exist, it drops the row instantly using a boolean expression filter. If it targets the final remaining item, it appends an empty placeholder category row first before executing the deletion pass, preventing layout crashes. > Edit task: Implements server-side parameter verification (editTaskForm). Upon submission, it modifies the targeted cell row, updates timestamp formats (.strftime()), and commits the changes back to storage. ΓÇó @app.route("/search results", methods=['POST']) [search_task] Role: The text token search and query interface handler. Mechanics: Runs a nested string parsing sweep across the spreadsheet text layers using .split(). If an alphanumeric word matches the exact query parameter, it loads the data rows into a temporary lookup dictionary using a for/else structure, sending the compiled matches to the interface layout.
@app.route("/")
def index():
today_tasks = get_data('today')
heading = 'Today'
lists_names = get_lists_names()
return render_template('index.html',
date=date_time(),
heading=heading,
nr_today_tasks=length_tasks()[0],
nr_important_tasks=length_tasks()[1],
nr_all_tasks=get_all_tasks_len(),
tasks=today_tasks,
custom_list_names = lists_names,
bg_id = 'myPage')
@app.route("/<list_name>")
def switch_views(list_name):
''' Swiches views for the sidebar buttons'''
''' Takes variable from the url_for from anchor tag in index.html'''
all_tasks = get_all_tasks()
lists_names = get_lists_names()
if list_name == 'today':
return redirect(url_for('index'))
elif list_name == 'important':
important_tasks = get_data(list_name)
heading = important_tasks[0]['listname'].capitalize()
return render_template('index.html',
date=date_time(),
heading=heading,
nr_today_tasks=length_tasks()[0],
nr_important_tasks=length_tasks()[1],
nr_all_tasks=get_all_tasks_len(),
tasks=important_tasks,
custom_list_names = lists_names,
bg_id = 'myPage'
)
# Renders index.html for ALL TASKS
elif list_name not in ['today', 'important'] and list_name not in lists_names:
heading = 'All tasks..'
return render_template('index.html',
date=date_time(),
heading=heading,
nr_today_tasks=length_tasks()[0],
nr_important_tasks=length_tasks()[1],
nr_all_tasks=get_all_tasks_len(),
tasks=all_tasks,
custom_list_names = lists_names,
bg_id = 'myPage'
)
# Renders index.html with the tasks from the selected CUSTOM list
elif list_name in lists_names:
list_tasks = get_data(list_name)
for data_dict in list_tasks:
heading = data_dict['listname'].capitalize()
return render_template('index.html',
date=date_time(),
heading=heading,
nr_today_tasks=length_tasks()[0],
nr_important_tasks=length_tasks()[1],
nr_all_tasks=get_all_tasks_len(),
tasks=list_tasks,
custom_list_names = lists_names,
bg_id = 'myPage'
)
@app.route("/custom-list", methods=['POST'])
def create_new_list():
data = request.form
new_list_name = data['addlistform']
task = ''
task_date = ''
until = ''
status = 'Active'
id = make_id()
df = pandas.DataFrame([[new_list_name, task, task_date, until, status, id]],
columns=['listname', 'body', 'built_on', 'due_to', 'task_status', 'id'])
df.to_csv("data.csv", mode='a', index=False, header=False)
heading = new_list_name.capitalize()
lists_names = get_lists_names()
tasks = get_data(new_list_name)
return render_template('index.html',
date=date_time(),
heading=heading,
nr_today_tasks=length_tasks()[0],
nr_important_tasks=length_tasks()[1],
nr_all_tasks=get_all_tasks_len(),
custom_list_names = lists_names,
tasks=tasks,
bg_id = 'myPage'
)
>__Client-Side Interface Optimization Layer
To ensure an interactive user experience and avoid unnecessary configuration reload requests to the Flask backend, the system deploys a lightweight, performance-tuned optimization layer written in Native JavaScript (DOM API). This script handles layout style modifications, state persistence across page renders, and utility actions entirely within the client runtime thread. Dynamic Wallpaper with Session Storage Persistence The application features a visual theme customization panel managed by explicit, event-driven style injection routines (background1() through background13()). ΓÇó The Element Mutation: When a choice node is clicked, the engine bypasses the server and mutates the container element's layout properties directly via the document identity selector: document.getElementById("myPage").style.background. ΓÇó The Persistence Engine: To prevent the user's custom layout theme from resetting every time Flask returns a new view template via render_template(), the script integrates the HTML5 key-value database: sessionStorage.setItem("background", "url('...') center center / cover");