Skip to content

feat(compliance): add passport compliance scoring engine with deduction reports - #1737

Open
singhanurag0317-bit wants to merge 1 commit into
souma9830:masterfrom
singhanurag0317-bit:feat/issue-1659
Open

feat(compliance): add passport compliance scoring engine with deduction reports#1737
singhanurag0317-bit wants to merge 1 commit into
souma9830:masterfrom
singhanurag0317-bit:feat/issue-1659

Conversation

@singhanurag0317-bit

Copy link
Copy Markdown

Feature: Passport Compliance Scoring Engine with Deduction Reports

Closes #1659

Problem

POST /api/compliance-check returned the raw Python checklist without an overall numerical score or actionable deduction report. Users and frontend components need an overall score (0-100), a pass/warn/fail status, and an explanation of deductions.

Change

  • New rules-engine utility backend/src/utils/passportComplianceScore.js with computePassportComplianceScore(items, { hardFail }):
    • Starts at 100; deducts a per-item weight for each fail and half the weight for each warn.
    • Domain weights: face 20, image_read 25, dpi_quality/blur/dimensions 15 each, tilt/centering/background 10 each, lighting/accessories 5 each; unknown items default to 5.
    • Returns { score, status, hardFail, summary: { pass, warn, fail }, deductions: [{ item, title, level, points, reason }] }.
    • Status thresholds: >= 90 PASS, >= 70 ACCEPTABLE, else FAIL; hardFail forces FAIL (e.g. no face detected).
  • compliance.controller.js now attaches complianceScore to the /check response ({ success, data, complianceScore }), computed from the checklist returned by the Python service.

Tests

New backend/src/utils/__tests__/passportComplianceScore.test.js (7 cases): perfect checklist = 100/PASS, blur fail = -15pts, half-weight warns, FAIL below 70, hardFail override, default weight for unknown items, empty checklist.

Full backend suite: 9 suites / 27 tests passing.

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

@singhanurag0317-bit is attempting to deploy a commit to the souma9830's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Implement Passport Compliance Scoring Engine with Deduction Reports

1 participant