How to Automate Deadline Tracking and Escalation
Track deadlines automatically and escalate when tasks are at risk.
Jay Banlasan
The AI Systems Guy
Deadlines get missed because nobody watches them closely enough. I built a system to automate deadline tracking and escalation alerts that monitors every deadline, sends progressive warnings, and escalates to management when tasks go overdue. The system does the nagging so you do not have to.
Graduated alerts. First a nudge. Then a warning. Then an escalation.
What You Need Before Starting
- Python 3.8+
- SQLite for deadline tracking
- Slack or email for notifications
- Escalation rules per urgency level
Step 1: Define Escalation Rules
ESCALATION_RULES = {
"warning": {"days_before": 3, "notify": ["assignee"]},
"urgent": {"days_before": 1, "notify": ["assignee", "team_lead"]},
"overdue": {"days_after": 0, "notify": ["assignee", "team_lead", "manager"]},
"critical": {"days_after": 3, "notify": ["assignee", "team_lead", "manager", "director"]}
}
Step 2: Set Up the Deadline Database
import sqlite3
from datetime import datetime
def init_deadline_db(db_path="deadlines.db"):
conn = sqlite3.connect(db_path)
conn.execute("""
CREATE TABLE IF NOT EXISTS deadlines (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT,
assignee TEXT,
team_lead TEXT,
manager TEXT,
due_date TEXT,
status TEXT DEFAULT 'active',
priority TEXT DEFAULT 'normal',
last_escalation TEXT,
completed_at TEXT
)
""")
conn.commit()
return conn
Step 3: Check All Deadlines
from datetime import timedelta
def check_deadlines(conn):
today = datetime.now()
active = conn.execute(
"SELECT id, title, assignee, team_lead, manager, due_date, last_escalation FROM deadlines WHERE status='active'"
).fetchall()
alerts = []
for row in active:
deadline_id, title, assignee, lead, mgr, due_str, last_esc = row
due = datetime.strptime(due_str, "%Y-%m-%d")
days_until = (due - today).days
current_level = determine_escalation_level(days_until)
if current_level and current_level != last_esc:
contacts = resolve_contacts(current_level, assignee, lead, mgr)
alerts.append({
"id": deadline_id, "title": title, "level": current_level,
"days_until": days_until, "contacts": contacts
})
conn.execute(
"UPDATE deadlines SET last_escalation=? WHERE id=?",
(current_level, deadline_id)
)
conn.commit()
return alerts
def determine_escalation_level(days_until):
if days_until < -3:
return "critical"
elif days_until < 0:
return "overdue"
elif days_until <= 1:
return "urgent"
elif days_until <= 3:
return "warning"
return None
def resolve_contacts(level, assignee, lead, manager):
rule = ESCALATION_RULES[level]
contact_map = {"assignee": assignee, "team_lead": lead, "manager": manager, "director": "[email protected]"}
return [contact_map.get(r, r) for r in rule["notify"]]
Step 4: Send Escalation Notifications
def send_alerts(alerts):
level_templates = {
"warning": "Heads up: '{title}' is due in {days} days.",
"urgent": "URGENT: '{title}' is due tomorrow.",
"overdue": "OVERDUE: '{title}' is past due by {days} day(s).",
"critical": "CRITICAL: '{title}' is {days} days overdue. Immediate action required."
}
for alert in alerts:
days = abs(alert["days_until"])
msg = level_templates[alert["level"]].format(title=alert["title"], days=days)
for contact in alert["contacts"]:
print(f"[{alert['level'].upper()}] -> {contact}: {msg}")
Step 5: Generate Deadline Dashboard
def deadline_dashboard(conn):
today = datetime.now().strftime("%Y-%m-%d")
overdue = conn.execute(
"SELECT COUNT(*) FROM deadlines WHERE status='active' AND due_date < ?", (today,)
).fetchone()[0]
due_this_week = conn.execute(
"SELECT COUNT(*) FROM deadlines WHERE status='active' AND due_date BETWEEN ? AND ?",
(today, (datetime.now() + timedelta(days=7)).strftime("%Y-%m-%d"))
).fetchone()[0]
on_track = conn.execute(
"SELECT COUNT(*) FROM deadlines WHERE status='active' AND due_date > ?",
((datetime.now() + timedelta(days=7)).strftime("%Y-%m-%d"),)
).fetchone()[0]
report = f"# Deadline Dashboard\n\n"
report += f"Overdue: {overdue}\n"
report += f"Due this week: {due_this_week}\n"
report += f"On track: {on_track}\n"
return report
Schedule the check to run multiple times per day:
0 9,13,17 * * * python3 /path/to/deadline_tracker.py
What to Build Next
Add historical analysis that shows which people and which types of work consistently miss deadlines. Patterns in the data tell you whether the problem is capacity, estimation, or accountability.
Related Reading
- Identifying Your Biggest Bottleneck - deadlines slip at bottlenecks
- The Feedback Loop That Powers Everything - deadline tracking as feedback
- Building Your First Automation: A Complete Guide - automation fundamentals
Want this system built for your business?
Get a free assessment. We will map every system your business needs and show you the ROI.
Get Your Free Assessment