# ritual1127/naverogq architecture

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

- Interactive diagram: https://gitdiagram.com/ritual1127/naverogq
- Repository: https://github.com/ritual1127/naverogq

## Overview

CADLens is a web-based checker for mechanical-drawing exam submissions. A student uploads a DWG/DXF; the server analyzes the drawing, runs rule-based and AI grading, and returns findings with a marked-up preview and correction examples. The README also documents KS-reference and accuracy pages, delayed AI explanations/translations, usage statistics, and a separate presentation-deck module. Edges reflect the README and shown imports/calls; unsampled implementation details are not inferred.

Main entry points: [`main.py`](https://github.com/ritual1127/naverogq/blob/main/main.py) (Web server), [`ai_review.py`](https://github.com/ritual1127/naverogq/blob/main/ai_review.py) (AI grader), [`check.py`](https://github.com/ritual1127/naverogq/blob/main/check.py) (Check orchestrator), [`static/home.js`](https://github.com/ritual1127/naverogq/blob/main/static/home.js) (Upload and results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_home["Upload and results<br/>[home.js]"]
  node_shared_ui["Shared UI<br/>[common.js]"]
  node_ks_page["KS references<br/>[ks.js]"]
  node_accuracy_page["Accuracy page<br/>[accuracy.js]"]
  node_server["Web server<br/>[main.py]"]
end

subgraph group_analysis["Drawing analysis"]
  node_drawing_reader["Drawing reader<br/>[dwg.py]"]
  node_orchestrator["Check orchestrator<br/>[check.py]"]
end

subgraph group_grading["Grading and feedback"]
  node_rule_grader["Rule grader<br/>[exam.py]"]
  node_ai_grader["AI grader<br/>[ai_review.py]"]
  node_fix_examples["Correction examples<br/>[fixdraw.py]"]
  node_ai_cache[("AI response cache")]
end

subgraph group_operations["Service operations"]
  node_usage_stats[("Usage statistics<br/>[stats.py]")]
  node_ogq_client["OGQ sticker client<br/>[ogq.py]"]
end

subgraph group_present["Presentation materials"]
  node_talk10["10-minute talk<br/>[talk10.js]"]
  node_talk_shared["Talk utilities<br/>[talk.js]"]
end

node_student(("Drawing student"))
node_gemini{{"Gemini API"}}
node_cloudflare_ai{{"Workers AI"}}
node_mistral{{"Mistral API"}}
node_groq{{"Groq API"}}
node_ogq_service{{"OGQ API"}}

node_student -->|"uploads drawing"| node_home
node_home -->|"submits file"| node_server
node_server -->|"starts analysis"| node_orchestrator
node_orchestrator -->|"reads drawing"| node_drawing_reader
node_orchestrator -->|"requests AI grade"| node_ai_grader
node_orchestrator -->|"grades rules"| node_rule_grader
node_ai_grader -->|"calls first"| node_gemini
node_ai_grader -.->|"fallback call"| node_cloudflare_ai
node_ai_grader -.->|"fallback call"| node_mistral
node_ai_grader -.->|"fallback call"| node_groq
node_ai_grader -->|"reads and writes"| node_ai_cache
node_server -->|"builds examples"| node_fix_examples
node_server -->|"returns results"| node_home
node_server -->|"records visits"| node_usage_stats
node_server -->|"serves stickers"| node_ogq_client
node_ogq_client -->|"fetches pack"| node_ogq_service
node_server -->|"serves page"| node_ks_page
node_server -->|"serves page"| node_accuracy_page
node_home -->|"uses shared UI"| node_shared_ui
node_ks_page -->|"uses shared UI"| node_shared_ui
node_accuracy_page -->|"uses shared UI"| node_shared_ui
node_talk10 -->|"uses utilities"| node_talk_shared

click node_home "https://github.com/ritual1127/naverogq/blob/main/static/home.js"
click node_shared_ui "https://github.com/ritual1127/naverogq/blob/main/static/common.js"
click node_ks_page "https://github.com/ritual1127/naverogq/blob/main/static/ks.js"
click node_accuracy_page "https://github.com/ritual1127/naverogq/blob/main/static/accuracy.js"
click node_server "https://github.com/ritual1127/naverogq/blob/main/main.py"
click node_drawing_reader "https://github.com/ritual1127/naverogq/blob/main/dwg.py"
click node_orchestrator "https://github.com/ritual1127/naverogq/blob/main/check.py"
click node_rule_grader "https://github.com/ritual1127/naverogq/blob/main/exam.py"
click node_ai_grader "https://github.com/ritual1127/naverogq/blob/main/ai_review.py"
click node_fix_examples "https://github.com/ritual1127/naverogq/blob/main/fixdraw.py"
click node_ai_cache "https://github.com/ritual1127/naverogq/tree/main/aicache"
click node_usage_stats "https://github.com/ritual1127/naverogq/blob/main/stats.py"
click node_ogq_client "https://github.com/ritual1127/naverogq/blob/main/ogq.py"
click node_talk10 "https://github.com/ritual1127/naverogq/blob/main/presenter/talk10.js"
click node_talk_shared "https://github.com/ritual1127/naverogq/blob/main/presenter/talk.js"

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_home,node_shared_ui,node_ks_page,node_accuracy_page,node_server toneBlue
class node_drawing_reader,node_orchestrator toneAmber
class node_rule_grader,node_ai_grader,node_fix_examples,node_ai_cache,node_gemini,node_mistral,node_groq,node_ogq_service toneMint
class node_usage_stats,node_ogq_client,node_cloudflare_ai toneRose
class node_talk10,node_talk_shared,node_student toneIndigo
```

## Components

### Web experience

- [Upload and results](https://github.com/ritual1127/naverogq/blob/main/static/home.js): `static/home.js`
- [Shared UI](https://github.com/ritual1127/naverogq/blob/main/static/common.js): `static/common.js`
- [KS references](https://github.com/ritual1127/naverogq/blob/main/static/ks.js): `static/ks.js`
- [Accuracy page](https://github.com/ritual1127/naverogq/blob/main/static/accuracy.js): `static/accuracy.js`
- [Web server](https://github.com/ritual1127/naverogq/blob/main/main.py): `main.py`

### Drawing analysis

- [Drawing reader](https://github.com/ritual1127/naverogq/blob/main/dwg.py): `dwg.py`
- [Check orchestrator](https://github.com/ritual1127/naverogq/blob/main/check.py): `check.py`

### Grading and feedback

- [Rule grader](https://github.com/ritual1127/naverogq/blob/main/exam.py): `exam.py`
- [AI grader](https://github.com/ritual1127/naverogq/blob/main/ai_review.py): `ai_review.py`
- [Correction examples](https://github.com/ritual1127/naverogq/blob/main/fixdraw.py): `fixdraw.py`
- [AI response cache](https://github.com/ritual1127/naverogq/tree/main/aicache): `aicache`

### Service operations

- [Usage statistics](https://github.com/ritual1127/naverogq/blob/main/stats.py): `stats.py`
- [OGQ sticker client](https://github.com/ritual1127/naverogq/blob/main/ogq.py): `ogq.py`

### Presentation materials

- [10-minute talk](https://github.com/ritual1127/naverogq/blob/main/presenter/talk10.js): `presenter/talk10.js`
- [Talk utilities](https://github.com/ritual1127/naverogq/blob/main/presenter/talk.js): `presenter/talk.js`

### Other components

- **Drawing student**
- **Gemini API**
- **Workers AI**
- **Mistral API**
- **Groq API**
- **OGQ API**

## Connections

- Drawing student → Upload and results: uploads drawing (evidence: `README.md`)
- Upload and results → Web server: submits file (evidence: `README.md`)
- Web server → Check orchestrator: starts analysis (evidence: `main.py`)
- Check orchestrator → Drawing reader: reads drawing (evidence: `check.py`)
- Check orchestrator → AI grader: requests AI grade (evidence: `check.py`)
- Check orchestrator → Rule grader: grades rules (evidence: `check.py`)
- AI grader → Gemini API: calls first (evidence: `README.md`)
- AI grader → Workers AI: fallback call (evidence: `README.md`)
- AI grader → Mistral API: fallback call (evidence: `README.md`)
- AI grader → Groq API: fallback call (evidence: `README.md`)
- AI grader → AI response cache: reads and writes (evidence: `ai_review.py`)
- Web server → Correction examples: builds examples (evidence: `main.py`)
- Web server → Upload and results: returns results (evidence: `README.md`)
- Web server → Usage statistics: records visits (evidence: `main.py`)
- Web server → OGQ sticker client: serves stickers (evidence: `main.py`)
- OGQ sticker client → OGQ API: fetches pack (evidence: `ogq.py`)
- Web server → KS references: serves page (evidence: `main.py`)
- Web server → Accuracy page: serves page (evidence: `main.py`)
- Upload and results → Shared UI: uses shared UI (evidence: `README.md`)
- KS references → Shared UI: uses shared UI (evidence: `README.md`)
- Accuracy page → Shared UI: uses shared UI (evidence: `README.md`)
- 10-minute talk → Talk utilities: uses utilities (evidence: `presenter/talk10.js`)
