Insights Tool
Overview
Section titled “Overview”The Insights tool provides a single-page analytics dashboard for workforce metrics. It uses a summary + expand pattern: key KPI cards are always visible, with six collapsible sections that reveal detailed charts when expanded.
Data is sourced from the users table (employee fields synced from Xero) and pay_summaries (salary data). Charts are rendered with Recharts.
Permissions
Section titled “Permissions”| Access Level | Can View | Can Manage |
|---|---|---|
| Executive | Yes | Yes |
| Head | Yes | No |
| Manager | Yes | No |
| Lead | No | No |
| Employee | No | No |
All data shown is aggregate — no individual employee data is exposed in insights.
Page Layout
Section titled “Page Layout”KPI Summary Row
Section titled “KPI Summary Row”Six cards always visible at the top:
- Total headcount — active employees, net growth in period
- Turnover rate — percentage of leavers vs headcount, average tenure
- Median salary — with min/max range
- Average age — from date of birth data
- Avg span of control — direct reports per manager, employee-to-manager ratio
- Locations — count of distinct locations
Filters
Section titled “Filters”- Date range — from/to date pickers (defaults to last 12 months)
- Location — dropdown filter populated from location data
- Gender — optional filter
Expandable Sections
Section titled “Expandable Sections”Each section shows inline summary stats when collapsed. Click to expand and reveal charts.
Headcount
Section titled “Headcount”- Area chart: total headcount over time (monthly)
- Stacked bar chart: starters vs leavers per month
Retention
Section titled “Retention”- Line chart: turnover rate over time
- Bar chart: tenure distribution (0-6mo, 6-12mo, 1-2yr, 2-5yr, 5yr+)
Diversity
Section titled “Diversity”- Donut chart: gender breakdown with percentages
- Manager gender breakdown
- Bar chart: age distribution by decade
Compensation
Section titled “Compensation”- Min/median/max salary display
- Bar chart: salary band distribution (20k buckets)
- Employment basis breakdown (full-time, part-time, casual, contractor)
Org Structure
Section titled “Org Structure”- Bar chart: span of control distribution
- Team sizes list sorted by size
Location
Section titled “Location”- Donut chart: location breakdown
- Table with location name, count, and percentage
Data Sources
Section titled “Data Sources”Employee fields are populated via Xero Payroll sync during the /api/pays/refresh flow:
start_date,end_date,employment_status— from XeroStartDate,TerminationDate,Statusgender,date_of_birth— from Xero employee recordlocation— derived from XeroHomeAddress.RegionorHomeAddress.Cityemployment_basis— from XeroEmploymentType- Salary data — from
pay_summaries.annual_salary(cached from Xero)
Fields can also be set manually via the admin user management UI.
Components
Section titled “Components”| Component | Purpose |
|---|---|
insights-page.tsx | Main page with filters, KPI row, and section layout |
insight-section.tsx | Reusable collapsible section wrapper |
headcount-chart.tsx | Headcount area chart + starters/leavers bar chart |
retention-charts.tsx | Turnover line chart + tenure distribution |
diversity-charts.tsx | Gender donut + age distribution bar chart |
compensation-charts.tsx | Salary bands + employment basis |
structure-charts.tsx | Span of control + team sizes |
location-chart.tsx | Location donut + breakdown table |