# jahon27/diploma_thesis architecture

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

- Interactive diagram: https://gitdiagram.com/jahon27/diploma_thesis
- Repository: https://github.com/jahon27/diploma_thesis
- Video tour (about a minute): https://gitdiagram.com/jahon27/diploma_thesis/video

## Overview

This thesis prototype turns draw.io UML class and sequence diagrams into Python. The main workflow extracts class structure and sequence behavior, combines the generated code, and writes a Python file. The sequence route also has an intermediate SQD representation and an ANTLR-based parser/model/code-generation layer, supporting calls, returns, self-calls, alt, and loop fragments. AI-assisted generation and fidelity evaluation are separate comparison branches. The README documents these capabilities; some orchestration details are unsampled, so only documented or source-supported links are shown.

Main entry points: [`src/main.py`](https://github.com/jahon27/diploma_thesis/blob/main/src/main.py) (Main Workflow), [`src/extractors/sequence_extractor_with_antlr_grammar.py`](https://github.com/jahon27/diploma_thesis/blob/main/src/extractors/sequence_extractor_with_antlr_grammar.py) (Sequence Extractor), [`src/ai_experiments/openrouter_generator.py`](https://github.com/jahon27/diploma_thesis/blob/main/src/ai_experiments/openrouter_generator.py) (AI Generator), [`src/outputs/user_auth_gen_model_1.py`](https://github.com/jahon27/diploma_thesis/blob/main/src/outputs/user_auth_gen_model_1.py) (Generated Python)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["UML Input"]
  node_class_extract["Class Extractor<br/>[class_extractor.py]"]
  node_sequence_extract["Sequence Extractor"]
  node_sqd_extract["SQD Extraction"]
end

subgraph group_parser["Parsing and Generation"]
  node_main["Main Workflow<br/>[main.py]"]
  node_sqd["SQD Language<br/>[SequenceDiagram.g4]"]
  node_antlr_parser["ANTLR Parser"]
  node_model_builder["Sequence Model"]
  node_code_generator["Sequence Generator"]
  node_python_output["Generated Python"]
end

subgraph group_compare["Experiments and Evaluation"]
  node_ai_generator["AI Generator"]
  node_evaluator["Fidelity Evaluator<br/>[evaluator.py]"]
  node_reference["Reference Code"]
  node_results["Evaluation Results"]
end

node_engineer(("Engineer"))
node_class_diagram["Class Diagram"]
node_sequence_diagram["Sequence Diagram"]
node_openrouter{{"OpenRouter API"}}

node_engineer -->|"runs"| node_main
node_class_diagram -->|"provides input"| node_main
node_sequence_diagram -->|"provides input"| node_main
node_main -->|"calls"| node_class_extract
node_main -->|"calls"| node_sequence_extract
node_class_extract -->|"generates class code"| node_python_output
node_sequence_extract -->|"uses SQD extraction"| node_sqd_extract
node_sqd_extract -->|"emits"| node_sqd
node_sequence_extract -->|"parses SQD"| node_antlr_parser
node_antlr_parser -->|"builds semantic model"| node_model_builder
node_model_builder -->|"provides model"| node_code_generator
node_sequence_extract -->|"generates sequence code"| node_code_generator
node_main -->|"writes combined code"| node_python_output
node_class_diagram -.->|"supplies XML"| node_ai_generator
node_sequence_diagram -.->|"supplies XML"| node_ai_generator
node_ai_generator -.->|"requests generation"| node_openrouter
node_ai_generator -.->|"writes AI output"| node_python_output
node_python_output -->|"candidate code"| node_evaluator
node_reference -->|"comparison baseline"| node_evaluator
node_evaluator -->|"records metrics"| node_results

click node_class_diagram "https://github.com/jahon27/diploma_thesis/blob/main/src/diagrams/user-auth-class.drawio.xml"
click node_sequence_diagram "https://github.com/jahon27/diploma_thesis/blob/main/src/diagrams/user-auth-sequence.drawio.xml"
click node_main "https://github.com/jahon27/diploma_thesis/blob/main/src/main.py"
click node_class_extract "https://github.com/jahon27/diploma_thesis/blob/main/src/extractors/class_extractor.py"
click node_sequence_extract "https://github.com/jahon27/diploma_thesis/blob/main/src/extractors/sequence_extractor_with_antlr_grammar.py"
click node_sqd_extract "https://github.com/jahon27/diploma_thesis/blob/main/src/extractors/sequence_to_sqd_extractor.py"
click node_sqd "https://github.com/jahon27/diploma_thesis/blob/main/src/antlr/SequenceDiagram.g4"
click node_antlr_parser "https://github.com/jahon27/diploma_thesis/blob/main/src/antlr/SequenceDiagramParser.py"
click node_model_builder "https://github.com/jahon27/diploma_thesis/blob/main/src/antlr/sequence_model_builder.py"
click node_code_generator "https://github.com/jahon27/diploma_thesis/blob/main/src/antlr/sequence_code_generator.py"
click node_python_output "https://github.com/jahon27/diploma_thesis/blob/main/src/outputs/user_auth_gen_model_1.py"
click node_ai_generator "https://github.com/jahon27/diploma_thesis/blob/main/src/ai_experiments/openrouter_generator.py"
click node_evaluator "https://github.com/jahon27/diploma_thesis/blob/main/src/evaluation/evaluator.py"
click node_reference "https://github.com/jahon27/diploma_thesis/blob/main/src/reference/user_auth_reference.py"
click node_results "https://github.com/jahon27/diploma_thesis/blob/main/src/evaluation/results/evaluation_results.csv"

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_class_extract,node_sequence_extract,node_sqd_extract toneBlue
class node_main,node_sqd,node_antlr_parser,node_model_builder,node_code_generator,node_python_output toneAmber
class node_ai_generator,node_evaluator,node_reference,node_results,node_openrouter toneMint
class node_engineer toneIndigo
class node_class_diagram,node_sequence_diagram toneTeal
```

## Components

### UML Input

- [Class Extractor](https://github.com/jahon27/diploma_thesis/blob/main/src/extractors/class_extractor.py): `src/extractors/class_extractor.py`
- [Sequence Extractor](https://github.com/jahon27/diploma_thesis/blob/main/src/extractors/sequence_extractor_with_antlr_grammar.py): `src/extractors/sequence_extractor_with_antlr_grammar.py`
- [SQD Extraction](https://github.com/jahon27/diploma_thesis/blob/main/src/extractors/sequence_to_sqd_extractor.py): `src/extractors/sequence_to_sqd_extractor.py`

### Parsing and Generation

- [Main Workflow](https://github.com/jahon27/diploma_thesis/blob/main/src/main.py): `src/main.py`
- [SQD Language](https://github.com/jahon27/diploma_thesis/blob/main/src/antlr/SequenceDiagram.g4): `src/antlr/SequenceDiagram.g4`
- [ANTLR Parser](https://github.com/jahon27/diploma_thesis/blob/main/src/antlr/SequenceDiagramParser.py): `src/antlr/SequenceDiagramParser.py`
- [Sequence Model](https://github.com/jahon27/diploma_thesis/blob/main/src/antlr/sequence_model_builder.py): `src/antlr/sequence_model_builder.py`
- [Sequence Generator](https://github.com/jahon27/diploma_thesis/blob/main/src/antlr/sequence_code_generator.py): `src/antlr/sequence_code_generator.py`
- [Generated Python](https://github.com/jahon27/diploma_thesis/blob/main/src/outputs/user_auth_gen_model_1.py): `src/outputs/user_auth_gen_model_1.py`

### Experiments and Evaluation

- [AI Generator](https://github.com/jahon27/diploma_thesis/blob/main/src/ai_experiments/openrouter_generator.py): `src/ai_experiments/openrouter_generator.py`
- [Fidelity Evaluator](https://github.com/jahon27/diploma_thesis/blob/main/src/evaluation/evaluator.py): `src/evaluation/evaluator.py`
- [Reference Code](https://github.com/jahon27/diploma_thesis/blob/main/src/reference/user_auth_reference.py): `src/reference/user_auth_reference.py`
- [Evaluation Results](https://github.com/jahon27/diploma_thesis/blob/main/src/evaluation/results/evaluation_results.csv): `src/evaluation/results/evaluation_results.csv`

### Other components

- **Engineer**
- [Class Diagram](https://github.com/jahon27/diploma_thesis/blob/main/src/diagrams/user-auth-class.drawio.xml): `src/diagrams/user-auth-class.drawio.xml`
- [Sequence Diagram](https://github.com/jahon27/diploma_thesis/blob/main/src/diagrams/user-auth-sequence.drawio.xml): `src/diagrams/user-auth-sequence.drawio.xml`
- **OpenRouter API**

## Connections

- Engineer → Main Workflow: runs
- Class Diagram → Main Workflow: provides input
- Sequence Diagram → Main Workflow: provides input
- Main Workflow → Class Extractor: calls
- Main Workflow → Sequence Extractor: calls
- Class Extractor → Generated Python: generates class code
- Sequence Extractor → SQD Extraction: uses SQD extraction
- SQD Extraction → SQD Language: emits
- Sequence Extractor → ANTLR Parser: parses SQD
- ANTLR Parser → Sequence Model: builds semantic model
- Sequence Model → Sequence Generator: provides model
- Sequence Extractor → Sequence Generator: generates sequence code
- Main Workflow → Generated Python: writes combined code
- Class Diagram → AI Generator: supplies XML
- Sequence Diagram → AI Generator: supplies XML
- AI Generator → OpenRouter API: requests generation
- AI Generator → Generated Python: writes AI output
- Generated Python → Fidelity Evaluator: candidate code
- Reference Code → Fidelity Evaluator: comparison baseline
- Fidelity Evaluator → Evaluation Results: records metrics
