Documentation
Application Structure
- app.py defines Flask routes for home, upload, dashboard, download, predictive analytics, explore, local AI and Groq AI.
- auto_analytics.py detects column types, generates KPI cards, charts and rule-based insights for any dataframe.
- predictive_analytics.py contains Flight Risk, Headcount Forecast and Pay Equity analysis logic.
- local_ai.py provides offline question interpretation, dataset detection, intent detection, grouping, aggregation and chart-ready answers.
- hr_tools.py exposes dataset tools for the optional Groq assistant.
- templates/ contains the Streamlit-like Flask UI pages; static/style.css provides the sidebar, cards, filters, chat and chart styling.
Data Inputs
The Python analytics app supports CSV, XLS and XLSX uploads. Excel workbooks with multiple sheets are loaded as separate datasets. The sample bundle includes employees, attrition, monthly_headcount and time_to_hire datasets.
The Cloudflare sandbox mirrors the workflow using static JavaScript and CSV upload, because Cloudflare Pages does not run Python server code.
Dashboard route
Applies categorical filters, produces KPIs, auto insights, generated charts, summary statistics and raw preview tables.
Predict route
Switches between Flight Risk, Headcount Forecast and Pay Equity using required HR datasets and cached model results.
Explore route
Builds grouped aggregate tables and chart views using selected group, metric, aggregation and chart options.
Local AI route
Keeps question history, shows interpretation steps and returns text, tables and charts without external APIs.
Groq route
Optional API-powered assistant; disabled by default unless a secure Groq key is provided on the Flask host.
Download route
Exports the active dataset or risk queue as CSV for follow-up action.