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

# Outcome Metering

> Count finished cases from your events and AI traces, check whether they succeeded, and bill from fixed monthly numbers

**Outcome Metering** turns the events and AI traces DataFramer already stores into **cases**: one row for each finished item, such as one completed security questionnaire. Each month becomes a month of the **ledger** whose numbers lock once they are final, so you can bill your own customers from them. Find it under **Workflows → Overview**.

## Concepts

* **Workflow**: one kind of finished item you count, for example "Questionnaire completed", with the settings below.
* **Case**: one instance of a workflow, such as one questionnaire.
* **Outcome**: the result of a case: **Successful**, **Not successful**, or **Pending** while it can still change.
* **Id**: the [field](https://www.dataframer.ai/docs/user-signals/fields-and-linking.md#fields) that holds the id of one case, for example "Questionnaire id", read from `properties.questionnaire_id` on events and `metadata.questionnaire_id` on AI traces. All events and AI traces with the same value form one case. With **Journey id** as the id and the default linking rule, each journey is one case.
* **Account** (optional): the field that holds your own customer's id, for example a tenant id. The ledger can be split by it; cases without one still count in the totals.
* **Which cases count** (optional): every case counts, unless you add conditions it must meet, for example "the event `questionnaire_submitted` happened", or with NOT, "… with `is_test` = true" to leave out test cases.
* **When a case ends**: a case ends after **7 days with no new events or AI traces** for its id (you can change the number). Its **last activity**, the time of its last event or AI trace, decides the month.
* **Successful when** (optional): conditions on events and AI traces, for example "the event `questionnaire_accepted` happened", plus [AI judge conditions](#ai-judge-conditions). A case is **Successful** when the conditions hold and every AI judge condition is met.

## Set up a workflow

Create one under **Workflows → Overview**, on the **Workflows** tab, with **New workflow**. Only company admins create or change workflows.

The conditions use the [condition builder of dashboard widgets](https://www.dataframer.ai/docs/journeys/dashboards.md#conditions), sequences included. **Count cases from** is the first month to count, and it cannot be changed afterwards; pick a later month if older events and AI traces do not carry the id yet.

Each save makes a new version and counts again every month that is not locked; locked months keep their version. **Archive** stops a workflow from counting new cases, and its locked months stay in the ledger.

## Statuses, months and locking

The **Cases** tab lists every case with its workflow, status and outcome. You can filter it by workflow, status, month, account and outcome. A dashboard's **Open full page** also adds **Completed after** and **Completed before**, which bound the last activity; remove their chips to see every case again.

A case's page shows when it **Started** (its first event or AI trace), its **Last activity**, and when it is finalized, then its **Time to finish**: the time from its first event or AI trace to its last activity, so far while it is updating. If its first event or AI trace is no longer stored, Started reads "Not recorded" and there is no time to finish.

A case is **Updating** until its days with no new events or AI traces have passed, and new events and AI traces can still change its outcome and its month. One day later it is **Finalized**, once DataFramer has pulled the latest AI traces and scored the AI judge conditions. If a project's traces cannot be pulled for a day, it is finalized anyway, with a warning that names the project.

An admin can end a case early with **Finalize now**; events and AI traces that arrive later no longer count.

A case belongs to the month of its last activity, in UTC. A workflow's numbers for a month lock one day after the month ends, once all its cases for that month are finalized. Each workflow locks on its own, and locked numbers never change.

**Ledger** shows each workflow's cases for one month, and how many are finalized and successful, for all accounts or one. **Export** downloads the totals as a CSV, and one CSV per workflow with a line per case.

### Cases found late

A case whose event or AI trace arrives after its month locked, for example from a late import, counts in the first month that is not locked yet, marked **found late** with its real date. A locked month never changes, and no case is counted twice.

## A workflow's page

Select a workflow's card under **Workflows → Overview** to open its page. Its tabs:

* **Health**: how the workflow is doing over the last 7, 30 or 90 days. It shows cases per day or week, the success rate (also per day or week), the median time to finish, the cases still updating, and how each success condition ends. Select a number to list the cases behind it. A workflow without **Successful when** conditions has no success rate or success conditions here.
* **Cases**: this workflow's cases, with the same search and filters as the Cases tab.
* **Sources**: each source that sent this workflow's events or AI traces in the last 7 days, and what share of that source's records carry the workflow's id. A low share means the source mostly sends records without the id field.
* **Definition**: the workflow's settings, where admins change and archive it, with the list of its versions.
* **Ledger**: this workflow's monthly numbers, one month at a time, with its cases as CSV.

## See your workflows on a dashboard

To follow a workflow over time, add a widget over its cases to a [dashboard](https://www.dataframer.ai/docs/journeys/dashboards.md#workflow-cases): how many cases end each day or week, their success rate, their time to finish, or, with a [Success conditions tile](https://www.dataframer.ai/docs/journeys/dashboards.md#the-success-conditions-tile), how each success check ends. Select a number to list the cases behind it.

## AI judge conditions

An AI judge condition scores the AI traces of a case with one of your [judges](https://www.dataframer.ai/docs/judges/overview.md) and compares the score with a number from 0 to 1, for example "at least 0.8". It scores one kind of AI trace (one trace name) or all of them, overall or on one dimension; with several AI traces, the average or the lowest score counts.

Each AI judge runs once per case, when it is finalized, so later judge edits never change finished cases. Judge calls are charged to your company's AI usage. AI traces too large to judge are left out. If no trace can be scored, or a judge call keeps failing (for example on your AI spend limit), the condition is not met; the case is still finalized.

## Customer-hosted deployments

For companies whose data stays in their own cloud account, Outcome Metering counts cases in the same way, with these differences:

* AI judge conditions are scored by your data plane, so a case with one is finalized up to about 10 minutes later. While your data plane is down or busy, the case waits for it instead of failing the condition. If a judge call fails there, the case page says so without the provider's error text.
* Conditions on an event property work only for properties [copied to DataFramer](https://www.dataframer.ai/docs/deployment.md#user-signals-in-a-customer-hosted-deployment). The id and the account can be read from any property: your data plane reads them.
* A new or changed workflow counts stored cases after about 15 minutes, because your data plane reads the ids again.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.