# nq-i/ip2 architecture

> Architecture diagram of the GitHub repository nq-i/ip2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nq-i/ip2
- Repository: https://github.com/nq-i/ip2

## Overview

This is a multi-student online exam proctoring platform. A student joins an exam and streams webcam frames and microphone audio; the server analyzes behavior, produces a rule-based risk profile and events, and presents active students to a proctor. After the exam, instructors can review session reports. The README documents the principal stages and capabilities; sampled source confirms application setup and audio-pipeline construction. Most route, worker, detector, and reporting implementations were not sampled, so their links rely on README statements rather than direct source inspection.

Main entry points: [`db_models.py`](https://github.com/nq-i/ip2/blob/main/db_models.py) (Application records), [`app.py`](https://github.com/nq-i/ip2/blob/main/app.py) (Flask application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_exam["Exam workflow"]
  node_session["Session manager"]
end

subgraph group_analysis["Behavior analysis"]
  node_worker["Student worker"]
  node_face["Face and gaze"]
  node_phone["Phone detection"]
  node_audio["Audio analysis"]
  node_audio_pipe["Audio pipeline"]
  node_features["Feature extraction"]
  node_classifier["Risk classifier"]
end

subgraph group_platform["Platform services"]
  node_flask["Flask application<br/>[app.py]"]
  node_database[("Application records<br/>[db_models.py]")]
end

subgraph group_review["Monitoring and review"]
  node_dashboard["Live proctor view"]
  node_reports["Session reports"]
  node_admin["Admin tools"]
end

node_student(("Student"))
node_browser["Exam browser"]
node_proctor(("Proctor"))
node_instructor(("Instructor"))

node_student -->|"takes exam"| node_browser
node_browser -->|"streams frames and audio"| node_flask
node_flask -->|"creates sessions"| node_session
node_session -->|"manages workers"| node_worker
node_worker -->|"analyzes frames"| node_face
node_worker -->|"detects phones"| node_phone
node_worker -->|"extracts features"| node_features
node_worker -->|"scores behavior"| node_classifier
node_flask -->|"creates pipeline"| node_audio_pipe
node_audio_pipe -->|"dispatches audio"| node_audio
node_worker -->|"records events and snapshots"| node_database
node_flask -->|"uses application records"| node_database
node_proctor -->|"monitors students"| node_dashboard
node_dashboard -.->|"reads session data"| node_database
node_instructor -->|"reviews results"| node_reports
node_reports -.->|"reports session data"| node_database
node_admin -.->|"administers records"| node_database

click node_flask "https://github.com/nq-i/ip2/blob/main/app.py"
click node_database "https://github.com/nq-i/ip2/blob/main/db_models.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_session,node_browser toneBlue
class node_worker,node_face,node_phone,node_audio,node_audio_pipe,node_features,node_classifier toneAmber
class node_flask,node_database toneMint
class node_dashboard,node_reports,node_admin toneRose
class node_student,node_proctor,node_instructor toneIndigo
```

## Components

### Exam workflow

- **Session manager**

### Behavior analysis

- **Student worker**
- **Face and gaze**
- **Phone detection**
- **Audio analysis**
- **Audio pipeline**
- **Feature extraction**
- **Risk classifier**

### Platform services

- [Flask application](https://github.com/nq-i/ip2/blob/main/app.py): `app.py`
- [Application records](https://github.com/nq-i/ip2/blob/main/db_models.py): `db_models.py`

### Monitoring and review

- **Live proctor view**
- **Session reports**
- **Admin tools**

### Other components

- **Student**
- **Exam browser**
- **Proctor**
- **Instructor**

## Connections

- Student → Exam browser: takes exam (evidence: `README.md`)
- Exam browser → Flask application: streams frames and audio (evidence: `README.md`)
- Flask application → Session manager: creates sessions (evidence: `README.md`)
- Session manager → Student worker: manages workers (evidence: `README.md`)
- Student worker → Face and gaze: analyzes frames (evidence: `README.md`)
- Student worker → Phone detection: detects phones (evidence: `README.md`)
- Student worker → Feature extraction: extracts features (evidence: `README.md`)
- Student worker → Risk classifier: scores behavior (evidence: `README.md`)
- Flask application → Audio pipeline: creates pipeline (evidence: `app.py`)
- Audio pipeline → Audio analysis: dispatches audio (evidence: `README.md`)
- Student worker → Application records: records events and snapshots (evidence: `README.md`)
- Flask application → Application records: uses application records (evidence: `app.py`)
- Proctor → Live proctor view: monitors students (evidence: `README.md`)
- Live proctor view → Application records: reads session data
- Instructor → Session reports: reviews results (evidence: `README.md`)
- Session reports → Application records: reports session data
- Admin tools → Application records: administers records
