Appearance
Weekly Analytics Logic
The weekly analytics package produces FreightTiger's TMS leadership report from Pylon data. It is deterministic up to the summary stage: data pull, classification, SLA breach, health, and red flags are computed before any LLM text generation.
Pipeline Stages
| Stage | Script | Output |
|---|---|---|
| Pull Pylon | scripts/01_pull_pylon.py | accounts.json, issues_4w.json, issues_1w.json, manifest.json |
| Compute metrics | scripts/02_compute_metrics.py | metrics.json |
| Generate summaries | scripts/03_generate_summaries.py | summaries.json |
| Render report | scripts/04_render_report.py | reports/{date}/report.html, reports/{date}/report.md |
| Publish | scripts/05_publish.sh | Staticrypt-encrypted Cloudflare Pages archive |
Pull Logic
The pull step:
- Loads
PYLON_API_KEYfrom.envor environment. - Resolves current Pylon enum slugs for
System Issue / BugandNew Feature Request. - Pulls all accounts from Pylon.
- Keeps accounts where
business_line_for_customer_account = tms. - Keeps tiers: Platinum, Gold, Silver, Bronze.
- Extracts tier, MRR, active modules, and CSM lead.
- Pulls issues created in the last 28 days.
- Joins issues to the kept accounts.
Metric Logic
The metrics step:
- Classifies each issue as bug, feature request, or other.
- Resolves severity from
tms_severity. - Falls back from
prioritywhen severity is missing:- urgent -> P1
- high -> P2
- medium -> P3
- low -> P3
- Applies SLA policy from
config/sla_policy.yml. - Uses native
resolution_secondswhere available. - Falls back to
resolution_timeorupdated_atminuscreated_atfor closed tickets. - Uses open-ticket age for unresolved tickets.
- Marks breach when elapsed hours exceed SLA target hours.
SLA Policy
Bug SLA is tier and severity based. Feature request SLA is tier based and converted from days to hours.
| Tier | Outage | P1 | P2 | P3 | Feature request |
|---|---|---|---|---|---|
| Platinum | 4h | 24h | 72h | 168h | 30d |
| Gold | 8h | 48h | 120h | 240h | 45d |
| Silver | 24h | 120h | 240h | 360h | 60d |
| Bronze | 48h | 240h | 360h | 720h | 90d |
Health Score
Health is bug-only and severity-weighted.
| Severity | Weight |
|---|---|
| outage | 10 |
| P1 | 7 |
| P2 | 4 |
| P3 | 2 |
text
health = sum(severity_weight * on_time_flag) / sum(severity_weight) * 100Feature request on-time performance is reported separately and does not affect the health score.
Accounts with no evaluable bugs
Accounts with zero evaluable bugs, or only bugs whose severity cannot be resolved, have health = null and do not contribute to tier averages.
Red Flags
The package computes mechanical red flags:
- Open outage/P1 bugs with no assignee.
- Accounts with 100 percent bug breach and at least two evaluable bugs.
- Modules with bug breach above 60 percent and at least three evaluable bugs.
- Open bugs aged 20 or more days.
These are the primary grounding inputs for the LLM action synthesis.
Summary Logic
The summary step uses local Ollama:
| Property | Value |
|---|---|
| Endpoint | http://localhost:11434/api/generate |
| Model | qwen3:8b |
| Temperature | 0.2 |
| Scope output | Three concerns per scope |
| Final synthesis | Three or four actions each for Account Managers, Engineering, and Product |
The script writes summaries.json incrementally so interrupted runs can resume.
Render Logic
The renderer:
- Loads metrics, summaries, Pylon URL templates, module labels, and Jinja templates.
- Converts module slugs to friendly labels.
- Linkifies valid Pylon ticket numbers.
- Linkifies known account names using account ids from the snapshot.
- Linkifies configured tier views.
- Removes LLM-invented ticket references when the ticket number is not present in
issues_4w.json.