# paritosh264/honest-iq architecture

> Architecture diagram of the GitHub repository paritosh264/honest-iq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paritosh264/honest-iq
- Repository: https://github.com/paritosh264/honest-iq

## Overview

This is a Flask-based webcam proctoring monitor. A participant opens the introduction, starts a test, and the browser streams camera frames to the server; a background detector checks faces, lip movement, and hands, then publishes alerts for the browser to display. Detected multiple faces or hands can trigger screenshot emails. The implementation is concentrated in main.py, with browser behavior in two JavaScript files. HTML-to-script wiring is not shown, so those links are omitted; the alert script’s HTTP interactions are explicit.

Main entry points: [`main.py`](https://github.com/paritosh264/honest-iq/blob/main/main.py) (Background detector), [`templates/get_alerts.js`](https://github.com/paritosh264/honest-iq/blob/main/templates/get_alerts.js) (Frame capture), [`templates/face_obj.js`](https://github.com/paritosh264/honest-iq/blob/main/templates/face_obj.js) (Camera preview), [`templates/index.html`](https://github.com/paritosh264/honest-iq/blob/main/templates/index.html) (Landing page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Participant interface"]
  node_flask["Flask routes<br/>[main.py]"]
  node_home["Landing page<br/>[index.html]"]
  node_instructions["Test instructions<br/>[introduction.html]"]
  node_camera_preview["Camera preview<br/>[face_obj.js]"]
  node_alert_display["Alert display<br/>[get_alerts.js]"]
end

subgraph group_ingest["Frame and alert flow"]
  node_browser_capture["Frame capture<br/>[get_alerts.js]"]
  node_frame_endpoint["Frame endpoint<br/>[main.py]"]
  node_frame_state[("Latest frame<br/>[main.py]")]
  node_alert_state[("Current alerts<br/>[main.py]")]
  node_alerts_endpoint["Alerts endpoint<br/>[main.py]"]
end

subgraph group_analysis["Proctoring analysis"]
  node_detector["Background detector<br/>[main.py]"]
  node_face_checks["Face and lip checks<br/>[main.py]"]
  node_hand_checks["Hand checks<br/>[main.py]"]
end

subgraph group_notify["Evidence notifications"]
  node_multi_face_capture["Multi-face capture<br/>[main.py]"]
  node_hand_capture["Hand capture<br/>[main.py]"]
  node_email_sender["Email sender<br/>[main.py]"]
end

node_participant(("Participant"))
node_camera["Browser camera"]
node_smtp["Gmail SMTP"]

node_participant -->|"opens site"| node_flask
node_flask -->|"renders"| node_home
node_participant -->|"starts test"| node_flask
node_flask -->|"renders"| node_instructions
node_camera_preview -->|"requests access"| node_camera
node_browser_capture -->|"captures frames"| node_camera
node_browser_capture -->|"posts frames"| node_frame_endpoint
node_frame_endpoint -->|"updates"| node_frame_state
node_detector -->|"reads"| node_frame_state
node_detector -->|"checks faces"| node_face_checks
node_detector -->|"checks hands"| node_hand_checks
node_detector -->|"publishes alerts"| node_alert_state
node_detector -->|"captures screenshot"| node_multi_face_capture
node_detector -->|"captures screenshot"| node_hand_capture
node_alerts_endpoint -->|"reads"| node_alert_state
node_browser_capture -->|"polls alerts"| node_alerts_endpoint
node_browser_capture -->|"updates display"| node_alert_display
node_multi_face_capture -->|"sends email"| node_email_sender
node_hand_capture -->|"sends email"| node_email_sender
node_email_sender -->|"sends message"| node_smtp

click node_flask "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_home "https://github.com/paritosh264/honest-iq/blob/main/templates/index.html"
click node_instructions "https://github.com/paritosh264/honest-iq/blob/main/templates/introduction.html"
click node_camera_preview "https://github.com/paritosh264/honest-iq/blob/main/templates/face_obj.js"
click node_browser_capture "https://github.com/paritosh264/honest-iq/blob/main/templates/get_alerts.js"
click node_frame_endpoint "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_frame_state "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_detector "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_face_checks "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_hand_checks "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_alert_state "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_alerts_endpoint "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_alert_display "https://github.com/paritosh264/honest-iq/blob/main/templates/get_alerts.js"
click node_multi_face_capture "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_hand_capture "https://github.com/paritosh264/honest-iq/blob/main/main.py"
click node_email_sender "https://github.com/paritosh264/honest-iq/blob/main/main.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_flask,node_home,node_instructions,node_camera_preview,node_alert_display,node_camera toneBlue
class node_browser_capture,node_frame_endpoint,node_frame_state,node_alert_state,node_alerts_endpoint toneAmber
class node_detector,node_face_checks,node_hand_checks toneMint
class node_multi_face_capture,node_hand_capture,node_email_sender toneRose
class node_participant,node_smtp toneIndigo
```

## Components

### Participant interface

- [Flask routes](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`
- [Landing page](https://github.com/paritosh264/honest-iq/blob/main/templates/index.html): `templates/index.html`
- [Test instructions](https://github.com/paritosh264/honest-iq/blob/main/templates/introduction.html): `templates/introduction.html`
- [Camera preview](https://github.com/paritosh264/honest-iq/blob/main/templates/face_obj.js): `templates/face_obj.js`
- [Alert display](https://github.com/paritosh264/honest-iq/blob/main/templates/get_alerts.js): `templates/get_alerts.js`

### Frame and alert flow

- [Frame capture](https://github.com/paritosh264/honest-iq/blob/main/templates/get_alerts.js): `templates/get_alerts.js`
- [Frame endpoint](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`
- [Latest frame](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`
- [Current alerts](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`
- [Alerts endpoint](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`

### Proctoring analysis

- [Background detector](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`
- [Face and lip checks](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`
- [Hand checks](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`

### Evidence notifications

- [Multi-face capture](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`
- [Hand capture](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`
- [Email sender](https://github.com/paritosh264/honest-iq/blob/main/main.py): `main.py`

### Other components

- **Participant**
- **Browser camera**
- **Gmail SMTP**

## Connections

- Participant → Flask routes: opens site (evidence: `main.py`)
- Flask routes → Landing page: renders (evidence: `main.py`)
- Participant → Flask routes: starts test (evidence: `main.py`)
- Flask routes → Test instructions: renders (evidence: `main.py`)
- Camera preview → Browser camera: requests access (evidence: `templates/face_obj.js`)
- Frame capture → Browser camera: captures frames (evidence: `templates/get_alerts.js`)
- Frame capture → Frame endpoint: posts frames (evidence: `templates/get_alerts.js`)
- Frame endpoint → Latest frame: updates (evidence: `main.py`)
- Background detector → Latest frame: reads (evidence: `main.py`)
- Background detector → Face and lip checks: checks faces (evidence: `main.py`)
- Background detector → Hand checks: checks hands (evidence: `main.py`)
- Background detector → Current alerts: publishes alerts (evidence: `main.py`)
- Background detector → Multi-face capture: captures screenshot (evidence: `main.py`)
- Background detector → Hand capture: captures screenshot (evidence: `main.py`)
- Alerts endpoint → Current alerts: reads (evidence: `main.py`)
- Frame capture → Alerts endpoint: polls alerts (evidence: `templates/get_alerts.js`)
- Frame capture → Alert display: updates display (evidence: `templates/get_alerts.js`)
- Multi-face capture → Email sender: sends email (evidence: `main.py`)
- Hand capture → Email sender: sends email (evidence: `main.py`)
- Email sender → Gmail SMTP: sends message (evidence: `main.py`)
