CompuGrade User Flows
This document details the step-by-step, micro-level interactions between the user, the client applications, and the backend services.
System Actors & Communications Roster
Before diving into the flows, here is the complete list of all users (personas) and system-based communication nodes (services) involved in the platform.
User Personas
- Student: End-user consuming lessons via the Office/Google add-ins.
- Teacher: Instructor monitoring grades via the Admin Dashboard and authorizing content.
- Course Builder: Curriculum designer creating content in Open edX Studio using the Writer Engine.
- School Admin: Principal/IT staff monitoring a single school's seat usage and teacher rosters.
- District Admin: IT Director managing SSO, provisioning schools, and allocating district-wide seat budgets.
- Super Admin: Internal CompuGrade staff managing tenant onboarding, global roles, and system health.
System-Based Communications (Service Nodes)
- Client Add-ins (MS/Google): Extracts base64 document state and renders the React taskpane UI.
- Auto-Router Edge Service: Resolves student emails to specific tenant
backend_urlclusters. - Computency (Learning API): The central BFF (Backend-for-Frontend) handling auth, S3 uploads, and DB syncing.
- DocDiff (.NET XML Engine): Stateless grading service that diffs OpenXML structures.
- Interop (.NET COM Engine): Fallback grading service that uses Windows Office COM for rendering/PDF conversions.
- Celery/Redis Workers: Background task queues for async grading evaluation.
- Open edX Studio & LMS: The source of truth for course structures, enrollments, and final gradebooks.
- Open edX CMS Plugin (
tutor-myplugin): Bridges Open edX with CompuGrade classes and webhook orchestration. - Admin Dashboard FE: The React SPA used by all Admin/Teacher personas.
- Admin Dashboard BE: The FastAPI orchestration layer for SSO keys, seat licensing, and Open edX server-to-server syncs.
1. Student Authentication & Session Initialization
Persona: Student
Context: Opening the CompuGrade add-in within Microsoft Word for the first time.
- Action: Student opens the CompuGrade taskpane in MS Word.
- System: The React app (
staging-MS-addin) loadsHome.jsx. - Action: Student enters their email address and password and clicks "Log In".
- System (Edge): The add-in fires a
GETrequest toauto-routerat/route?email=student@example.com. - System (Auto-Router): Looks up the email against known Open edX Studio clusters (
/myplugin/students/by-email/). - System (Auto-Router): Returns the specific
backend_url(tenant URL) for that student's district. - System (Auth): The add-in sends a
POST /api/openedx/user/login_edx_userto thecomputencylearning API. - System (computency): Proxies the credentials to Open edX (
LOGIN_BASE_URL) using a password grant. - System (Open edX): Validates credentials and returns a JWT access and refresh token.
- System (Client): The add-in stores the JWTs in
localStorageand configures theaxiosinterceptor to attachAuthorization: Bearer <token>to all future requests. - System (Client): The add-in requests the student's lessons via
POST /api/openedx/get_all_rubrics_for_course. - UI Update: Taskpane renders the Course Dashboard with the student's Grade Avg and Course Progress.
2. Document Autograding Pipeline (The Core Loop)
Persona: Student
Context: The student has started an assessment (e.g., "Unit 1.1 Word L1"), the 10:00 timer is ticking, and they want to check their work on the formatting instructions.
- Action: Student clicks "Check Work" in the taskpane.
- System (Client):
Office.jsextracts the current document state and converts it to a base64 string. - System (Client): Fires
POST /api/openedx/compare_images_and_highlight_fasttocomputency. - System (computency): Validates the JWT (without signature verification for speed) and identifies the user via
get_current_user. - System (Interop - Optional): If configured,
computencysends the base64 string to the Windows COM service (POST /api/DocumentConversion/convert-to-pdf) to generate a PDF snapshot. - System (Storage):
computencyuploads the raw student artifact to AWS S3. - System (Client): The add-in establishes a Server-Sent Events (SSE) connection (
compare_images_and_highlight_sse) to listen for real-time grading updates. - System (computency): Routes the document to the .NET 8 XML Grading Engine (
DocDiff) viaPOST /api/DocumentComparison/compare-word. - System (DocDiff): Uses OpenXml/DiffPlex to structurally compare the student's XML against the teacher's answer key XML.
- System (DocDiff): Returns highlighted document images (as base64), specific error codes, and an
overallInstructionScore. - System (computency): Saves the generated comparison images to AWS S3.
- System (computency): Updates the MySQL database, upserting a
RubricItemStatusrecord with the new score and S3 paths. - System (computency): Pushes the final score, error codes, and S3 presigned URLs back down the SSE stream to the client.
- UI Update: The Document Comparison full-page view opens, allowing the student to toggle between "Side-by-Side", "Drag & Drop", and "More Details" (Error Analysis table).
3. Lesson Submission & Gradebook Sync
Persona: Student
Context: The student is ready to submit the final assessment. They have answered the multiple-choice questions in the Active Assessment View.
- Action: Student clicks "Submit" at the bottom of the active assessment panel.
- UI Update: A confirmation modal warns the student they cannot change answers after submitting. Student clicks to confirm.
- System (Client): Sends
POST /api/openedx/save_edx_rubric_score. - System (computency): Evaluates any remaining objective-based (OB) items (e.g., Multiple Choice).
- System (computency): Averages the scores from all image comparisons and objective questions.
- System (computency): Applies the weightage defined in the
SubRubrictable. - System (computency): Updates the user's overall
RubricStatusin the database. - System (computency): Fires
decrease_edx_rubric_attemptsto log the attempt. - System (computency): Emits an
http.request_completedtelemetry event via OpenTelemetry/SigNoz. - UI Update: Student sees the Grade Summary table showing their Final Grade percentage, with green checks/red X's next to each weighted rubric item.
4. Admin Provisioning a New Classroom
Persona: District Admin
Context: A district admin needs to roll out CompuGrade to a new school.
- Action: Admin logs into
staging-api.dashboard.compugrade.comusing Avatari SSO. - UI Update: The React frontend checks the
UserRoleand renders the District AdminProtectedRoutelayout. - Action: Admin navigates to Classes -> Create New Class and clicks Submit.
- System (Dashboard FE): Sends
POST /api/districts/openedx/classes. - System (Dashboard BE): Verifies the Admin's Avatari JWT.
- System (Dashboard BE): Retrieves standard client credentials to authenticate directly with Open edX Studio.
- System (Dashboard BE): Sends a server-to-server request to the CMS Plugin (
POST {STUDIO}/myplugin/classrooms/). - System (CMS Plugin): Creates the Django
Classroommodel inside the Open edX database. - System (CMS Plugin): Fires a webhook back to the Dashboard BE (
POST /api/districts/openedx/seats/consume) to deduct from the district's purchased seat inventory. - UI Update: The dashboard refreshes the class list, showing the newly provisioned Open edX classroom.
5. Super Admin District Onboarding
Persona: Super Admin
Context: A Super Admin is setting up a brand-new school district and configuring its Clever/ClassLink SSO integration.
- Action: Super Admin clicks "+ Add New District" and enters name, state, and seat capacity.
- System (Dashboard BE): Creates a new
Districtrecord in the master SQL database. - Action: Super Admin configures SSO (e.g., Clever) by pasting the Client ID and Secret.
- System (Dashboard BE): Encrypts the Client Secret and stores the OAuth configuration for this tenant.
- Action: Super Admin assigns the first District Admin user via email.
- System (Dashboard BE): Provisions the user account, assigns the
DISTRICT_ADMINrole, and dispatches an invitation email via the email provider.
6. Teacher Course Authoring (AI Writer Engine)
Persona: Teacher / Course Builder
Context: A teacher is creating a new autograded Word assignment in Open edX Studio using the CompuGrade AI Writer Engine.
- Action: Teacher opens an Open edX Studio course unit and clicks "Add Advanced Component -> CompuGrade".
- Action: Teacher clicks "Edit" on the block, launching the Writer Engine React UI.
- Action: Teacher uploads a completed
.docx"Answer Key". - System (CMS Plugin): The backend saves the document to S3.
- System (CMS Plugin): Parses the XML of the document to extract bolding, tables, and colors.
- System (CMS Plugin): Feeds the document structure to the LLM (OpenRouter) to generate human-readable instructions and map them to strict grading rubrics.
- System (CMS Plugin): Returns the generated JSON rubric to the Studio UI.
- Action: Teacher reviews the instructions, tweaks point values, and clicks "Save".
- System (CMS Plugin): Saves the
RubricandSubRubricdefinitions to the Open edX Django database, making the lesson ready for students.
7. School Admin Reporting & Rostering
Persona: School Admin
Context: A principal or school-level administrator is checking student performance and ensuring teachers are correctly assigned to classes.
- Action: School Admin logs into
staging-api.dashboard.compugrade.comusing SSO. - System (Dashboard FE): Parses the
UserRoleand scopes all API requests exclusively to their assignedschoolId. - UI Update: Dashboard loads showing School-specific KPI cards (Purchased Seats vs Used Seats).
- Action: Admin clicks "Reports" -> "Grade Report" and clicks "Generate".
- System (Dashboard BE): Runs an aggregated query against the synced Open edX analytics database, restricted to the school's classes.
- UI Update: A table populates with the final scores of all students in that school.
- Action: Admin clicks "Users" -> "Teachers" -> "+ Invite Teacher" to add a new staff member.
- System (Dashboard BE): Registers the teacher in the database, associates them with the
schoolId, and triggers an automated welcome email.