Commit 544b130
feat: group python version by minor (#24)
* feat: Group Python versions by minor version in dashboard
Modified Python version analytics to group by minor version (e.g., 3.14)
instead of patch version (e.g., 3.14.1, 3.14.2) for cleaner dashboard metrics.
Changes:
- Updated get_python_version_distribution() to extract and group by major.minor
- Updated get_unique_python_versions_count() to count unique minor versions
- Updated get_unique_users_by_dimension() to handle python_version dimension with minor version grouping
Uses PostgreSQL regexp_replace to extract "3.14" from versions like "3.14.1", "3.14.2", etc.
* feat: Add database-agnostic Python version grouping with tests
Added support for both PostgreSQL and SQLite databases in Python version
minor version extraction logic. This allows tests to run on SQLite while
production uses PostgreSQL.
Changes:
- Added _extract_minor_version() helper method in AnalyticsEventRepository
- PostgreSQL: Uses regexp_replace for version extraction
- SQLite: Uses substr/instr for version extraction
- Updated get_python_version_distribution() to use helper method
- Updated get_unique_python_versions_count() to use helper method
- Updated get_unique_users_by_dimension() to use helper method
- Added comprehensive test suite in test_python_version_grouping.py
- Tests version distribution grouping
- Tests unique version counting
- Tests user grouping by version
- Tests edge case of already-minor versions
All tests pass, linting clean, type checking passes.
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 49d4f63 commit 544b130
File tree
2 files changed
+355
-9
lines changed- app
- src/repositories
- tests
2 files changed
+355
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
27 | 64 | | |
28 | 65 | | |
29 | 66 | | |
| |||
57 | 94 | | |
58 | 95 | | |
59 | 96 | | |
60 | | - | |
61 | | - | |
| 97 | + | |
| 98 | + | |
62 | 99 | | |
63 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
64 | 104 | | |
65 | 105 | | |
66 | | - | |
| 106 | + | |
67 | 107 | | |
68 | 108 | | |
69 | 109 | | |
| |||
74 | 114 | | |
75 | 115 | | |
76 | 116 | | |
77 | | - | |
| 117 | + | |
78 | 118 | | |
79 | 119 | | |
80 | 120 | | |
81 | 121 | | |
82 | 122 | | |
83 | 123 | | |
84 | | - | |
| 124 | + | |
85 | 125 | | |
86 | 126 | | |
87 | 127 | | |
| |||
210 | 250 | | |
211 | 251 | | |
212 | 252 | | |
213 | | - | |
| 253 | + | |
214 | 254 | | |
215 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
216 | 259 | | |
217 | | - | |
| 260 | + | |
218 | 261 | | |
219 | 262 | | |
220 | 263 | | |
| |||
446 | 489 | | |
447 | 490 | | |
448 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
449 | 496 | | |
450 | 497 | | |
451 | 498 | | |
| |||
0 commit comments