Skip to content

Comments

feat: implement consistent risk scoring engine for invoices#15

Merged
AlAfiz merged 3 commits intoBETAIL-BOYS:mainfrom
EDOHWARES:features/basic-scoring-logic
Feb 25, 2026
Merged

feat: implement consistent risk scoring engine for invoices#15
AlAfiz merged 3 commits intoBETAIL-BOYS:mainfrom
EDOHWARES:features/basic-scoring-logic

Conversation

@EDOHWARES
Copy link
Contributor

Description

Implemented the RiskService to replace our placeholder logic. It now calculates a consistent invoice risk score (0-100) based on the invoice amount and date.

Key Changes

  • New Service: Created RiskService alongside a calculateScore(amount, date) method.
  • Scoring Rules:
    • amount > $10,000 starts at a base score of 80.
    • amount < $1,000 starts at a base score of 95.
    • All other amounts start at a base score of 90.
  • Deterministic AI Simulation: Implemented a hashing algorithm that generates a consistent pseudo-random variance (-5 to +5) based on the input payload.
  • Edge-case safety: Enforced strict bounds ensuring the final score never exceeds 100 or drops below 0.
  • Testing: Added Jest coverage validating all Acceptance Criteria.

Acceptance Criteria Covered

  • Inputting the same invoice data returns a consistent score.
  • Score is always a strict integer between 0 and 100.
  • Slight variance applied to simulate AI analysis.

Closes #5

@AlAfiz
Copy link
Contributor

AlAfiz commented Feb 22, 2026

@EDOHWARES resolve conflicts

@Nathydre
Copy link
Contributor

@EDOHWARES ,good day,you pull request has a conflict,please do checkup on it and fix so i can merge, thank you

@AlAfiz AlAfiz merged commit 158b1d2 into BETAIL-BOYS:main Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: implement basic scoring logic

3 participants