Skip to content

Feat/add confidence scoring rules#79

Merged
AAdewunmi merged 6 commits into
mainfrom
feat/add-confidence-scoring-rules
May 17, 2026
Merged

Feat/add confidence scoring rules#79
AAdewunmi merged 6 commits into
mainfrom
feat/add-confidence-scoring-rules

Conversation

@AAdewunmi

Copy link
Copy Markdown
Owner

Summary

Adds deterministic confidence scoring rules for study insights.

Changes

  • Added rule-based confidence scoring in apps/insights/nlp/confidence.py.
  • Added Low, Medium, and High confidence label mapping.
  • Added focused tests in apps/insights/tests/test_confidence.py.
  • Clarified confidence wording in docs/ai-nlp-contract.md.

Behaviour

  • Scores confidence from 0 to 100.
  • Uses meaningful token count, unique meaningful token count, keyword count, and usable summary presence.
  • Returns 0 for empty or non-meaningful note content.
  • Does not reward fallback low-information summaries.
  • Produces repeatable scores for the same inputs.
  • Labels scores as:
    • Low below 45
    • Medium from 45 to 74
    • High from 75 upward

Why

Confidence should be a transparent quality signal for generated study insights. It should indicate whether the source notes contain enough meaningful content to support useful keywords and an extractive summary, without implying model intelligence, probability, or factual correctness.

Validation

  • pytest apps/insights/tests/test_confidence.py -q
  • ruff check apps/insights/nlp/confidence.py apps/insights/tests/test_confidence.py
  • black --check apps/insights/nlp/confidence.py apps/insights/tests/test_confidence.py

Result

All targeted confidence tests, lint checks, and format checks pass.

Notes

This is deterministic heuristic scoring only. It does not call an AI model and does not claim factual correctness.

@codecov

codecov Bot commented May 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AAdewunmi AAdewunmi merged commit 13a853c into main May 17, 2026
2 checks passed
@AAdewunmi AAdewunmi deleted the feat/add-confidence-scoring-rules branch May 17, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

Add confidence scoring rules

1 participant