-
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
9
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.
+2,701
−296
Open
Changes from all commits
Commits
Show all changes
9 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 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
61 changes: 61 additions & 0 deletions
61
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,61 @@ | ||
| """Add prefilter pipeline 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 | ||
|
|
||
| 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 stored prefilter filter results JSON", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "prefilter_total_rows", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Total rows fed into prefilter pipeline", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "prefilter_total_passed", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Rows that passed topic relevance and went to L2", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "prefilter_total_rejected", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Rows rejected by topic relevance, stopped at prefilter", | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| 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,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
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.
Missing length validation between
rowsandrow_indices.When
row_indicesis provided, the code assumeslen(row_indices) == len(rows). If they differ,row_indices[i]could raiseIndexError(ifrow_indicesis shorter) or some indices could be silently unused (if longer).Consider adding a validation check:
🛡️ Proposed validation
def build_openai_jsonl( rows: list[dict[str, str]], text_columns: list[str], attachments: list[AssessmentAttachment], prompt_template: str | None, openai_params: dict, row_indices: list[int] | None = None, ) -> list[dict[str, Any]]: + if row_indices is not None and len(row_indices) != len(rows): + raise ValueError( + f"row_indices length ({len(row_indices)}) must match rows length ({len(rows)})" + ) jsonl_data = []Apply the same pattern to
build_google_jsonl.Also applies to: 237-238
🤖 Prompt for AI Agents