Tech Lead Sergey Proshchaev describes a method for validating KPI reports generated by AI using Python and SQL. The approach ensures that each metric in a weekly report is correctly linked to specific data, preventing errors such as using figures from the wrong week or channel.

The system uses a fact table where each record is identified by a unique key containing the start date of the week, the channel, and the metric type. A validator script checks these identifiers against the report requirements, rejecting any claims that reference incorrect periods, missing facts, or unauthorized metrics.

The demonstration uses a CSV dataset covering web and mobile channels. For example, a web report for the week of November 16, 2026, is validated by ensuring the conversion rate of 4.00% is derived from the correct session and order counts for that specific period, rather than the previous week's 5.00% figure.

The validation logic handles edge cases such as attribution windows, where a session starts on one day and a purchase occurs on another. By defining strict rules for data aggregation and using a structured JSON format for claims, the system can distinguish between valid observations and erroneous data entries.