Journal

Your AI assistant and dashboard should give the same answer

Different dates, filters and definitions can turn the same data into conflicting answers. Here is how to make the comparison fair.

Your dashboard says 75% of invoices have been paid. The AI assistant says 90%. Both answers look precise, and neither explains the difference.

Changing the prompt might make the numbers match once. A better starting point is to check what each answer actually measures.

An assistant connected through the Model Context Protocol (MCP) can call reporting tools in your application. That connection gives it access to data. Agreement with the dashboard still depends on the definitions, filters and calculations behind those tools.

Agree on the question before comparing the number

Take a fictional invoice report. The finance team wants to know what proportion of the invoices issued in June have been paid in full.

There are twenty eligible invoices, fifteen of them paid. The answer is 75%. To reproduce it, the reporting tool needs to know which issue dates count, whether cancelled invoices are excluded, how partial payments are treated and when payment status was last updated.

An assistant given a list of recent payments could answer a different question: how much money arrived in June. That includes payments against older invoices. Even a perfect calculation would produce an unsuitable answer.

A useful metric definition names the population and the calculation together: paid-in-full invoices divided by eligible invoices issued during the selected period. It also defines the empty case. When there are no eligible invoices, “no invoices in this period” is more useful than a misleading 0%.

Put that definition somewhere the dashboard, exports and AI tools can all use. Otherwise, each interface gradually develops its own meaning for the same label.

Share the calculation and keep the permission checks

For a Django application, we would usually start by finding the function or query that already powers the report. Check it against the agreed definition, then make it available through a small reporting service used by both interfaces.

That service should receive the authenticated user's access context and validated filters. It should return a calculated result, rather than asking the assistant to download every invoice and do the arithmetic itself.

Django supports aggregation over filtered querysets. The order of filtering and aggregation can affect the result, so changes need tests against the intended population. The Django aggregation guide covers those distinctions.

Sharing code also needs care around access. A finance administrator and a regional manager may correctly see different totals. The comparison should use the same user permissions and the same authorised scope. A tool must check that the requested team or account is accessible, even when the dashboard would never show an unauthorised option.

A shared service gives you one place to fix a calculation. It still needs checks that the calculation is right.

Return the context that makes the answer usable

A bare percentage leaves too much for the assistant to infer. For the fictional invoice report, return the paid-in-full invoice count (15), the eligible invoice count (20), the definition of the rate, the selected period and the reporting timezone.

Include the data refresh time as well. “As of 09:00” explains why a payment entered at 09:15 is missing from a report that updates hourly. If the assistant reads a live database while the dashboard reads a reporting snapshot, either align them or make that difference visible.

Dates deserve particular attention. “June” might mean invoices issued in June, payments received in June, or balances outstanding at the end of June. A reporting timezone also changes which records fall near midnight. The tool should require the relevant period or return the exact default it applied.

In a timezone-aware Django application, use aware datetimes and define how the business reporting window maps to stored timestamps. Django's timezone documentation explains the distinction between storage and presentation timezones. A month in the finance team's timezone should have the same boundaries wherever it is queried.

Also distinguish a summary from a page of records. Fifty returned invoices may be the first page of five hundred. An assistant cannot safely treat the page length as the total. Return the matched count where permitted, a continuation cursor when relevant, and an explicit indication if a result is incomplete.

Test the two routes with the same evidence

Create a small dataset where the expected answers can be checked by hand. Include an invoice at each date boundary, a partial payment, a cancelled invoice and an empty period. Add records belonging to another account to test that they never enter the result.

For the same authorised user, period and data snapshot, compare the dashboard's underlying report result with the tool's result. Compare the numerator, denominator and filters as well as the displayed percentage. That catches errors hidden by rounding.

Then ask the assistant realistic questions. Include “paid invoices in June” and the less precise “how did collections go last month?” The first should reach the right report. The second may need a clarification before any number is presented. Check the tool calls and their arguments alongside the final answer.

Keep these examples when the reporting logic changes. They become a way to check a new assistant model, a revised tool description or an ordinary application update against the same business expectations.

When we connect AI to an existing product, this is part of the integration work: tracing a number back to its source and making its meaning available to every interface that uses it.