# moevm/document_insight_system architecture

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

- Interactive diagram: https://gitdiagram.com/moevm/document_insight_system
- Repository: https://github.com/moevm/document_insight_system

## Overview

This Flask application accepts presentation and report files, runs asynchronous checks, and exposes results to users and API clients. The main workflow is upload → persist file/check metadata → optional PDF conversion → parse → execute configured criteria → persist and retrieve results. The tree also shows account and criterion-pack management, LTI grade passback, and NLP helpers. The task and upload excerpts support the central processing edges; other branches are included where the index or README identifies capabilities, with unverified wiring left out.

Main entry points: [`app/server.py`](https://github.com/moevm/document_insight_system/blob/master/app/server.py) (Flask server), [`app/tasks.py`](https://github.com/moevm/document_insight_system/blob/master/app/tasks.py) (Celery task worker), [`app/db/methods/check.py`](https://github.com/moevm/document_insight_system/blob/master/app/db/methods/check.py) (Check records), [`app/routes/tasks.py`](https://github.com/moevm/document_insight_system/blob/master/app/routes/tasks.py) (Upload and task routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_server["Flask server<br/>[server.py]"]
  node_upload_tasks["Upload and task routes<br/>[tasks.py]"]
  node_results["Results routes<br/>[results.py]"]
  node_api["API routes<br/>[api.py]"]
  node_account_routes["Account and admin routes"]
end

subgraph group_processing["Check processing"]
  node_worker["Celery task worker<br/>[tasks.py]"]
  node_parser["Document parser<br/>[parser.py]"]
  node_presentation_readers["Presentation readers"]
  node_report_readers["Report readers"]
end

subgraph group_analysis["Analysis"]
  node_checker["Check orchestrator<br/>[checker.py]"]
  node_criterion_packs["Criterion packs"]
  node_presentation_checks["Presentation checks"]
  node_report_checks["Report checks"]
  node_nlp["NLP helpers"]
end

subgraph group_data["Persistence"]
  node_file_store[("File metadata and content<br/>[file.py]")]
  node_check_store[("Check records<br/>[check.py]")]
  node_database[("MongoDB and GridFS<br/>[client.py]")]
  node_accounts["Account and pack setup<br/>[pre_luncher.py]"]
end

subgraph group_integrations["External integrations"]
  node_lti["LTI validation and passback"]
end

node_user(("User"))
node_lms(("LMS"))

node_user -->|"sends requests"| node_server
node_server -->|"registers routes"| node_upload_tasks
node_server -->|"registers routes"| node_results
node_server -->|"registers routes"| node_api
node_server -->|"registers routes"| node_account_routes
node_upload_tasks -->|"saves upload"| node_file_store
node_upload_tasks -->|"creates check"| node_check_store
node_upload_tasks -->|"dispatches task"| node_worker
node_worker -->|"parses file"| node_parser
node_worker -->|"runs checks"| node_checker
node_worker -->|"saves result"| node_check_store
node_worker -->|"converts PDF"| node_file_store
node_parser -->|"selects reader"| node_presentation_readers
node_parser -->|"selects reader"| node_report_readers
node_checker -.->|"uses criteria"| node_criterion_packs
node_checker -.->|"runs criteria"| node_presentation_checks
node_checker -.->|"runs criteria"| node_report_checks
node_presentation_checks -->|"uses text analysis"| node_nlp
node_report_checks -->|"uses similarity"| node_nlp
node_results -->|"reads results"| node_check_store
node_api -->|"accesses checks"| node_check_store
node_file_store -->|"reads and writes"| node_database
node_check_store -->|"reads and writes"| node_database
node_accounts -->|"checks connection"| node_database
node_accounts -->|"loads base packs"| node_criterion_packs
node_server -->|"loads LTI utilities"| node_lti
node_lti -.->|"passes grades"| node_lms

click node_server "https://github.com/moevm/document_insight_system/blob/master/app/server.py"
click node_upload_tasks "https://github.com/moevm/document_insight_system/blob/master/app/routes/tasks.py"
click node_results "https://github.com/moevm/document_insight_system/blob/master/app/routes/results.py"
click node_api "https://github.com/moevm/document_insight_system/blob/master/app/routes/api.py"
click node_account_routes "https://github.com/moevm/document_insight_system/tree/master/app/routes"
click node_worker "https://github.com/moevm/document_insight_system/blob/master/app/tasks.py"
click node_parser "https://github.com/moevm/document_insight_system/blob/master/app/main/parser.py"
click node_presentation_readers "https://github.com/moevm/document_insight_system/tree/master/app/main/presentations"
click node_report_readers "https://github.com/moevm/document_insight_system/tree/master/app/main/reports"
click node_checker "https://github.com/moevm/document_insight_system/blob/master/app/main/checker.py"
click node_criterion_packs "https://github.com/moevm/document_insight_system/blob/master/app/main/check_packs/base_criterion_pack.py"
click node_presentation_checks "https://github.com/moevm/document_insight_system/tree/master/app/main/checks/presentation_checks"
click node_report_checks "https://github.com/moevm/document_insight_system/tree/master/app/main/checks/report_checks"
click node_nlp "https://github.com/moevm/document_insight_system/tree/master/app/nlp"
click node_file_store "https://github.com/moevm/document_insight_system/blob/master/app/db/methods/file.py"
click node_check_store "https://github.com/moevm/document_insight_system/blob/master/app/db/methods/check.py"
click node_database "https://github.com/moevm/document_insight_system/blob/master/app/db/methods/client.py"
click node_accounts "https://github.com/moevm/document_insight_system/blob/master/app/servants/pre_luncher.py"
click node_lti "https://github.com/moevm/document_insight_system/tree/master/app/lti_session_passback"

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_server,node_upload_tasks,node_results,node_api,node_account_routes,node_user toneBlue
class node_worker,node_parser,node_presentation_readers,node_report_readers toneAmber
class node_checker,node_criterion_packs,node_presentation_checks,node_report_checks,node_nlp toneMint
class node_file_store,node_check_store,node_database,node_accounts toneRose
class node_lti,node_lms toneIndigo
```

## Components

### Web interface

- [Flask server](https://github.com/moevm/document_insight_system/blob/master/app/server.py): `app/server.py`
- [Upload and task routes](https://github.com/moevm/document_insight_system/blob/master/app/routes/tasks.py): `app/routes/tasks.py`
- [Results routes](https://github.com/moevm/document_insight_system/blob/master/app/routes/results.py): `app/routes/results.py`
- [API routes](https://github.com/moevm/document_insight_system/blob/master/app/routes/api.py): `app/routes/api.py`
- [Account and admin routes](https://github.com/moevm/document_insight_system/tree/master/app/routes): `app/routes`

### Check processing

- [Celery task worker](https://github.com/moevm/document_insight_system/blob/master/app/tasks.py): `app/tasks.py`
- [Document parser](https://github.com/moevm/document_insight_system/blob/master/app/main/parser.py): `app/main/parser.py`
- [Presentation readers](https://github.com/moevm/document_insight_system/tree/master/app/main/presentations): `app/main/presentations`
- [Report readers](https://github.com/moevm/document_insight_system/tree/master/app/main/reports): `app/main/reports`

### Analysis

- [Check orchestrator](https://github.com/moevm/document_insight_system/blob/master/app/main/checker.py): `app/main/checker.py`
- [Criterion packs](https://github.com/moevm/document_insight_system/blob/master/app/main/check_packs/base_criterion_pack.py): `app/main/check_packs/base_criterion_pack.py`
- [Presentation checks](https://github.com/moevm/document_insight_system/tree/master/app/main/checks/presentation_checks): `app/main/checks/presentation_checks`
- [Report checks](https://github.com/moevm/document_insight_system/tree/master/app/main/checks/report_checks): `app/main/checks/report_checks`
- [NLP helpers](https://github.com/moevm/document_insight_system/tree/master/app/nlp): `app/nlp`

### Persistence

- [File metadata and content](https://github.com/moevm/document_insight_system/blob/master/app/db/methods/file.py): `app/db/methods/file.py`
- [Check records](https://github.com/moevm/document_insight_system/blob/master/app/db/methods/check.py): `app/db/methods/check.py`
- [MongoDB and GridFS](https://github.com/moevm/document_insight_system/blob/master/app/db/methods/client.py): `app/db/methods/client.py`
- [Account and pack setup](https://github.com/moevm/document_insight_system/blob/master/app/servants/pre_luncher.py): `app/servants/pre_luncher.py`

### External integrations

- [LTI validation and passback](https://github.com/moevm/document_insight_system/tree/master/app/lti_session_passback): `app/lti_session_passback`

### Other components

- **User**
- **LMS**

## Connections

- User → Flask server: sends requests (evidence: `app/server.py`)
- Flask server → Upload and task routes: registers routes (evidence: `app/server.py`)
- Flask server → Results routes: registers routes (evidence: `app/server.py`)
- Flask server → API routes: registers routes (evidence: `app/server.py`)
- Flask server → Account and admin routes: registers routes (evidence: `app/server.py`)
- Upload and task routes → File metadata and content: saves upload (evidence: `app/routes/tasks.py`)
- Upload and task routes → Check records: creates check (evidence: `app/routes/tasks.py`)
- Upload and task routes → Celery task worker: dispatches task (evidence: `app/routes/tasks.py`)
- Celery task worker → Document parser: parses file (evidence: `app/tasks.py`)
- Celery task worker → Check orchestrator: runs checks (evidence: `app/tasks.py`)
- Celery task worker → Check records: saves result (evidence: `app/tasks.py`)
- Celery task worker → File metadata and content: converts PDF (evidence: `app/tasks.py`)
- Document parser → Presentation readers: selects reader (evidence: `app/main/parser.py`)
- Document parser → Report readers: selects reader (evidence: `app/main/parser.py`)
- Check orchestrator → Criterion packs: uses criteria
- Check orchestrator → Presentation checks: runs criteria
- Check orchestrator → Report checks: runs criteria
- Presentation checks → NLP helpers: uses text analysis (evidence: `app/main/checks/presentation_checks/find_tasks.py`)
- Report checks → NLP helpers: uses similarity (evidence: `app/main/checks/report_checks/compare_tasks_and_content.py`)
- Results routes → Check records: reads results (evidence: `app/routes/results.py`)
- API routes → Check records: accesses checks (evidence: `app/routes/api.py`)
- File metadata and content → MongoDB and GridFS: reads and writes (evidence: `app/db/methods/file.py`)
- Check records → MongoDB and GridFS: reads and writes (evidence: `app/db/methods/check.py`)
- Account and pack setup → MongoDB and GridFS: checks connection (evidence: `app/servants/pre_luncher.py`)
- Account and pack setup → Criterion packs: loads base packs (evidence: `app/servants/pre_luncher.py`)
- Flask server → LTI validation and passback: loads LTI utilities (evidence: `app/server.py`)
- LTI validation and passback → LMS: passes grades
