-
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
base: main
Are you sure you want to change the base?
Changes from 8 commits
5b301b7
b412829
c12ac18
c1791d5
97651d2
98acf86
0addb71
ad8e29f
e020717
4a4e4f8
bb30f88
e89f1f2
87ee6a5
61798b6
d4d88a2
827547d
8bd54a7
26c4230
7345d0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| """Add L1 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( | ||
| "l1_object_store_url", | ||
| sa.String(), | ||
| nullable=True, | ||
| comment="S3 URL of stored L1 filter results JSON", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "l1_total_rows", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Total rows fed into L1 pipeline", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "l1_total_passed", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Rows that passed topic relevance and went to L2", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "assessment_run", | ||
| sa.Column( | ||
| "l1_total_rejected", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Rows rejected by topic relevance, stopped at L1", | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.drop_column("assessment_run", "l1_total_rejected") | ||
| op.drop_column("assessment_run", "l1_total_passed") | ||
| op.drop_column("assessment_run", "l1_total_rows") | ||
| op.drop_column("assessment_run", "l1_object_store_url") |
| 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. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -232,6 +232,30 @@ def run_tts_batch_submission( | |||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| @celery_app.task( | ||||||||||||||||||||||||||||||||
| bind=True, queue="low_priority", priority=1, soft_time_limit=1800, time_limit=2100 | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| def run_assessment_run( | ||||||||||||||||||||||||||||||||
| self, | ||||||||||||||||||||||||||||||||
| run_id: int, | ||||||||||||||||||||||||||||||||
| organization_id: int, | ||||||||||||||||||||||||||||||||
| project_id: int, | ||||||||||||||||||||||||||||||||
| trace_id: str, | ||||||||||||||||||||||||||||||||
| **kwargs, | ||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||
|
Comment on lines
+237
to
+244
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't silently swallow extra task kwargs here.
Suggested fix def run_assessment_pipeline(
- self,
+ self: celery.Task,
run_id: int,
organization_id: int,
project_id: int,
trace_id: str,
- **kwargs,
-):
+) -> None:As per coding guidelines, 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.15.15)[warning] 243-243: Unused function argument: (ARG001) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| from app.services.assessment.tasks import execute_assessment_run | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| _set_trace(trace_id) | ||||||||||||||||||||||||||||||||
| return _run_with_otel_parent( | ||||||||||||||||||||||||||||||||
| self, | ||||||||||||||||||||||||||||||||
| lambda: execute_assessment_run( | ||||||||||||||||||||||||||||||||
| run_id=run_id, | ||||||||||||||||||||||||||||||||
| organization_id=organization_id, | ||||||||||||||||||||||||||||||||
| project_id=project_id, | ||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| @celery_app.task(bind=True, queue="low_priority", priority=1) | ||||||||||||||||||||||||||||||||
| @gevent_timeout(settings.CELERY_TASK_SOFT_TIME_LIMIT, "run_tts_result_processing") | ||||||||||||||||||||||||||||||||
| def run_tts_result_processing( | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.