Enhance Path Quality Assessment and Slot Management Features
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m13s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m13s
- Added new functions for computing assignment quality scores and counting step assignment statistics, improving the evaluation of steps in path quality assessments. - Updated existing methods to incorporate the new scoring logic, enhancing the robustness of path evaluations. - Introduced UI components in the frontend to display detailed quality assessment results, including handling of split dimensions in path evaluations. - Enhanced tests to cover new functionalities and ensure accuracy in quality scoring and slot management processes.
This commit is contained in:
1 parent
7265cd5a01
commit
313d613b7c
8 files changed
+427
-55
No files matched your search
@@ -3,19 +3,28 @@ from planning_exercise_path_qa import compute_deterministic_path_quality_score
|
||||
|
||||
|
||||
def test_deterministic_quality_score_penalizes_off_topic():
|
||||
base = compute_deterministic_path_quality_score(gaps=[], off_topic_steps=[])
|
||||
steps = [{"roadmap_major_step_index": 0, "exercise_id": 1}]
|
||||
base = compute_deterministic_path_quality_score(gaps=[], off_topic_steps=[], steps=steps)
|
||||
with_off = compute_deterministic_path_quality_score(
|
||||
gaps=[],
|
||||
off_topic_steps=[{"roadmap_major_step_index": 1}],
|
||||
steps=steps,
|
||||
)
|
||||
assert with_off < base
|
||||
|
||||
|
||||
def test_deterministic_quality_score_penalizes_empty_slots():
|
||||
base = compute_deterministic_path_quality_score(gaps=[], off_topic_steps=[], steps=[])
|
||||
filled = [{"roadmap_major_step_index": 0, "exercise_id": 1}]
|
||||
base = compute_deterministic_path_quality_score(gaps=[], off_topic_steps=[], steps=filled)
|
||||
with_empty = compute_deterministic_path_quality_score(
|
||||
gaps=[],
|
||||
off_topic_steps=[],
|
||||
steps=[{"exercise_id": None}, {"exercise_id": 1}],
|
||||
steps=[{"roadmap_major_step_index": 0, "exercise_id": None}, {"roadmap_major_step_index": 1, "exercise_id": 2}],
|
||||
)
|
||||
all_empty = compute_deterministic_path_quality_score(
|
||||
gaps=[],
|
||||
off_topic_steps=[],
|
||||
steps=[{"roadmap_major_step_index": 0, "exercise_id": None}] * 4,
|
||||
)
|
||||
assert with_empty < base
|
||||
assert all_empty <= 0.15
|
||||
@@ -0,0 +1,62 @@
|
||||
"""Getrennte Roadmap- vs. Besetzungs-QS."""
|
||||
from planning_exercise_path_qa import (
|
||||
build_assignment_qa_snapshot,
|
||||
build_path_qa_summary,
|
||||
compute_assignment_quality_score,
|
||||
merge_path_quality_scores,
|
||||
)
|
||||
|
||||
|
||||
def _empty_steps(n: int):
|
||||
return [{"roadmap_major_step_index": i, "exercise_id": None} for i in range(n)]
|
||||
|
||||
|
||||
def test_assignment_quality_all_empty_slots_is_low():
|
||||
steps = _empty_steps(5)
|
||||
score = compute_assignment_quality_score(steps=steps, off_topic_steps=[], gaps=[])
|
||||
assert score <= 0.15
|
||||
|
||||
|
||||
def test_assignment_quality_all_filled_is_high():
|
||||
steps = [{"roadmap_major_step_index": i, "exercise_id": i + 1} for i in range(5)]
|
||||
score = compute_assignment_quality_score(steps=steps, off_topic_steps=[], gaps=[])
|
||||
assert score >= 0.9
|
||||
|
||||
|
||||
def test_build_path_qa_summary_caps_llm_score_when_slots_empty():
|
||||
steps = _empty_steps(4)
|
||||
summary = build_path_qa_summary(
|
||||
gaps=[],
|
||||
bridge_inserts=[],
|
||||
ai_proposals=[],
|
||||
off_topic_steps=[],
|
||||
stripped_off_topic=[],
|
||||
llm_qa={
|
||||
"overall_ok": True,
|
||||
"quality_score": 0.88,
|
||||
"topic_coverage": "Roadmap deckt Ziel gut ab",
|
||||
"issues": [],
|
||||
"recommendations": ["Feinschliff Stufe 3"],
|
||||
},
|
||||
llm_applied=True,
|
||||
steps=steps,
|
||||
)
|
||||
assert summary["roadmap_qa"]["quality_score"] == 0.88
|
||||
assert summary["assignment_qa"]["empty_slot_count"] == 4
|
||||
assert summary["assignment_qa"]["quality_score"] <= 0.15
|
||||
assert summary["quality_score"] <= 0.15
|
||||
assert summary["overall_ok"] is False
|
||||
|
||||
|
||||
def test_merge_path_quality_uses_minimum():
|
||||
assert merge_path_quality_scores(
|
||||
{"quality_score": 0.88},
|
||||
{"quality_score": 0.12},
|
||||
) == 0.12
|
||||
|
||||
|
||||
def test_assignment_snapshot_reports_empty_slots():
|
||||
snap = build_assignment_qa_snapshot(steps=_empty_steps(3), off_topic_steps=[], gaps=[])
|
||||
assert snap["empty_slot_count"] == 3
|
||||
assert snap["overall_ok"] is False
|
||||
assert any("ohne Übung" in issue for issue in snap["issues"])
|
||||
@@ -2,6 +2,7 @@
|
||||
from planning_exercise_path_builder import (
|
||||
_parse_slot_refs_from_text,
|
||||
_problematic_slots_from_path_qa,
|
||||
_slot_auto_select_ai,
|
||||
_slot_auto_select_library,
|
||||
_slot_suggestion_accepted,
|
||||
)
|
||||
@@ -113,6 +114,27 @@ def test_slot_auto_select_requires_higher_score():
|
||||
)
|
||||
|
||||
|
||||
def test_slot_auto_select_empty_slot_requires_good_fit():
|
||||
assert not _slot_auto_select_library(
|
||||
baseline_slot_score=None,
|
||||
proposed_slot_score=0.35,
|
||||
baseline_exercise_id=None,
|
||||
proposed_exercise_id=2,
|
||||
)
|
||||
assert _slot_auto_select_library(
|
||||
baseline_slot_score=None,
|
||||
proposed_slot_score=0.55,
|
||||
baseline_exercise_id=None,
|
||||
proposed_exercise_id=2,
|
||||
)
|
||||
|
||||
|
||||
def test_slot_auto_select_ai_when_library_not_selected():
|
||||
assert _slot_auto_select_ai(library_auto_select=False, has_ai=True)
|
||||
assert not _slot_auto_select_ai(library_auto_select=True, has_ai=True)
|
||||
assert not _slot_auto_select_ai(library_auto_select=False, has_ai=False)
|
||||
|
||||
|
||||
def test_off_topic_slot_gap_spec_for_filled_slot():
|
||||
from planning_exercise_path_builder import _build_off_topic_slot_gap_spec
|
||||
|
||||
|
||||
Reference in new issue
Block a user