SLA report on a support-ticket export
Computes each ticket's resolution time, compares it to its priority's SLA (P1=4h … P4=72h) and produces a compliance / median table per priority, with flags for anything under target.
Prerequisites
Python 3.9+, pandas
Python
import pandas as pd
t = pd.read_csv("tickets.csv", parse_dates=["ouvert", "resolu"])
SLA_H = {"P1": 4, "P2": 8, "P3": 24, "P4": 72}
t["duree_h"] = (t["resolu"] - t["ouvert"]).dt.total_seconds() / 3600
t["respecte"] = t["duree_h"] <= t["priorite"].map(SLA_H)
synthese = t.groupby("priorite").agg(
tickets=("respecte", "size"),
respect=("respecte", "mean"),
mediane_h=("duree_h", "median"),
)
print("Rapport SLA — support N1, mois courant")
print(f"{'prio':<5} {'tickets':>8} {'respect':>9} {'médiane':>9} objectif")
for prio, r in synthese.iterrows():
drapeau = "" if r["respect"] >= 0.95 else " << sous les 95 %"
print(f"{prio:<5} {r['tickets']:>8.0f} {r['respect']:>8.1%} "
f"{r['mediane_h']:>8.1f}h {SLA_H[prio]}h{drapeau}")Result
Rapport SLA — support N1, mois courant prio tickets respect médiane objectif P1 14 92.9% 3.1h 4h << sous les 95 % P2 47 97.9% 5.4h 8h P3 212 98.6% 9.8h 24h P4 118 100.0% 31.2h 72h
SLASupportgroupbyReporting