# ganatuka/mongolsign architecture

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

- Interactive diagram: https://gitdiagram.com/ganatuka/mongolsign
- Repository: https://github.com/ganatuka/mongolsign

## Overview

MongolSign is a local Mongolian fingerspelling-recognition research application. Its primary workflow captures webcam frames, detects hand landmarks, matches them against reviewed templates, arbitrates stable or completed signs, and presents confirmed letters and diagnostics in the browser. Separate workflows collect and review reference performances and photos, support calibration and experimental baselines, and mine corpus statistics to refine text. The excerpts show key calls, but not every route or subsystem; links for broader documented capabilities cite the README, and unsampled relationships are omitted.

Main entry points: [`app.py`](https://github.com/ganatuka/mongolsign/blob/main/app.py) (HTTP application), [`frontend/app.js`](https://github.com/ganatuka/mongolsign/blob/main/frontend/app.js) (Browser interface), [`src/template_store.py`](https://github.com/ganatuka/mongolsign/blob/main/src/template_store.py) (Prototype lifecycle), [`src/template_api.py`](https://github.com/ganatuka/mongolsign/blob/main/src/template_api.py) (Template API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_browser["Browser interface<br/>[app.js]"]
  node_template_ui["Template controls<br/>[templates.js]"]
  node_trace["Diagnostic trace<br/>[segment.mjs]"]
  node_stability["Output stabilizer<br/>[stability.mjs]"]
  node_text_buffer["Text buffer<br/>[text_buffer.mjs]"]
  node_server["HTTP application<br/>[app.py]"]
end

subgraph group_recognition["Recognition pipeline"]
  node_detector["Hand landmark detector<br/>[vision.py]"]
  node_descriptor["Pose descriptors and matching<br/>[templates.py]"]
  node_arbitration["Temporal recognition<br/>[recognition.py]"]
end

subgraph group_references["Reference management"]
  node_template_routes["Template API<br/>[template_api.py]"]
  node_template_store["Prototype lifecycle<br/>[template_store.py]"]
  node_photo_review["Photo enrollment"]
  node_pilot_install["Reference installer<br/>[pilot.py]"]
end

subgraph group_research["Research and text"]
  node_database[("Local study database<br/>[storage.py]")]
  node_calibration["Recording calibration<br/>[calibration.py]"]
  node_ml["Experimental classifiers<br/>[ml.py]"]
  node_language["Corpus language model<br/>[nlp.py]"]
  node_text_study["Text study<br/>[text_study.py]"]
  node_evaluation["Template evaluation"]
end

node_user(("Signer / researcher"))
node_camera(("Webcam"))

node_user -->|"uses"| node_browser
node_camera -->|"supplies frames"| node_browser
node_browser -->|"sends frames"| node_server
node_server -->|"detects hands"| node_detector
node_server -->|"recognizes streams"| node_arbitration
node_arbitration -->|"compares poses"| node_descriptor
node_browser -->|"stabilizes output"| node_stability
node_browser -->|"records diagnostics"| node_trace
node_browser -->|"buffers text"| node_text_buffer
node_browser -->|"manages templates"| node_template_ui
node_server -->|"serves templates"| node_template_routes
node_template_routes -->|"dispatches recognition"| node_arbitration
node_template_routes -->|"extracts landmarks"| node_detector
node_template_routes -->|"manages prototypes"| node_template_store
node_template_store -->|"builds prototypes"| node_descriptor
node_template_store -->|"reads and writes"| node_database
node_photo_review -->|"recovers landmarks"| node_detector
node_photo_review -->|"saves reviewed photos"| node_template_store
node_pilot_install -->|"installs references"| node_template_store
node_pilot_install -->|"extracts landmarks"| node_detector
node_server -->|"stores recordings"| node_database
node_calibration -->|"reads study records"| node_database
node_calibration -->|"loads prototypes"| node_template_store
node_server -->|"offers baselines"| node_ml
node_server -->|"refines text"| node_language
node_text_study -->|"analyzes corpus"| node_language
node_evaluation -->|"evaluates templates"| node_template_store
node_evaluation -->|"reads recordings"| node_database

click node_browser "https://github.com/ganatuka/mongolsign/blob/main/frontend/app.js"
click node_template_ui "https://github.com/ganatuka/mongolsign/blob/main/frontend/templates.js"
click node_trace "https://github.com/ganatuka/mongolsign/blob/main/frontend/segment.mjs"
click node_stability "https://github.com/ganatuka/mongolsign/blob/main/frontend/stability.mjs"
click node_text_buffer "https://github.com/ganatuka/mongolsign/blob/main/frontend/text_buffer.mjs"
click node_server "https://github.com/ganatuka/mongolsign/blob/main/app.py"
click node_detector "https://github.com/ganatuka/mongolsign/blob/main/src/vision.py"
click node_descriptor "https://github.com/ganatuka/mongolsign/blob/main/src/templates.py"
click node_arbitration "https://github.com/ganatuka/mongolsign/blob/main/src/recognition.py"
click node_template_routes "https://github.com/ganatuka/mongolsign/blob/main/src/template_api.py"
click node_template_store "https://github.com/ganatuka/mongolsign/blob/main/src/template_store.py"
click node_photo_review "https://github.com/ganatuka/mongolsign/blob/main/src/reference_images.py"
click node_pilot_install "https://github.com/ganatuka/mongolsign/blob/main/src/pilot.py"
click node_database "https://github.com/ganatuka/mongolsign/blob/main/src/storage.py"
click node_calibration "https://github.com/ganatuka/mongolsign/blob/main/src/calibration.py"
click node_ml "https://github.com/ganatuka/mongolsign/blob/main/src/ml.py"
click node_language "https://github.com/ganatuka/mongolsign/blob/main/src/nlp.py"
click node_text_study "https://github.com/ganatuka/mongolsign/blob/main/src/text_study.py"
click node_evaluation "https://github.com/ganatuka/mongolsign/blob/main/scripts/evaluate_templates.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_browser,node_template_ui,node_trace,node_stability,node_text_buffer,node_server toneBlue
class node_detector,node_descriptor,node_arbitration toneAmber
class node_template_routes,node_template_store,node_photo_review,node_pilot_install toneMint
class node_database,node_calibration,node_ml,node_language,node_text_study,node_evaluation toneRose
class node_user,node_camera toneIndigo
```

## Components

### Web experience

- [Browser interface](https://github.com/ganatuka/mongolsign/blob/main/frontend/app.js): `frontend/app.js`
- [Template controls](https://github.com/ganatuka/mongolsign/blob/main/frontend/templates.js): `frontend/templates.js`
- [Diagnostic trace](https://github.com/ganatuka/mongolsign/blob/main/frontend/segment.mjs): `frontend/segment.mjs`
- [Output stabilizer](https://github.com/ganatuka/mongolsign/blob/main/frontend/stability.mjs): `frontend/stability.mjs`
- [Text buffer](https://github.com/ganatuka/mongolsign/blob/main/frontend/text_buffer.mjs): `frontend/text_buffer.mjs`
- [HTTP application](https://github.com/ganatuka/mongolsign/blob/main/app.py): `app.py`

### Recognition pipeline

- [Hand landmark detector](https://github.com/ganatuka/mongolsign/blob/main/src/vision.py): `src/vision.py`
- [Pose descriptors and matching](https://github.com/ganatuka/mongolsign/blob/main/src/templates.py): `src/templates.py`
- [Temporal recognition](https://github.com/ganatuka/mongolsign/blob/main/src/recognition.py): `src/recognition.py`

### Reference management

- [Template API](https://github.com/ganatuka/mongolsign/blob/main/src/template_api.py): `src/template_api.py`
- [Prototype lifecycle](https://github.com/ganatuka/mongolsign/blob/main/src/template_store.py): `src/template_store.py`
- [Photo enrollment](https://github.com/ganatuka/mongolsign/blob/main/src/reference_images.py): `src/reference_images.py`
- [Reference installer](https://github.com/ganatuka/mongolsign/blob/main/src/pilot.py): `src/pilot.py`

### Research and text

- [Local study database](https://github.com/ganatuka/mongolsign/blob/main/src/storage.py): `src/storage.py`
- [Recording calibration](https://github.com/ganatuka/mongolsign/blob/main/src/calibration.py): `src/calibration.py`
- [Experimental classifiers](https://github.com/ganatuka/mongolsign/blob/main/src/ml.py): `src/ml.py`
- [Corpus language model](https://github.com/ganatuka/mongolsign/blob/main/src/nlp.py): `src/nlp.py`
- [Text study](https://github.com/ganatuka/mongolsign/blob/main/src/text_study.py): `src/text_study.py`
- [Template evaluation](https://github.com/ganatuka/mongolsign/blob/main/scripts/evaluate_templates.py): `scripts/evaluate_templates.py`

### Other components

- **Signer / researcher**
- **Webcam**

## Connections

- Signer / researcher → Browser interface: uses (evidence: `README.md`)
- Webcam → Browser interface: supplies frames (evidence: `README.md`)
- Browser interface → HTTP application: sends frames (evidence: `README.md`)
- HTTP application → Hand landmark detector: detects hands (evidence: `app.py`)
- HTTP application → Temporal recognition: recognizes streams (evidence: `README.md`)
- Temporal recognition → Pose descriptors and matching: compares poses (evidence: `src/recognition.py`)
- Browser interface → Output stabilizer: stabilizes output (evidence: `frontend/app.js`)
- Browser interface → Diagnostic trace: records diagnostics (evidence: `frontend/app.js`)
- Browser interface → Text buffer: buffers text (evidence: `frontend/app.js`)
- Browser interface → Template controls: manages templates (evidence: `frontend/app.js`)
- HTTP application → Template API: serves templates (evidence: `README.md`)
- Template API → Temporal recognition: dispatches recognition (evidence: `README.md`)
- Template API → Hand landmark detector: extracts landmarks (evidence: `README.md`)
- Template API → Prototype lifecycle: manages prototypes (evidence: `src/template_api.py`)
- Prototype lifecycle → Pose descriptors and matching: builds prototypes (evidence: `src/template_store.py`)
- Prototype lifecycle → Local study database: reads and writes (evidence: `src/template_store.py`)
- Photo enrollment → Hand landmark detector: recovers landmarks (evidence: `README.md`)
- Photo enrollment → Prototype lifecycle: saves reviewed photos (evidence: `README.md`)
- Reference installer → Prototype lifecycle: installs references (evidence: `src/pilot.py`)
- Reference installer → Hand landmark detector: extracts landmarks (evidence: `src/pilot.py`)
- HTTP application → Local study database: stores recordings (evidence: `app.py`)
- Recording calibration → Local study database: reads study records (evidence: `src/calibration.py`)
- Recording calibration → Prototype lifecycle: loads prototypes (evidence: `src/calibration.py`)
- HTTP application → Experimental classifiers: offers baselines (evidence: `README.md`)
- HTTP application → Corpus language model: refines text (evidence: `README.md`)
- Text study → Corpus language model: analyzes corpus (evidence: `src/text_study.py`)
- Template evaluation → Prototype lifecycle: evaluates templates (evidence: `scripts/evaluate_templates.py`)
- Template evaluation → Local study database: reads recordings (evidence: `scripts/evaluate_templates.py`)
