Skip to content

Feature/sub corpus - #26

Merged
lpi-tn merged 5 commits into
mainfrom
Feature/sub-corpus
Sep 21, 2026
Merged

lpi-tn merged 5 commits into
mainfrom
Feature/sub-corpus

Conversation

@lpi-tn

@lpi-tn lpi-tn commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces support for hierarchical corpora by allowing a corpus to reference a parent corpus, and removes the obsolete binary_treshold field from the corpus table and related models. It also updates the Grafana view and all affected tests to reflect these changes.

Database schema and model changes:

  • Added a nullable parent_corpus_id foreign key to the corpus table to support sub-corpora, and removed the binary_treshold column. Updated the Grafana view accordingly. (welearn_database/alembic/versions/5d46d7920342_support_sub_corpus.py)
  • Updated the Corpus model in corpus_related.py to add the parent_corpus_id field and remove the binary_treshold field. (welearn_database/data/models/corpus_related.py)
  • Updated the Corpus model in grafana.py to match the new schema, adding parent_corpus_id, main_url, and other fields, and removing binary_treshold. (welearn_database/data/models/grafana.py)

Test updates:

  • Updated all test cases to remove references to binary_treshold, add main_url where 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:

  • Bumped the package version from 1.5.2 to 1.5.3 in pyproject.toml.

@lpi-tn
lpi-tn merged commit 533c48f into main Sep 21, 2026
5 checks passed
@lpi-tn
lpi-tn deleted the Feature/sub-corpus branch September 21, 2026 13:57

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.

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 Medium severity · 1 Low severity

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_treshold from 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

1 active deployment
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