Python

گزارش SLA رو خروجی تیکت‌های پشتیبانی

مدت رفع هر تیکت رو حساب می‌کنه، با SLA اولویتش (P1=4h … P4=72h) می‌سنجه و یه جدول نرخ رعایت / میانه به تفکیک اولویت میده، با پرچم رو موارد زیر هدف.

کاربرد

آماده کردن کمیته‌ی ماهانه‌ی خدمات: نرخ رعایت SLA به تفکیک اولویت، با اعدادی که مستقیم از ابزار تیکتینگ اومده.

پیش‌نیازها

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}")

نتیجه

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

اسنیپت‌های مرتبط

بازگشت به آزمایشگاه داده