-
Notifications
You must be signed in to change notification settings - Fork 10
Assessment: Implement L1 Filtering and Post-Processing #895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vprashrex
wants to merge
18
commits into
main
Choose a base branch
from
feat/assessment-pipeline-l1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,078
−997
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5b301b7
feat(assessment): Implement L1 pipeline with topic relevance and dupl…
vprashrex b412829
feat(export): Expand output columns to include topic relevance and du…
vprashrex c12ac18
feat(post-processing): Implement post-processing configuration for as…
vprashrex c1791d5
feat(assessment): Enhance attachment handling in L1 pipeline with mix…
vprashrex 97651d2
Merge branch 'main' into feat/assessment-pipeline-l1
vprashrex 98acf86
feat(tests): update assessment run status to 'l2_processing' and refa…
vprashrex 0addb71
refactor(tests): streamline patching of run_assessment_run in TestSta…
vprashrex ad8e29f
feat(tests): add comprehensive tests for L1 duplicate detection and p…
vprashrex e020717
feat: implement prefilter pipeline with topic relevance and duplicate…
vprashrex 4a4e4f8
Refactor assessment tests and add new functionality
vprashrex bb30f88
feat: refactor assessment prefilter configuration and enhance pipelin…
vprashrex e89f1f2
feat: enhance error handling in assessment pipeline and improve attac…
vprashrex 87ee6a5
feat: add error handling for deterministic failures in assessment eva…
vprashrex 61798b6
feat: update assessment prefilter constants for provider and model co…
vprashrex d4d88a2
feat: enhance assessment tests with additional attachment handling an…
vprashrex 827547d
feat: improve test readability by formatting patch calls in assessmen…
vprashrex 8bd54a7
feat: add commented alternative model and duplicate store configurati…
vprashrex 26c4230
Merge branch 'main' into feat/assessment-pipeline-l1
vprashrex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
105 changes: 105 additions & 0 deletions
105
backend/app/alembic/versions/064_add_prefilter_columns_to_assessment_run.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| """Add prefilter columns and pipeline stage-machine columns to assessment_run | ||
| Revision ID: 064 | ||
| Revises: 063 | ||
| Create Date: 2026-05-27 00:00:00.000000 | ||
| """ | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
| from sqlalchemy.dialects import postgresql | ||
|
|
||
| revision = "064" | ||
| down_revision = "063" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "prefilter_object_store_url", | ||
| sa.String(), | ||
| nullable=True, | ||
| comment="S3 URL of prefilter results JSON", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "prefilter_total_rows", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Total rows fed into the prefilter stages", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "prefilter_total_passed", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Rows that passed the go/no-go gates and went to L2", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "prefilter_total_rejected", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Rows rejected by a go/no-go gate", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "stage", | ||
| sa.String(), | ||
| nullable=True, | ||
| comment=( | ||
| "Current pipeline stage: PRE_FILTER_TOPIC_RELEVANCE, " | ||
| "PRE_FILTER_DUPLICATE_DETECTION, L2_ASSESSMENT, COMPLETED, FAILED" | ||
| ), | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "stage_status", | ||
| sa.String(), | ||
| nullable=True, | ||
| comment="Status of stage: PENDING, PROCESSING, COMPLETED, FAILED", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "pipeline", | ||
| postgresql.JSONB(astext_type=sa.Text()), | ||
| nullable=True, | ||
| comment="Ordered stage config driving execution: {'stages': [...]}", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "stage_batches", | ||
| postgresql.JSONB(astext_type=sa.Text()), | ||
| nullable=True, | ||
| comment="Map of stage name -> batch_job id, for per-stage result lookup", | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.drop_column("assessment_run", "stage_batches") | ||
| op.drop_column("assessment_run", "pipeline") | ||
| op.drop_column("assessment_run", "stage_status") | ||
| op.drop_column("assessment_run", "stage") | ||
| op.drop_column("assessment_run", "prefilter_total_rejected") | ||
| op.drop_column("assessment_run", "prefilter_total_passed") | ||
| op.drop_column("assessment_run", "prefilter_total_rows") | ||
| op.drop_column("assessment_run", "prefilter_object_store_url") |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Resume a failed assessment run from its failed stage. | ||
|
|
||
| Re-runs the same child run in place, starting at the stage that failed. | ||
| Stages that already completed are reused (their batch results are not | ||
| recomputed). Only valid when the run is in a failed state. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| Save post-processing config for a single assessment run. | ||
|
|
||
| Stores the config inside the run's `input` JSON blob (key | ||
| `post_processing_config`). It is applied at export/preview time and never | ||
| re-runs the LLM, so it can be edited after the run completes. | ||
|
|
||
| The config has three optional sections: | ||
|
|
||
| - `computed_columns`: derived columns from formulas, e.g. | ||
| `{"name": "Total_Score", "formula": "@Novelty_score + @Usefulness_score"}`. | ||
| Formulas reference columns with `@` and support `+ - * /` and parentheses. | ||
| - `filter`: row filters combined with AND logic. | ||
| - `sort`: sort rules applied in priority order. | ||
|
|
||
| Pass `null` (or an empty body) to clear post-processing for the run. |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't silently swallow extra task kwargs here.
run_assessment_pipelinenever forwards**kwargs, so unexpected task arguments are accepted and dropped instead of failing fast. This segment also misses the required type annotations on the new function signature.Suggested fix
As per coding guidelines,
**/*.py: Always add type hints to all function parameters and return values in Python code.📝 Committable suggestion
🧰 Tools
🪛 Ruff (0.15.15)
[warning] 243-243: Unused function argument:
kwargs(ARG001)
🤖 Prompt for AI Agents