# robertolechowski/k2000_visa_generator architecture

> Architecture diagram of the GitHub repository robertolechowski/k2000_visa_generator, 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/robertolechowski/k2000_visa_generator
- Repository: https://github.com/robertolechowski/k2000_visa_generator

## Overview

This Flask application generates Philips CT service-access codes from a device ID and validity period. The principal workflow is a user submitting an ID through the web app; the generator parses it, computes the date-bound code, formats it, and returns the result. The algorithm uses separate time, seed, transform, and fixed-width integer layers. The web app also proxies analytics events. The graph follows shown calls and README capabilities; template and browser-script internals were not sampled.

Main entry points: [`app/WebApp.py`](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/WebApp.py) (Flask web app), [`app/Computer.py`](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Computer.py) (Code computer), [`app/Uint64.py`](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Uint64.py) (64-bit arithmetic), [`app/PhilipsGenerator.py`](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/PhilipsGenerator.py) (Philips generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_webapp["Flask web app<br/>[WebApp.py]"]
  node_page["Generator page<br/>[index.html]"]
  node_tracker["Browser tracker<br/>[tracker.js]"]
end

subgraph group_algorithm["Code algorithm"]
  node_generator["Philips generator"]
  node_parser["Device ID parser<br/>[DeviceIdParser.py]"]
  node_computer["Code computer<br/>[Computer.py]"]
  node_transforms["Seed and time transforms<br/>[Transform.py]"]
  node_timehelper["Time conversion<br/>[TimeHelper.py]"]
  node_uint32["32-bit arithmetic<br/>[Uint32.py]"]
  node_uint64["64-bit arithmetic<br/>[Uint64.py]"]
end

subgraph group_runtime["Application runtime"]
  node_entrypoint["WSGI entrypoint<br/>[wsgi.py]"]
  node_logging["Logging setup<br/>[config_builder.py]"]
end

node_user(("User"))
node_analytics["Analytics service"]

node_user -->|"submits request"| node_webapp
node_webapp -->|"renders"| node_page
node_webapp -->|"generates code"| node_generator
node_generator -->|"parses ID"| node_parser
node_generator -->|"computes code"| node_computer
node_generator -->|"formats code"| node_uint64
node_parser -->|"creates value"| node_uint32
node_computer -->|"applies transforms"| node_transforms
node_computer -->|"converts time"| node_timehelper
node_computer -->|"uses arithmetic"| node_uint32
node_computer -->|"uses arithmetic"| node_uint64
node_transforms -->|"uses arithmetic"| node_uint32
node_transforms -->|"uses arithmetic"| node_uint64
node_timehelper -->|"converts timestamp"| node_uint64
node_uint64 -->|"builds words"| node_uint32
node_entrypoint -->|"creates app"| node_webapp
node_entrypoint -->|"initializes logging"| node_logging
node_webapp -->|"proxies events"| node_analytics
node_tracker -.->|"sends events"| node_webapp

click node_webapp "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/WebApp.py"
click node_page "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/templates/index.html"
click node_tracker "https://github.com/robertolechowski/k2000_visa_generator/blob/main/static/tracker.js"
click node_generator "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/PhilipsGenerator.py"
click node_parser "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/DeviceIdParser.py"
click node_computer "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Computer.py"
click node_transforms "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Transform.py"
click node_timehelper "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/TimeHelper.py"
click node_uint32 "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Uint32.py"
click node_uint64 "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Uint64.py"
click node_entrypoint "https://github.com/robertolechowski/k2000_visa_generator/blob/main/wsgi.py"
click node_logging "https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/helpers/config_builder.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_webapp,node_page,node_tracker,node_user toneBlue
class node_generator,node_parser,node_computer,node_transforms,node_timehelper,node_uint32,node_uint64 toneAmber
class node_entrypoint,node_logging toneMint
class node_analytics toneIndigo
```

## Components

### Web interface

- [Flask web app](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/WebApp.py): `app/WebApp.py`
- [Generator page](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/templates/index.html): `app/templates/index.html`
- [Browser tracker](https://github.com/robertolechowski/k2000_visa_generator/blob/main/static/tracker.js): `static/tracker.js`

### Code algorithm

- [Philips generator](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/PhilipsGenerator.py): `app/PhilipsGenerator.py`
- [Device ID parser](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/DeviceIdParser.py): `app/DeviceIdParser.py`
- [Code computer](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Computer.py): `app/Computer.py`
- [Seed and time transforms](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Transform.py): `app/Transform.py`
- [Time conversion](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/TimeHelper.py): `app/TimeHelper.py`
- [32-bit arithmetic](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Uint32.py): `app/Uint32.py`
- [64-bit arithmetic](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/Uint64.py): `app/Uint64.py`

### Application runtime

- [WSGI entrypoint](https://github.com/robertolechowski/k2000_visa_generator/blob/main/wsgi.py): `wsgi.py`
- [Logging setup](https://github.com/robertolechowski/k2000_visa_generator/blob/main/app/helpers/config_builder.py): `app/helpers/config_builder.py`

### Other components

- **User**
- **Analytics service**

## Connections

- User → Flask web app: submits request (evidence: `app/WebApp.py`)
- Flask web app → Generator page: renders (evidence: `app/WebApp.py`)
- Flask web app → Philips generator: generates code (evidence: `app/WebApp.py`)
- Philips generator → Device ID parser: parses ID (evidence: `app/PhilipsGenerator.py`)
- Philips generator → Code computer: computes code (evidence: `app/PhilipsGenerator.py`)
- Philips generator → 64-bit arithmetic: formats code (evidence: `app/PhilipsGenerator.py`)
- Device ID parser → 32-bit arithmetic: creates value (evidence: `app/DeviceIdParser.py`)
- Code computer → Seed and time transforms: applies transforms (evidence: `app/Computer.py`)
- Code computer → Time conversion: converts time (evidence: `app/Computer.py`)
- Code computer → 32-bit arithmetic: uses arithmetic (evidence: `app/Computer.py`)
- Code computer → 64-bit arithmetic: uses arithmetic (evidence: `app/Computer.py`)
- Seed and time transforms → 32-bit arithmetic: uses arithmetic (evidence: `app/Transform.py`)
- Seed and time transforms → 64-bit arithmetic: uses arithmetic (evidence: `app/Transform.py`)
- Time conversion → 64-bit arithmetic: converts timestamp (evidence: `app/TimeHelper.py`)
- 64-bit arithmetic → 32-bit arithmetic: builds words (evidence: `app/Uint64.py`)
- WSGI entrypoint → Flask web app: creates app (evidence: `wsgi.py`)
- WSGI entrypoint → Logging setup: initializes logging (evidence: `wsgi.py`)
- Flask web app → Analytics service: proxies events (evidence: `app/WebApp.py`)
- Browser tracker → Flask web app: sends events
