# rebug42/span_code_test architecture

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

- Interactive diagram: https://gitdiagram.com/rebug42/span_code_test
- Repository: https://github.com/rebug42/span_code_test

## Overview

This is a command-line calculator for English First Division 1974/75 standings. The principal workflow starts with a user supplying a weekly results file and selecting final, specific-week, or all-weeks output. The application discovers the season files, loads and accumulates match results, ranks teams by points, historical goal average, then goals scored, and writes CSV standings while printing tables. The model layer represents match results and cumulative team statistics. README capabilities guide the workflow map; source excerpts support the listed runtime calls.

Main entry points: [`src/cli.py`](https://github.com/rebug42/span_code_test/blob/main/src/cli.py) (CLI application), [`src/repository.py`](https://github.com/rebug42/span_code_test/blob/main/src/repository.py) (Results repository), [`src/presenter.py`](https://github.com/rebug42/span_code_test/blob/main/src/presenter.py) (Standings presenter), [`main.py`](https://github.com/rebug42/span_code_test/blob/main/main.py) (Entry point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_main["Entry point<br/>[main.py]"]
end

subgraph group_workflow["Season workflow"]
  node_cli["CLI application<br/>[cli.py]"]
  node_weekly["Weekly results"]
  node_repository["Results repository<br/>[repository.py]"]
end

subgraph group_domain["Standings domain"]
  node_match["Match and team models<br/>[models.py]"]
  node_service["Standings calculator<br/>[service.py]"]
end

subgraph group_output["Results output"]
  node_presenter["Standings presenter<br/>[presenter.py]"]
  node_standings["Standings CSV files"]
end

node_user(("CLI user"))
node_stdout(("Console output"))

node_user -->|"runs"| node_main
node_main -->|"starts"| node_cli
node_cli -->|"discovers and loads"| node_repository
node_repository -->|"reads"| node_weekly
node_repository -->|"creates matches"| node_match
node_cli -->|"calculates standings"| node_service
node_service -->|"updates team stats"| node_match
node_cli -->|"renders results"| node_presenter
node_presenter -->|"writes CSV"| node_standings
node_presenter -->|"prints tables"| node_stdout

click node_main "https://github.com/rebug42/span_code_test/blob/main/main.py"
click node_cli "https://github.com/rebug42/span_code_test/blob/main/src/cli.py"
click node_weekly "https://github.com/rebug42/span_code_test/tree/main/data/results"
click node_repository "https://github.com/rebug42/span_code_test/blob/main/src/repository.py"
click node_match "https://github.com/rebug42/span_code_test/blob/main/src/models.py"
click node_service "https://github.com/rebug42/span_code_test/blob/main/src/service.py"
click node_presenter "https://github.com/rebug42/span_code_test/blob/main/src/presenter.py"
click node_standings "https://github.com/rebug42/span_code_test/tree/main/data/standings"

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_main,node_user toneBlue
class node_cli,node_weekly,node_repository toneAmber
class node_match,node_service toneMint
class node_presenter,node_standings toneRose
class node_stdout toneIndigo
```

## Components

### CLI entry

- [Entry point](https://github.com/rebug42/span_code_test/blob/main/main.py): `main.py`

### Season workflow

- [CLI application](https://github.com/rebug42/span_code_test/blob/main/src/cli.py): `src/cli.py`
- [Weekly results](https://github.com/rebug42/span_code_test/tree/main/data/results): `data/results`
- [Results repository](https://github.com/rebug42/span_code_test/blob/main/src/repository.py): `src/repository.py`

### Standings domain

- [Match and team models](https://github.com/rebug42/span_code_test/blob/main/src/models.py): `src/models.py`
- [Standings calculator](https://github.com/rebug42/span_code_test/blob/main/src/service.py): `src/service.py`

### Results output

- [Standings presenter](https://github.com/rebug42/span_code_test/blob/main/src/presenter.py): `src/presenter.py`
- [Standings CSV files](https://github.com/rebug42/span_code_test/tree/main/data/standings): `data/standings`

### Other components

- **CLI user**
- **Console output**

## Connections

- CLI user → Entry point: runs
- Entry point → CLI application: starts
- CLI application → Results repository: discovers and loads
- Results repository → Weekly results: reads
- Results repository → Match and team models: creates matches
- CLI application → Standings calculator: calculates standings
- Standings calculator → Match and team models: updates team stats
- CLI application → Standings presenter: renders results
- Standings presenter → Standings CSV files: writes CSV
- Standings presenter → Console output: prints tables
