This project is a backend system designed to monitor and analyze user activity during online coding assessments on platforms like Leetcode. It captures user events, processes them to detect suspicious behavior, and generates detailed reports.
System Overview
The system works by tracking user-generated events and analyzing them for patterns that might indicate academic dishonesty.
Event Capture: A client-side agent (e.g., a browser extension) captures events like window_blurred (user switches tabs/windows), copy-paste actions, etc.
Data Logging: The raw event data is sent to our backend and stored in an events collection in MongoDB.
Suspicion Analysis: A separate service processes these events, calculates a suspicion_percentage based on predefined rules, and creates a report.
Reporting: The final, processed reports are stored in a suspicion_reports collection for review.
Database Schema
The system primarily uses two MongoDB collections:
events (Raw Data) This collection stores the raw, unprocessed data captured from the client.
{ "_id": "ObjectId('67f4de88ade2eb6250603291')", "eventType": "window_blurred", "username": "agrimrai7", "problemId": "2", "problemTitle": "Add Two FffNumbers", "fromUrl": "https://chatgpt.com/chat/...", "fromTitle": "Chatgptfff - Two Sum", "toUrl": "https://leetcode.com/problems/add-two-numbers/", "toTitle": "Add Two Numbers - Leetcode", ... }
suspicion_reports (Processed Data) This collection stores the final analysis and score for an event.
{ "_id": "ObjectId('67f4df4b80fa2093f1ce2c31')", "documentId": "67f4de88ade2eb6250603291", "eventType": "window_blurred", "response": { "username": "agrimrai7", "problem_id": "2", "problem_title": "Add Two Numbers", "suspicion_percentage": 8, "raw_score": 1, ... }, ... }
Bug Report: Incorrect Problem Association
There is a critical bug in the event processing logic that leads to false positives.
Description: The system incorrectly associates the content of an external page with the active coding problem. In the provided example, the user navigated away from a ChatGPT page about the "Two Sum" problem. However, the system flagged this activity against the "Add Two Numbers" problem, which the user was working on at the time.
Impact: High. This bug undermines the core functionality of the system. It generates inaccurate and unfair suspicion reports, potentially penalizing users for actions they did not take.
Recommendation: The logic that correlates the fromUrl and fromTitle with the currently active problemId must be reviewed and fixed. The system should verify that the external content is relevant to the specific problem being solved before raising a flag.
Minor Issues
Inconsistent Naming: Field names are inconsistent across collections (e.g., problemId vs. problem_id). This should be standardized to improve code maintainability. Data Capture Typos: The system captured "Add Two FffNumbers", indicating a potential issue in how page titles are scraped or logged.