# gss-dcg/testpy architecture

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

- Interactive diagram: https://gitdiagram.com/gss-dcg/testpy
- Repository: https://github.com/gss-dcg/testpy

## Overview

This repository implements a Dlubal wind-and-snow data calculator exposed through an XML-based tool runner. The principal workflow is: a caller supplies a tool request, the runner parses its XML and variables, the Dlubal application obtains location inputs and coordinates calculator work, and results and notes are serialized as an answer. The calculator also handles country-specific map selection, cached/API data retrieval, CSV parsing, and unit conversion. Source excerpts show the runner and data model, but omit parts of the execution path; uncertain links are therefore not inferred.

Main entry points: [`Dlubal_calculator.py`](https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py) (Calculator), [`Dlubal.py`](https://github.com/gss-dcg/testpy/blob/main/Dlubal.py) (Dlubal app), [`runner/Tool_Runner.py`](https://github.com/gss-dcg/testpy/blob/main/runner/Tool_Runner.py) (Tool runner), [`runner/Request.py`](https://github.com/gss-dcg/testpy/blob/main/runner/Request.py) (Request parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Dlubal application"]
  node_dlubal_app["Dlubal app<br/>[Dlubal.py]"]
end

subgraph group_calculation["Weather calculation"]
  node_calc["Calculator"]
  node_map_lookup["Map selection"]
  node_data_fetch["Cache and API fetch"]
  node_csv_parse["CSV parsing"]
  node_data_processing["Data processing"]
  node_unit_converter["Unit conversion"]
end

subgraph group_runtime["XML tool runtime"]
  node_runner["Tool runner<br/>[Tool_Runner.py]"]
  node_prep_base["Prep base<br/>[prep_base.py]"]
end

subgraph group_models["Request and answer models"]
  node_request["Request parser<br/>[Request.py]"]
  node_tool_model["Tool metadata<br/>[Tool.py]"]
  node_variable["Typed variables<br/>[Variable.py]"]
  node_answer["Answer builder<br/>[Answer.py]"]
end

node_caller(("Tool caller"))
node_dlubal_service["Dlubal data service"]

node_caller -->|"invokes"| node_dlubal_app
node_dlubal_app -->|"extends and runs"| node_runner
node_dlubal_app -->|"initializes"| node_calc
node_dlubal_app -->|"reads wind and snow"| node_calc
node_runner -->|"uses request"| node_request
node_request -->|"parses metadata"| node_tool_model
node_request -->|"creates variables"| node_variable
node_runner -->|"delegates XML output"| node_answer
node_answer -->|"builds variable values"| node_variable
node_prep_base -->|"extends"| node_runner
node_calc -->|"selects maps"| node_map_lookup
node_calc -->|"loads data"| node_data_fetch
node_data_fetch -->|"parses cached or fetched CSV"| node_csv_parse
node_data_fetch -->|"requests data"| node_dlubal_service
node_calc -->|"processes data"| node_data_processing
node_data_processing -->|"converts units"| node_unit_converter

click node_dlubal_app "https://github.com/gss-dcg/testpy/blob/main/Dlubal.py"
click node_calc "https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py"
click node_map_lookup "https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py"
click node_data_fetch "https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py"
click node_csv_parse "https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py"
click node_data_processing "https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py"
click node_unit_converter "https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py"
click node_runner "https://github.com/gss-dcg/testpy/blob/main/runner/Tool_Runner.py"
click node_request "https://github.com/gss-dcg/testpy/blob/main/runner/Request.py"
click node_tool_model "https://github.com/gss-dcg/testpy/blob/main/runner/Tool.py"
click node_variable "https://github.com/gss-dcg/testpy/blob/main/runner/Variable.py"
click node_answer "https://github.com/gss-dcg/testpy/blob/main/runner/Answer.py"
click node_prep_base "https://github.com/gss-dcg/testpy/blob/main/runner/prep_base.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_dlubal_app toneBlue
class node_calc,node_map_lookup,node_data_fetch,node_csv_parse,node_data_processing,node_unit_converter toneAmber
class node_runner,node_prep_base toneMint
class node_request,node_tool_model,node_variable,node_answer toneRose
class node_caller,node_dlubal_service toneIndigo
```

## Components

### Dlubal application

- [Dlubal app](https://github.com/gss-dcg/testpy/blob/main/Dlubal.py): `Dlubal.py`

### Weather calculation

- [Calculator](https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py): `Dlubal_calculator.py`
- [Map selection](https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py): `Dlubal_calculator.py`
- [Cache and API fetch](https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py): `Dlubal_calculator.py`
- [CSV parsing](https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py): `Dlubal_calculator.py`
- [Data processing](https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py): `Dlubal_calculator.py`
- [Unit conversion](https://github.com/gss-dcg/testpy/blob/main/Dlubal_calculator.py): `Dlubal_calculator.py`

### XML tool runtime

- [Tool runner](https://github.com/gss-dcg/testpy/blob/main/runner/Tool_Runner.py): `runner/Tool_Runner.py`
- [Prep base](https://github.com/gss-dcg/testpy/blob/main/runner/prep_base.py): `runner/prep_base.py`

### Request and answer models

- [Request parser](https://github.com/gss-dcg/testpy/blob/main/runner/Request.py): `runner/Request.py`
- [Tool metadata](https://github.com/gss-dcg/testpy/blob/main/runner/Tool.py): `runner/Tool.py`
- [Typed variables](https://github.com/gss-dcg/testpy/blob/main/runner/Variable.py): `runner/Variable.py`
- [Answer builder](https://github.com/gss-dcg/testpy/blob/main/runner/Answer.py): `runner/Answer.py`

### Other components

- **Tool caller**
- **Dlubal data service**

## Connections

- Tool caller → Dlubal app: invokes (evidence: `Dlubal.py`)
- Dlubal app → Tool runner: extends and runs (evidence: `Dlubal.py`)
- Dlubal app → Calculator: initializes (evidence: `Dlubal.py`)
- Dlubal app → Calculator: reads wind and snow (evidence: `Dlubal.py`)
- Tool runner → Request parser: uses request (evidence: `runner/Tool_Runner.py`)
- Request parser → Tool metadata: parses metadata (evidence: `runner/Request.py`)
- Request parser → Typed variables: creates variables (evidence: `runner/Request.py`)
- Tool runner → Answer builder: delegates XML output (evidence: `runner/Tool_Runner.py`)
- Answer builder → Typed variables: builds variable values (evidence: `runner/Answer.py`)
- Prep base → Tool runner: extends (evidence: `runner/prep_base.py`)
- Calculator → Map selection: selects maps (evidence: `Dlubal_calculator.py`)
- Calculator → Cache and API fetch: loads data (evidence: `Dlubal_calculator.py`)
- Cache and API fetch → CSV parsing: parses cached or fetched CSV (evidence: `Dlubal_calculator.py`)
- Cache and API fetch → Dlubal data service: requests data (evidence: `Dlubal_calculator.py`)
- Calculator → Data processing: processes data (evidence: `Dlubal_calculator.py`)
- Data processing → Unit conversion: converts units (evidence: `Dlubal_calculator.py`)
