-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add category and rollup stats #576
Conversation
🦋 Changeset detectedLatest commit: 6955439 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 6 Skipped Deployments
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #576 +/- ##
=======================================
Coverage 89.58% 89.58%
=======================================
Files 153 153
Lines 10180 10180
Branches 1070 1070
=======================================
Hits 9120 9120
Misses 1060 1060 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job 💪 . I've left some comments
clis/stats-aggregation-cli/test/commands/__snapshots__/daily.test.ts.snap
Show resolved
Hide resolved
clis/stats-aggregation-cli/test/commands/__snapshots__/daily.test.ts.snap
Show resolved
Hide resolved
clis/stats-aggregation-cli/test/commands/__snapshots__/daily.test.ts.snap
Show resolved
Hide resolved
packages/db/prisma/migrations/20240916233526_backfill_address_history_table/migration.sql
Outdated
Show resolved
Hide resolved
Co-authored-by: Pablo Castellano <[email protected]>
9d746d8
to
24868b0
Compare
* feat(db): add `category` and `rollup` to stats models * fix(db): add missing `id` field to blob daily stats model * chore: bump prisma deps to latest version * chore(db): enable `typedSql` on prisma * feat(db): add blob max fee columns to transaction stats models * chore: add changeset * feat(db): treat category and rollup null values as distinct * feat(db): add total blob gas price columns * feat(db): add address history model * feat(dayjs): add date utily functions * chore: add changeset * feat: add support for category and rollup aggregations * chore: add changeset * test(stats-aggregation-cli): update snapshots * fix(api): fix import issue * style: apply suggestions from code review Co-authored-by: Pablo Castellano <[email protected]> * test(api): unskip tests * refactor: rename `AddressHistory` model to `AddressCategoryInfo` * feat: make `category` column optional on `AddressCategoryInfo` model * feat(api): upsert lowest overall address category info * style(stats-aggregation-cli): add comment --------- Co-authored-by: Pablo Castellano <[email protected]>
Checklist
Description
Resolves #518
This PR introduces changes to aggregate statistics by category and rollups, and stores them in the daily and overall stats tables. To achieve this, it adds optional
category
androllup
columns to these tables, allowing for grouped statistics.If either of these columns is
null
, it indicates that the row reflects total stats for that grouping. Specifically, when rollup isnull
, the row holds the stats for all rollups. When both category and rollup arenull
, the row represents the overall total stats.The PR also leverages Prisma’s new TypedSQL feature to implement type-safe raw SQL queries.
Additionally, it updates the unit tests to verify the validity and correctness of each aggregated value by comparing them against the aggregation of the fixture data, rather than checking against a snapshot, as we were doing so far.
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):