# valvesoftware/counter-strike_regional_standings architecture

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

- Interactive diagram: https://gitdiagram.com/valvesoftware/counter-strike_regional_standings
- Repository: https://github.com/valvesoftware/counter-strike_regional_standings

## Overview

This repository implements CS2 Regional Standings: match and event records are converted into roster-specific teams, seeded from performance factors, updated through match outcomes, and published as regional standings with per-roster detail. The README also describes a model-evaluation workflow that compares expected and observed match win rates over weekly samples. Source excerpts show the ranking and reporting calls; some evaluation internals and the report’s file-writing details are only partly sampled, so those links are limited to documented or directly visible relationships.

Main entry points: [`model/ranking.js`](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/ranking.js) (Ranking orchestration), [`model/report.js`](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/report.js) (Markdown reporting), [`model/data_loader.js`](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/data_loader.js) (Data loader), [`model/fit.js`](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/fit.js) (Fit analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Match ingestion"]
  node_loader["Data loader<br/>[data_loader.js]"]
  node_teams["Roster teams<br/>[team.js]"]
  node_regions["Region mapping<br/>[region.js]"]
end

subgraph group_rank["Ranking model"]
  node_ranking["Ranking orchestration<br/>[ranking.js]"]
  node_context["Ranking context<br/>[ranking_context.js]"]
  node_remap["Value remapping"]
  node_glicko["Glicko ratings<br/>[glicko.js]"]
  node_outliers["Outlier selection<br/>[nth_highest.js]"]
end

subgraph group_eval["Model evaluation"]
  node_fitentry["Fit entry point<br/>[main_fit.js]"]
  node_fit["Fit analysis<br/>[fit.js]"]
end

subgraph group_publish["Standings output"]
  node_table["Match table<br/>[table.js]"]
  node_report["Markdown reporting<br/>[report.js]"]
  node_entry["Standings entry point<br/>[main.js]"]
end

node_analyst(("Standings operator"))
node_matches["Match and event data"]
node_standings["Published standings"]

node_analyst -->|"runs"| node_entry
node_matches -->|"loads"| node_loader
node_entry -->|"generates"| node_ranking
node_ranking -->|"loads data"| node_loader
node_loader -->|"creates rosters"| node_teams
node_loader -->|"maps regions"| node_regions
node_ranking -->|"configures"| node_context
node_context -->|"remaps time"| node_remap
node_ranking -->|"rates matches"| node_glicko
node_teams -->|"selects results"| node_outliers
node_ranking -->|"scales seeds"| node_remap
node_fitentry -->|"starts analysis"| node_fit
node_fit -->|"requests rankings"| node_ranking
node_fit -->|"estimates wins"| node_glicko
node_entry -->|"formats results"| node_report
node_report -->|"builds tables"| node_table
node_report -->|"uses ranking data"| node_ranking
node_report -->|"selects details"| node_outliers
node_report -.->|"writes reports"| node_standings

click node_matches "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/data/matchdata_sample_20230829.json"
click node_loader "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/data_loader.js"
click node_teams "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/team.js"
click node_regions "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/util/region.js"
click node_ranking "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/ranking.js"
click node_context "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/ranking_context.js"
click node_remap "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/util/remap_value_clamped.js"
click node_glicko "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/glicko.js"
click node_outliers "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/util/nth_highest.js"
click node_fitentry "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/main_fit.js"
click node_fit "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/fit.js"
click node_table "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/table.js"
click node_report "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/report.js"
click node_entry "https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/main.js"
click node_standings "https://github.com/valvesoftware/counter-strike_regional_standings/tree/main/invitation/2024/details/2024_08_06"

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_loader,node_teams,node_regions toneBlue
class node_ranking,node_context,node_remap,node_glicko,node_outliers toneAmber
class node_fitentry,node_fit toneMint
class node_table,node_report,node_entry toneRose
class node_analyst toneIndigo
class node_matches,node_standings toneTeal
```

## Components

### Match ingestion

- [Data loader](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/data_loader.js): `model/data_loader.js`
- [Roster teams](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/team.js): `model/team.js`
- [Region mapping](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/util/region.js): `model/util/region.js`

### Ranking model

- [Ranking orchestration](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/ranking.js): `model/ranking.js`
- [Ranking context](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/ranking_context.js): `model/ranking_context.js`
- [Value remapping](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/util/remap_value_clamped.js): `model/util/remap_value_clamped.js`
- [Glicko ratings](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/glicko.js): `model/glicko.js`
- [Outlier selection](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/util/nth_highest.js): `model/util/nth_highest.js`

### Model evaluation

- [Fit entry point](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/main_fit.js): `model/main_fit.js`
- [Fit analysis](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/fit.js): `model/fit.js`

### Standings output

- [Match table](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/table.js): `model/table.js`
- [Markdown reporting](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/report.js): `model/report.js`
- [Standings entry point](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/model/main.js): `model/main.js`

### Other components

- **Standings operator**
- [Match and event data](https://github.com/valvesoftware/counter-strike_regional_standings/blob/main/data/matchdata_sample_20230829.json): `data/matchdata_sample_20230829.json`
- [Published standings](https://github.com/valvesoftware/counter-strike_regional_standings/tree/main/invitation/2024/details/2024_08_06): `invitation/2024/details/2024_08_06`

## Connections

- Standings operator → Standings entry point: runs (evidence: `model/main.js`)
- Match and event data → Data loader: loads (evidence: `model/data_loader.js`)
- Standings entry point → Ranking orchestration: generates (evidence: `model/main.js`)
- Ranking orchestration → Data loader: loads data (evidence: `model/ranking.js`)
- Data loader → Roster teams: creates rosters (evidence: `model/data_loader.js`)
- Data loader → Region mapping: maps regions (evidence: `model/data_loader.js`)
- Ranking orchestration → Ranking context: configures (evidence: `model/ranking.js`)
- Ranking context → Value remapping: remaps time (evidence: `model/ranking_context.js`)
- Ranking orchestration → Glicko ratings: rates matches (evidence: `model/ranking.js`)
- Roster teams → Outlier selection: selects results (evidence: `model/team.js`)
- Ranking orchestration → Value remapping: scales seeds (evidence: `model/ranking.js`)
- Fit entry point → Fit analysis: starts analysis (evidence: `model/main_fit.js`)
- Fit analysis → Ranking orchestration: requests rankings (evidence: `model/fit.js`)
- Fit analysis → Glicko ratings: estimates wins (evidence: `model/fit.js`)
- Standings entry point → Markdown reporting: formats results (evidence: `model/main.js`)
- Markdown reporting → Match table: builds tables (evidence: `model/report.js`)
- Markdown reporting → Ranking orchestration: uses ranking data (evidence: `model/report.js`)
- Markdown reporting → Outlier selection: selects details (evidence: `model/report.js`)
- Markdown reporting → Published standings: writes reports
