CoolFace
Apppublic

rlyle31/PM-Prediction

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes
App README

AMETEK Service Opportunity Dashboard

Predicting Customer Preventive Maintenance and Service Agreement Adoption

Upload the "4. History Report โ€” AI Report" Excel file to generate a standalone HTML dashboard with three tabs:

TabPurpose
๐Ÿ“Š DashboardEvery account and unit, with PM & CSA likelihood, lapsed detection and seasonal patterns
๐ŸŽฏ Priority ListPM-only ranked call list โ€” who to contact first, with win-back scoring for lapsed accounts
๐Ÿ’ฐ CSA PipelineCSA readiness for accounts already servicing โ‰ฅ70% of their fleet

All three tabs are derived from the same account and unit objects, so activity, pattern, due flag, streak and trend can never disagree between them.

Files

FileRole
engine.pyAll scoring logic. Tunables live in the CONFIG block at the top.
app.pyHTTP layer โ€” splices engine output into the templates.
template_header.htmlPage shell, styles, tab bar, all three tab layouts.
template_footer.jsAll JavaScript (dashboard + Priority List + CSA Pipeline).

app.py injects the datasets between the header and the footer, so both templates must stay free of `</script>` and of any `JSON.parse` data declarations. A stray </script> closes the block early and everything after it renders as visible text on the page.

API Endpoints

  • โ€”GET /api/health โ€” Health check
  • โ€”POST /api/generate โ€” multipart upload, returns the HTML dashboard
  • โ€”POST /api/generate-json โ€” {file_base64, filename} โ†’ {download_url, status} (used by Power Automate)
  • โ€”GET /download/{filename} โ€” Serve a previously generated dashboard

Scoring summary

  • โ€”PM1 annual โ†’ PM5 5-year โ†’ PM10/PCBR 10-year. PM10 and PCBR are tracked independently; PCBR is often deferred a year and bundled with a PM1.
  • โ€”Pattern (Full Schedule / Milestone Only / No History) is a behavioural label only โ€” it never drives the recommendation.
  • โ€”Recommendation defaults to PM1, escalating to a milestone only when that milestone is overdue or 4.5+ years have passed since the last major PM.
  • โ€”Trend compares completed years only (2024 vs 2025) as a service rate. The current year is partial, so it counts as a positive signal but never as evidence of decline.
  • โ€”Streak requires activity in the current or last year, so a historical run never reads as a current streak.
  • โ€”Only rows carrying a Product Type are treated as assets โ€” the report also lists accounts with no in-scope equipment.