Skip to content

Issue — Add confidence_tier computed property to ReasoningResult #117

@Devnil434

Description

@Devnil434

Description: The dashboard needs to colour-code alerts by confidence level but the frontend shouldn't duplicate the threshold logic. Add a confidence_tier computed property to ReasoningResult:

@property
def confidence_tier(self) -> Literal["high", "medium", "low"]:
    if self.confidence >= 0.75:  return "high"
    if self.confidence >= 0.50:  return "medium"
    return "low"

And a is_actionable property: label == "Suspicious" and confidence >= 0.65.

Files to touch:

  • libs/schemas/reasoning.py
  • tests/test_reasoning_schema.py (create)

Acceptance criteria:

  • 6 unit tests covering all tier boundaries (0.49, 0.50, 0.74, 0.75, 1.0)
  • is_actionable tested: True only when label = Suspicious AND conf ≥ 0.65
  • Both properties serialised correctly when model_dump(mode="json") is called

---

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions