> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# KPI Tracking

> Monitor configured financial key performance indicators with current values, targets, and trend charts.

The KPI Tracking page displays financial health metrics derived from configured KPI definitions and their historical calculations. It is accessible at route `/fa/analytics/kpis`.

## Overview

The page loads KPI definitions via `useKPIDefinitions(organizationId)` and historical data via `useKPIHistory(organizationId)`. It renders a responsive grid of `KPICard` components, one per configured KPI snapshot.

Each card shows:

* KPI name and status icon: `XCircle` (critical), `AlertTriangle` (warning), `CheckCircle2` (on-target)
* Current value formatted by unit (`currency`, `percent`, `ratio`, `days`, or plain number)
* Target value badge (if configured)
* Change percent (positive green, negative red)
* Category label
* Trend sparkline chart (`KPITrendChart`) if more than one historical data point exists

If no KPIs are configured, an empty state prompts the user to configure definitions in analytics settings.

**Primary hooks:** `useKPIDefinitions`, `useKPIHistory`, `buildKPISnapshots`

**Permission gate:** `fa.analytics.kpis.view` (route level)

## Who it's for

Permission required: `fa.analytics.kpis.view`

## Before you start

* KPI definitions must be configured (SME: confirm where this is done).
* At least one `kpi_history` record must exist for a KPI to show trend data.

## Steps

1. Navigate to `/fa/analytics/kpis`.
2. Review each KPI card for current value, target, and trend.
3. KPIs with `critical` status (XCircle icon) require immediate attention per your organization's thresholds.

## Key concepts

* **KPI Snapshot:** A computed view combining the latest `kpi_history` value with its definition's target and threshold settings.
* **Units:** `currency` (formatted with `formatCurrency`), `percent` (N.N%), `ratio` (N.NN), `days` (N days), plain number.
* **Status levels:** `critical`, `warning`, on-target (default).

## Related

<Columns cols={2}>
  <Card title="Finance & Revenue" icon="building-columns" href="/fa/overview">
    Finance & Revenue core overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index" />
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/fa.tsx
  * src/cores/fa/pages/KPIPage.tsx
  * src/cores/fa/hooks/useKPIs.ts
  * src/cores/fa/components/analytics/KPITrendChart.tsx
  * src/cores/fa/types/analytics.ts
</Accordion>
