# Data Quality

> Find event changes in pre-release builds. Most data quality checks run once data is in the warehouse; AutoDocs compares a pre-release build's events with production so problems are fixed before release.

A use case for [AutoDocs](https://aggregations.io/autodocs.md), using the [Versions Explorer](https://aggregations.io/autodocs/versions-explorer.md).

## Comparing a beta with production

Send events from QA or beta builds to the same ingest as production, with a pre-release version like `3.0.0-beta`. When it starts sending, the Versions Explorer compares it with the current production version. No tests to write: the comparison is against what production actually sends, so there's no expected schema to maintain.

Example: a refactor changed `order_id` to a number, and the new checkout screen sends the same `cart.currency` (1 distinct value instead of 14) for every user. In production these would break joins on order ID and misreport revenue by currency.

## Problems it catches

These pass code review and break a dashboard a week later:

| Property | Before → after | What breaks |
| --- | --- | --- |
| `$.order_id` | string → number | Joins on order ID against your backend tables stop matching |
| `$.cart.currency` | 14 distinct → 1 distinct | A hardcoded default replaced the real value; revenue by currency is wrong |
| `$.error_msg` | on 0.4% of events → 12% | A new error path fires far more often |
| `$.session_id` | 0% null → 18% null | Events sent before a session starts; sessions undercount |
| `$.items` | 2% empty → 31% empty | Carts serialized before items load; item metrics drop |
| `$.referrer` | present → missing | A refactor dropped attribution; marketing reports go blank |

## Shape and volume

AutoDocs checks an event's shape. To catch an event that stops firing, pair it with [Real-Time Metrics](https://aggregations.io/real-time-metrics.md): a filter counting events by `@.app.version` shows a new release's volume within minutes, and a [Grafana alert](https://aggregations.io/real-time-metrics/grafana.md) can tell you when it drops. Each event in the [Events Explorer](https://aggregations.io/autodocs/events-explorer.md) also shows 90 days of daily volume.

## Fitting it into a release

1. Point QA and beta builds at the production ingest with a pre-release version.
2. Before shipping, open that version in the Versions Explorer.
3. Review its event changes alongside the rest of the release.
