> ## 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.

# Document Analytics

> Aggregated analytics dashboard showing document counts by category and status, storage usage, and expiration metrics at /documents/analytics.

The Document Analytics dashboard (`/documents/analytics`) displays aggregated metrics for all documents in the organisation — including count by category and status, total storage, version counts, and documents expiring soon or already expired.

## Overview

The page is gated by `pf.documents.analytics-view`, enforced inside `useDocumentAnalytics` — the hook returns `hasPermission: false` when the user lacks the permission and the component renders an access-denied message. When data is available, four summary cards show total document count (with version count), storage usage (formatted from bytes), documents expiring within 30 days, and the count of already-expired documents. Two charts follow: a pie chart of documents by category and a bar chart of documents by status, both rendered using Recharts with CSS variable-based theme colours.

## Who it's for

Requires permission `pf.documents.analytics-view`.

## Before you start

* You must hold `pf.documents.analytics-view`.
* Analytics are calculated across all documents visible to the current organisation.

## Steps

<Steps>
  <Step title="Open Document Analytics">
    Navigate to `/documents/analytics`. The dashboard loads four summary cards and two charts automatically.
  </Step>

  <Step title="Review summary cards">
    Check total document count, storage usage, expiring soon, and expired counts.
  </Step>

  <Step title="Analyse by category">
    The **Documents by Category** pie chart breaks down the document library by category type.
  </Step>

  <Step title="Analyse by status">
    The **Documents by Status** bar chart shows counts for each document status (draft, in\_review, published, archived, etc.).
  </Step>

  <Step title="Act on expiring or expired documents">
    Navigate to the Documents library to locate expiring or expired documents and take appropriate action.
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Document statuses">
    Statuses tracked include `draft`, `in_review`, `published`, `archived`, `pending_approval`, `approved`, and `rejected`.
  </Accordion>

  <Accordion title="Storage calculation">
    Total storage is the sum of `total_storage_bytes` across all documents and is displayed in human-readable units (B, KB, MB, GB).
  </Accordion>

  <Accordion title="Expiration window">
    "Expiring Soon" counts documents with an expiry date within 30 days of today. "Expired" counts documents past their expiry date.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Platform Foundation" icon="layer-group" href="/pf/overview">
    Platform Foundation overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</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/platform.tsx
  * src/platform/documents/pages/DocumentAnalyticsDashboard.tsx
  * src/platform/documents/hooks/useDocumentAnalytics.ts
</Accordion>
