Skip to content

Features/analytic views and table#22

Merged
lpi-tn merged 5 commits into
mainfrom
Features/analytic-views-and-table
Jun 17, 2026
Merged

Features/analytic views and table#22
lpi-tn merged 5 commits into
mainfrom
Features/analytic-views-and-table

Conversation

@lpi-tn

@lpi-tn lpi-tn commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Added three new tables via Alembic migration for tracking historical document counts: historical_qty_document_per_corpus, historical_qty_document_in_qdrant_per_corpus, and historical_qty_document_in_qdrant in the document_related schema. Corresponding SQLAlchemy models were created in document_related.py. [1] [2]
  • Added a new Alembic migration to create a SQL view grafana.used_feature_per_session for analyzing feature usage by session.
  • Introduced a new read-only SQLAlchemy model UsedFeaturePerSession in grafana.py to map the new view.

Testing:

  • Added tests for the new historical document count models to ensure correct creation and retrieval in the database. [1] [2]

Documentation:

  • Fixed a minor typo in the docstring for the WeLearnDocument model (existexists).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread welearn_database/data/models/document_related.py Outdated
Comment thread welearn_database/data/models/document_related.py Outdated
Comment thread welearn_database/alembic/versions/6d4346fad6f4_view_used_feature_per_session.py Outdated
Comment thread welearn_database/alembic/versions/6d4346fad6f4_view_used_feature_per_session.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@lpi-tn lpi-tn merged commit c1a6dd1 into main Jun 17, 2026
4 checks passed
@lpi-tn lpi-tn deleted the Features/analytic-views-and-table branch June 17, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants