Skip to content

Activity Engine Wiki

Akash Kumar edited this page Feb 4, 2025 · 1 revision

Activity Engine WIKI

Table of Contents

Introduction

The Activity Engine is designed to manage assessments with a focus on three main functionalities:

  • Automated grading of assessments.
  • Tracking user progress through assessments.
  • Detecting anomalies during assessment submissions.

This document details the workings of the engine, providing a clear understanding of how the code implements these features.

Core Features

Assessment Grading

The grading module automates the evaluation of assessment submissions. Key points include:

  • Parsing answer sheets.
  • Comparing responses against a predefined answer key.
  • Generating scores with detailed feedback for each question.

An important behavior in the assessment grading process is that only when a correct answer is given, the user is allowed to proceed and watch the next video. If the answer is incorrect, the system requires rewatching the same video to encourage better understanding before moving forward.

The code components manage input validation, scoring logic, and result reporting to ensure consistent evaluation of assessments.

Progress Tracking

This module monitors and reports the progress of each user during assessment sessions. Its functionality includes:

  • Recording each assessment attempt.
  • Tracking time spent and completion metrics.
  • Updating progress data in real-time for dashboards or reports.
  • The progress tracker component calculates the percentage based on the duration watched relative to the total video length.
  • The frontend renders the percentage in a visually appealing format, using a progress bar along the sidebar.

The implementation integrates with user accounts to provide clear progress overviews, which are invaluable for both students and administrators.

Anomaly Detection

In addition to monitoring standard assessment metrics, this module now checks for specific in-person examination conditions, including:

  • Users signaling participation through hand raise actions.
  • Verification that a single individual is present during the assessment.
  • Detection to ensure no cell phone usage occurs during the session.

These checks support compliance with exam protocols and help maintain assessment integrity.

The module leverages statistical analysis, cross-checks against normal behavior patterns, and logs incidents for further investigation.

Architecture Overview

The system is structured into three main components corresponding to each core feature:

  1. The Grading Engine processes submission data and outputs scores.
  2. The Progress Tracker updates user performance metrics in near real-time.
  3. The Anomaly Detector monitors activity streams to catch irregular behaviors.

These components interact seamlessly, drawing input from assessment submissions and outputting detailed reports and flags, ensuring a robust system for educational assessment management.

Code Structure Diagram

Below is the structural diagram that connects the different modules in the Activity Engine:

activity_engine
|- src
|  |- controller (contains different controllers for each API call functionality)
|  |- middleware (contains googleAuthentication middleware responsible for authenticating the user)
|  |- routes (contains different route files with all backend routes)
|  |- repositories (contains all repository files)
|  |- services (contains all services for each functionality)
|  |- types (contains types for different elements)
|  |- constant.ts (contains the URL of the LM engine)
|  |- server.ts (Express server file)
|- prisma
|  |- migrations (contains all migrations)
|  |- schema.prisma (contains the Prisma schema or database schema for data storage)

Deployment Notes

Step 1: Download the Code From GitHub to Local Environment
https://github.com/Amritkumarchanchal/activity-deployment.git

Step 2: Download the Google Cloud CLI installer and create a project named CAL Activity Engine.
For guidance, refer to:
https://cloud.google.com/appengine/docs/standard/nodejs/building-app/creating-project?cloudshell=true

Step 3: Enable access to the required APIs in the Google Cloud Console (refer to the above documentation).

Step 4: Open your Google Cloud CLI on your PC, select your project, and navigate to the folder where the code is located (for example:
cd "C:\Users\mramr\Downloads\lms_engine-LMS3-Testing\lms_engine-LMS3-Testing” or the Activity Engine folder).

Step 5: Create two configuration files in your local code: app.yaml and .gcloudignore (similar to .env or .gitignore files).

  • Code for app.yaml:

    runtime: nodejs20
    
    env_variables:
        DATABASE_URL: "postgresql://postgres.ucvqgjbokcojtmhvcguc:9oSvDva1HQp0yH7B@aws-0-ap-south-1.pooler.supabase.com:PORT/postgres"

Step 6: Run these commands on your local machine to verify everything is working properly:

  • Run npm install to install all Node modules.
  • Run npm run build to create the dist folder.
  • Run npx prisma migrate to handle database migrations.
  • Run npm run dev to start the development server.

Step 7: Once the application works locally, deploy the code to GCP with:

gcloud app deploy --no-cache

Step 8: After successful deployment, you'll see a confirmation message similar to:

Deployed service [default] to [https://cal-activity-engine.el.r.appspot.com/](https://cal-activity-engine.el.r.appspot.com/)

You can view logs by running: gcloud app logs tail -s default
And open your application in the web browser by executing: gcloud app browse

Local Installation

To install and run the Activity Engine locally, follow these highlighted steps:

  1. Clone the Repository
    Clone the GitHub repository to your local machine:

    git clone https://github.com/Amritkumarchanchal/activity-deployment.git
    
  2. Install Dependencies
    Navigate to the project directory and run:

    npm install
    
  3. Build the Application
    Compile the application with:

    npm run build
    
  4. Apply Database Migrations
    Run the following command to manage database schema:

    npx prisma migrate
    
  5. Run the Development Server
    Start the local development server using:

    npm run dev
    

Follow these steps to ensure a successful local installation and testing of the Activity Engine.

Clone this wiki locally