Features/analytic views and table#22
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new persistence and analytics structures to support tracking document-count history and session-level feature usage in the WeLearn database layer.
Changes:
- Adds three new “historical quantity” tables (and SQLAlchemy models) for document count snapshots.
- Adds a new Grafana schema view + read-only SQLAlchemy model to report per-session feature usage.
- Extends unit tests for the new historical models and fixes a small docstring typo.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| welearn_database/data/models/grafana.py | Adds UsedFeaturePerSession read-only model mapping to the new Grafana view. |
| welearn_database/data/models/document_related.py | Fixes docstring typo; introduces 3 new historical quantity models. |
| welearn_database/alembic/versions/5aad97149044_add_histo_table_for_materialized_views.py | Creates the 3 new historical quantity tables. |
| welearn_database/alembic/versions/6d4346fad6f4_view_used_feature_per_session.py | Creates/drops the new grafana.used_feature_per_session view. |
| tests/test_document_related.py | Adds tests for the new historical quantity models. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
sandragjacinto
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces new historical tracking tables and corresponding models for document counts, adds a new read-only view and model for tracking feature usage per session, and provides comprehensive tests for the new models. It also includes a minor docstring correction.
Database schema and model changes:
historical_qty_document_per_corpus,historical_qty_document_in_qdrant_per_corpus, andhistorical_qty_document_in_qdrantin thedocument_relatedschema. Corresponding SQLAlchemy models were created indocument_related.py. [1] [2]grafana.used_feature_per_sessionfor analyzing feature usage by session.UsedFeaturePerSessioningrafana.pyto map the new view.Testing:
Documentation:
WeLearnDocumentmodel (exist→exists).