Somesh Zanwar.

Work / 05

Metric Decomposition Engine

DAU dropped 12% on Monday. Why?

Summary

Takes an event metric across two periods, breaks the change down by dimension, ranks each segment's share of the movement and writes a plain-English incident report. It automates the most common ad-hoc request a product analyst gets.

2026 · Public repo, live demo

PythonPostgreSQLpandasSQLAlchemyStreamlitJinja2
How it flowsOne request or record, start to finish
  1. GitHub Archivehourly public GitHub events
  2. PostgreSQLevents loaded by a Python pipeline
  3. Dimensional splitactor, repository, organisation
  4. Contribution rankingeach segment's change as a share of the total change
  5. Incident reportsummary, breakdown, root-cause hypothesis, next steps
What I built
  • A decomposition engine that compares a baseline and a comparison period and groups the change by each dimension.
  • Contribution ranking: absolute change per segment, expressed as a percentage of the total change, with the largest named as the root-cause hypothesis.
  • A report generator that turns the ranking into an executive summary and next steps a stakeholder can read.
  • A Streamlit app so the same analysis is a tool someone can run, not a script.
DecisionsWhat I chose, what I passed on, why
Real GitHub Archive data
over: Synthetic data

Real scale and mess, and known events such as outages work as natural test cases.

What broke

Segments that exist in only one period

The calculation is simple. The edge cases were not: segments that appear in only one of the two periods, and dimensions with very high cardinality, both needed deliberate handling. The report taught me the harder part of the work is translating a ranking into something a non-technical reader can act on.

Real vs simulatedWhat this does and does not show
The data is real. The sample report in the README is labelled illustrative. The engine compares two points in time and does not test whether a segment's change is statistically significant.
Next
  • Time-series decomposition instead of two-point comparison.
  • Significance testing at segment level.
  • Anomaly detection to trigger an investigation without picking dates by hand.