Feature/sub corpus - #26
Merged
Merged
Conversation
lpi-tn
requested review from
jmsevin,
samonaisi and
sandragjacinto
and
a lite review from Copilot
September 21, 2026 13:55
sandragjacinto
approved these changes
Sep 21, 2026
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The downgrade restores the wrong database type, and Grafana UUID annotations use SQLAlchemy type classes instead of Python UUID types.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Adds hierarchical corpus support, removes the obsolete corpus threshold, updates Grafana mappings, migrations, tests, and package version.
Changes:
- Added nullable parent-corpus foreign key.
- Removed
binary_tresholdfrom corpus schema/models. - Updated Grafana view/model and tests.
| File | Description |
|---|---|
welearn_database/data/models/grafana.py |
Updates Grafana corpus fields |
welearn_database/data/models/corpus_related.py |
Adds parent-corpus relation |
welearn_database/alembic/versions/5d46d7920342_support_sub_corpus.py |
Migrates schema and view |
tests/test_corpus_related.py |
Tests parent corpora |
tests/test_create_database.py |
Updates corpus fixtures |
tests/test_document_related.py |
Removes obsolete field usage |
pyproject.toml |
Bumps package version |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "corpus", | ||
| sa.Column( | ||
| "binary_treshold", | ||
| sa.Float(), |
Comment on lines
+19
to
+25
| id: Mapped[UUID] = mapped_column(UUID(as_uuid=True), primary_key=True) | ||
| parent_corpus_id: Mapped[UUID | None] = mapped_column(UUID(as_uuid=True)) | ||
| source_name: Mapped[str] | ||
| main_url: Mapped[str | None] = mapped_column(nullable=True) | ||
| is_fix: Mapped[bool] | ||
| is_active: Mapped[bool] | ||
| category_id: Mapped[UUID | None] = mapped_column(UUID(as_uuid=True)) |
This branch was successfully deployed
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 support for hierarchical corpora by allowing a corpus to reference a parent corpus, and removes the obsolete
binary_tresholdfield from thecorpustable and related models. It also updates the Grafana view and all affected tests to reflect these changes.Database schema and model changes:
parent_corpus_idforeign key to thecorpustable to support sub-corpora, and removed thebinary_tresholdcolumn. Updated the Grafana view accordingly. (welearn_database/alembic/versions/5d46d7920342_support_sub_corpus.py)Corpusmodel incorpus_related.pyto add theparent_corpus_idfield and remove thebinary_tresholdfield. (welearn_database/data/models/corpus_related.py)Corpusmodel ingrafana.pyto match the new schema, addingparent_corpus_id,main_url, and other fields, and removingbinary_treshold. (welearn_database/data/models/grafana.py)Test updates:
binary_treshold, addmain_urlwhere necessary, and add new tests for parent corpus relationships. (tests/test_corpus_related.py,tests/test_create_database.py,tests/test_document_related.py) [1] [2] [3] [4] [5] [6] [7] [8]Version bump:
1.5.2to1.5.3inpyproject.toml.