feat: add admin question bank audit and integrity check - #418
Open
dhinith2007 wants to merge 2 commits into
Open
feat: add admin question bank audit and integrity check#418dhinith2007 wants to merge 2 commits into
dhinith2007 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Admin Question Bank Audit & Integrity Check
🎯 Overview
This PR introduces a non-destructive Question Bank Audit & Integrity Check system for Admin and Superadmin users.
The feature provides a lightweight, client-side quality-control layer that automatically analyzes the Question Bank and identifies potential data-integrity issues before they affect assessment delivery.
Instead of manually inspecting thousands of question records, administrators can run an integrity audit and immediately understand the health, quality, and consistency of the question dataset through a dedicated dashboard.
💡 Problem
As the Question Bank grows, maintaining the consistency and integrity of question records becomes increasingly difficult.
Potential issues such as:
Missing or incomplete question prompts
Missing answer keys
Invalid choice configurations
Duplicate question content
Invalid FLN level mappings
Malformed SVG illustrations
can remain hidden inside a large dataset and potentially affect the reliability of assessments.
There was previously no dedicated interface for administrators to systematically identify and inspect these issues.
🚀 Proposed Solution
This PR adds a dedicated Question Bank Audit & Integrity Check dashboard that performs automated static analysis across every loaded question record.
The audit engine is implemented as a pure TypeScript utility, keeping the validation logic independent from React, the backend, database, and DOM.
Six Integrity Checks
Check | Severity | Validation -- | -- | -- Missing Question Text | 🔴 Critical | Detects missing, empty, whitespace-only, or extremely short prompts Missing Correct Answer | 🔴 Critical | Detects missing answer keys while correctly preserving 0 / "0" Invalid Choices | 🔴 Critical | Validates choice questions for at least 2 distinct non-empty options Duplicate Question Text | 🟡 Warning | Detects duplicates using normalized text comparison Invalid FLN Level | 🟡 Warning | Validates level boundaries from 1–93 SVG Markup Integrity | 🟡 Warning | Detects incomplete or malformed SVG markupThe 412 detected issues correspond to repeated curriculum/template prompts across sub-levels rather than missing answers, invalid levels, or malformed content.
This demonstrates that the audit is able to surface real dataset-level consistency patterns, rather than only synthetic test cases.
🧪 Verification
Unit Testing
Implemented a dedicated test suite covering all 12 required scenarios:
Valid question
Missing/short question text
Missing answer
Numeric
0answerString
"0"answerInvalid choices
Normalized duplicate questions
Level below valid range
Level above valid range
Valid level boundaries
Malformed SVG
Multiple simultaneous issues
Result: 12/12 tests passed.
TypeScript Validation
Frontend: 0 errors
Backend: 0 errors
Production Build
Vite production build: PASS
Code Quality
No whitespace or formatting errors detected.
Browser Verification
The feature was verified through the running application:
Question Bank navigation
Audit execution
KPI cards
Category filters
Issue table
Live search
Question inspector
Read-only behavior
Browser console
No unhandled runtime errors observed.
📁 Scope of Changes
New Files
frontend/src/utils/questionBankAudit.tsfrontend/src/utils/questionBankAudit.test.tsfrontend/src/components/panels/QuestionBankPanel.tsxModified Files
frontend/src/components/PanelViews.tsxfrontend/src/components/Layout.tsxExplicitly Unchanged
Backend APIs
Database schemas
Existing question records
Existing assessment functionality
Existing application routes
🌟 Engineering Impact
This feature establishes a foundation for proactive Question Bank quality monitoring within the FLN platform.
The architecture also keeps the audit engine independent and reusable, meaning additional validation rules can be introduced in the future without coupling the validation logic to the UI or backend.
Potential future extensions could include:
Automated remediation suggestions
Exportable audit reports
Historical integrity tracking
Quality trends across Question Bank versions
Duplicate similarity detection beyond exact normalized matches
Administrative approval workflows for flagged questions
For the current implementation, the focus remains intentionally narrow: detect, explain, and inspect — without modifying the underlying data.
✅ Final Status
Status: Ready for Review
The implementation is fully scoped to the approved Question Bank Audit & Integrity Check feature, with successful unit testing, TypeScript validation, production build verification, real-dataset analysis, and browser-level verification.