Feature/examination audit logs#31
Closed
Soldier224K wants to merge 2 commits into
Closed
Conversation
added 2 commits
May 23, 2026 19:35
- Add reviewer_id, review_timestamp, review_reason to ConflictAlert
- Add get_conflict_details() to inspect prior face history
- Add admin_review_conflict() for approval/rejection actions
- Add get_override_log() to persist manual review decisions
- Add API endpoints: /face/conflict/{id}, /admin/review-conflict, /admin/override-log
- Add new event types: ADMIN_REVIEW_STARTED, ADMIN_REVIEW_APPROVED, ADMIN_REVIEW_REJECTED, ADMIN_OVERRIDE_ACTION
- Add 5 new tests for admin review functionality
- Add AuditLogService for comprehensive identity event logging
- Log verification attempts, face matches/mismatches, suspicious events
- Log admin override actions and examination access decisions
- Add get_timeline() for roll-number or session filtered audit trails
- Add search() for querying audit log content
- Add new event types: VERIFICATION_ATTEMPT, FACE_MATCH, FACE_MISMATCH, SUSPICIOUS_IDENTITY, ADMIN_OVERRIDE, EXAMINATION_ACCESS
- Add API endpoints: /audit/timeline, /audit/search, /audit/events/{type}
- Add 15 tests covering all audit logging functionality
Contributor
There was a problem hiding this comment.
Pull request overview
Adds examination audit logging support and admin review metadata around face identity conflicts.
Changes:
- Introduces an in-memory
AuditLogServiceand tests for audit event logging/querying. - Extends face conflict alerts with reviewer metadata and admin review helpers.
- Adds API routes for conflict details, admin review/override logs, and audit log queries.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/src/services/audit_log.py | Adds audit event model and in-memory audit log service. |
| backend/tests/test_audit_log.py | Adds unit tests for audit log service behavior. |
| backend/src/services/face_detection.py | Adds reviewer fields and conflict detail/admin review helpers. |
| backend/tests/test_face_detection.py | Expands face detection tests for review metadata and conflict lookup. |
| backend/src/models/events.py | Adds admin review and audit event enum values. |
| backend/src/main.py | Wires new services and exposes admin/audit/conflict API endpoints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async def get_conflict_details(conflict_id: str): | ||
| details = face_service.get_conflict_details(conflict_id) | ||
| if details is None: | ||
| return {"error": "Conflict not found"}, 404 |
| request.reason | ||
| ) | ||
| if not success: | ||
| return {"error": "Conflict not found"}, 404 |
Comment on lines
+88
to
+89
| @app.post("/admin/review-conflict") | ||
| async def admin_review_conflict(request: AdminReviewRequest): |
|
|
||
| app = FastAPI(title=settings.PROJECT_NAME) | ||
| face_service = FaceDetectionService() | ||
| audit_log = AuditLogService() |
Comment on lines
+31
to
+36
| VERIFICATION_ATTEMPT = "verification.attempt" | ||
| FACE_MATCH = "face.match" | ||
| FACE_MISMATCH = "face.mismatch" | ||
| SUSPICIOUS_IDENTITY = "suspicious.identity" | ||
| ADMIN_OVERRIDE = "admin.override" | ||
| EXAMINATION_ACCESS = "examination.access" |
Comment on lines
+104
to
+105
| @app.get("/audit/timeline") | ||
| async def get_audit_timeline(roll_number: Optional[str] = None, session_id: Optional[str] = None): |
Comment on lines
+100
to
+101
| @app.get("/admin/override-log") | ||
| async def get_override_log(): |
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.
closes #20