# drotyk/wheat-yield-predictor architecture

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

- Interactive diagram: https://gitdiagram.com/drotyk/wheat-yield-predictor
- Repository: https://github.com/drotyk/wheat-yield-predictor

## Overview

A C++ console application guides the user through selecting wheat variety, soil, fertilizer, region, and seasonal weather, then calculates and displays an estimated yield. `main.cpp` is the interactive entry point; it loads the JSON-backed options and passes the selections to the predictor. The predictor applies the documented agronomic factors, variety sensitivity and resistance, then clamps the result to the variety’s yield bounds. The README documents these capabilities; the sampled implementation supports the loading, selection, calculation, and display relationships shown here.

Main entry points: [`src/ConfigLoader.cpp`](https://github.com/drotyk/wheat-yield-predictor/blob/main/src/ConfigLoader.cpp) (Config loader), [`src/WheatYieldPredictor.cpp`](https://github.com/drotyk/wheat-yield-predictor/blob/main/src/WheatYieldPredictor.cpp) (Yield predictor), [`main.cpp`](https://github.com/drotyk/wheat-yield-predictor/blob/main/main.cpp) (Interactive menu), [`cls/WheatVariety.h`](https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/WheatVariety.h) (Wheat variety)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Console interaction"]
  node_cli["Interactive menu<br/>[main.cpp]"]
end

subgraph group_configuration["Configuration"]
  node_config_loader["Config loader<br/>[ConfigLoader.cpp]"]
  node_config_data["Agronomy config<br/>[config.json]"]
end

subgraph group_agronomy["Agronomic inputs"]
  node_variety["Wheat variety<br/>[WheatVariety.h]"]
  node_variety_bonus["Variety bonuses<br/>[VarietyBonus.h]"]
  node_soil["Soil type<br/>[SoilType.h]"]
  node_fertilizer["Fertilizer effect<br/>[FertilizerEffect.h]"]
  node_region["Agroclimatic region<br/>[Region.h]"]
  node_weather["Seasonal weather<br/>[WeatherCondition.h]"]
end

subgraph group_prediction["Yield prediction"]
  node_predictor["Yield predictor"]
end

node_user(("User"))

node_user -->|"enters selections"| node_cli
node_cli -->|"loads options"| node_config_loader
node_config_loader -->|"reads JSON"| node_config_data
node_config_loader -->|"parses varieties"| node_variety
node_config_loader -->|"parses soils"| node_soil
node_config_loader -->|"parses fertilizers"| node_fertilizer
node_config_loader -->|"parses regions"| node_region
node_config_loader -->|"parses weather"| node_weather
node_config_loader -->|"parses bonuses"| node_variety_bonus
node_cli -->|"passes selections"| node_predictor
node_predictor -->|"reads yield traits"| node_variety
node_predictor -->|"reads sensitivities"| node_variety_bonus
node_predictor -->|"reads soil factor"| node_soil
node_predictor -->|"reads fertilizer effect"| node_fertilizer
node_predictor -->|"reads region factor"| node_region
node_predictor -->|"averages impacts"| node_weather
node_predictor -->|"displays prediction"| node_cli

click node_cli "https://github.com/drotyk/wheat-yield-predictor/blob/main/main.cpp"
click node_config_loader "https://github.com/drotyk/wheat-yield-predictor/blob/main/src/ConfigLoader.cpp"
click node_config_data "https://github.com/drotyk/wheat-yield-predictor/blob/main/data/config.json"
click node_variety "https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/WheatVariety.h"
click node_variety_bonus "https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/VarietyBonus.h"
click node_soil "https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/SoilType.h"
click node_fertilizer "https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/FertilizerEffect.h"
click node_region "https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/Region.h"
click node_weather "https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/WeatherCondition.h"
click node_predictor "https://github.com/drotyk/wheat-yield-predictor/blob/main/src/WheatYieldPredictor.cpp"

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_cli,node_user toneBlue
class node_config_loader,node_config_data toneAmber
class node_variety,node_variety_bonus,node_soil,node_fertilizer,node_region,node_weather toneMint
class node_predictor toneRose
```

## Components

### Console interaction

- [Interactive menu](https://github.com/drotyk/wheat-yield-predictor/blob/main/main.cpp): `main.cpp`

### Configuration

- [Config loader](https://github.com/drotyk/wheat-yield-predictor/blob/main/src/ConfigLoader.cpp): `src/ConfigLoader.cpp`
- [Agronomy config](https://github.com/drotyk/wheat-yield-predictor/blob/main/data/config.json): `data/config.json`

### Agronomic inputs

- [Wheat variety](https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/WheatVariety.h): `cls/WheatVariety.h`
- [Variety bonuses](https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/VarietyBonus.h): `cls/VarietyBonus.h`
- [Soil type](https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/SoilType.h): `cls/SoilType.h`
- [Fertilizer effect](https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/FertilizerEffect.h): `cls/FertilizerEffect.h`
- [Agroclimatic region](https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/Region.h): `cls/Region.h`
- [Seasonal weather](https://github.com/drotyk/wheat-yield-predictor/blob/main/cls/WeatherCondition.h): `cls/WeatherCondition.h`

### Yield prediction

- [Yield predictor](https://github.com/drotyk/wheat-yield-predictor/blob/main/src/WheatYieldPredictor.cpp): `src/WheatYieldPredictor.cpp`

### Other components

- **User**

## Connections

- User → Interactive menu: enters selections
- Interactive menu → Config loader: loads options
- Config loader → Agronomy config: reads JSON
- Config loader → Wheat variety: parses varieties
- Config loader → Soil type: parses soils
- Config loader → Fertilizer effect: parses fertilizers
- Config loader → Agroclimatic region: parses regions
- Config loader → Seasonal weather: parses weather
- Config loader → Variety bonuses: parses bonuses
- Interactive menu → Yield predictor: passes selections
- Yield predictor → Wheat variety: reads yield traits
- Yield predictor → Variety bonuses: reads sensitivities
- Yield predictor → Soil type: reads soil factor
- Yield predictor → Fertilizer effect: reads fertilizer effect
- Yield predictor → Agroclimatic region: reads region factor
- Yield predictor → Seasonal weather: averages impacts
- Yield predictor → Interactive menu: displays prediction
