From 499a819c9031ed9c2d5e85a8a5c7d6ca05961fce Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 28 Sep 2025 21:50:30 +0200 Subject: [PATCH] Add unique daily stat uploads lineplot --- popcorn.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/popcorn.py b/popcorn.py index 9ed2235..826082c 100644 --- a/popcorn.py +++ b/popcorn.py @@ -202,10 +202,37 @@ def _(df_lazy: pl.LazyFrame): caption="Downloads aggregated per month of the year.", ) ) + _() return +@app.cell +def _(): + df_unique_downloads = ( + pl.scan_ndjson("data/daily/*", include_file_paths="file") + .head(LIMIT_ROWS) # FIXME: take out after debug + .with_columns( + pl.col("file") + .str.replace(r"data/daily/(\d{4}-\d{2}-\d{2}).json", "${1}") + .str.to_date() + .alias("date") + ) + .select(["date", "UniqueInstalls"]) + .collect() + ) + ( + lp.ggplot(df_unique_downloads, lp.aes("date", "UniqueInstalls")) + + lp.geom_line() + + lp.geom_smooth() + + lp.labs( + title="Unique daily uploads", + caption="Daily number of unique providers for package update statistics opting in to popcorn.", + ) + ) + return + + @app.cell def _(): mo.md(