# nwuww/phi-analysaves architecture

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

- Interactive diagram: https://gitdiagram.com/nwuww/phi-analysaves
- Repository: https://github.com/nwuww/phi-analysaves

## Overview

Analysaves is a command-line analyzer for formatted game save files. Its main workflow loads save records and a song-name/ID mapping, accepts song- or difficulty-based analysis commands, extracts accuracy data, and reports statistics or fitted chart-constant results; users can also export results. The graph separates command routing, data loading/cache, and analysis logic. README documents the command capabilities; the supplied excerpts do not show every command handler or export implementation, so those relationships are limited to the documented workflow.

Main entry points: [`CommandProcessor.cs`](https://github.com/nwuww/phi-analysaves/blob/main/CommandProcessor.cs) (Command processor), [`DataLoader.cs`](https://github.com/nwuww/phi-analysaves/blob/main/DataLoader.cs) (Data loader), [`Program.cs`](https://github.com/nwuww/phi-analysaves/blob/main/Program.cs) (Application startup), [`Settings.cs`](https://github.com/nwuww/phi-analysaves/blob/main/Settings.cs) (Runtime settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and configuration"]
  node_program["Application startup<br/>[Program.cs]"]
  node_settings["Runtime settings<br/>[Settings.cs]"]
  node_commands["Command processor"]
end

subgraph group_data["Data and caching"]
  node_loader["Data loader<br/>[DataLoader.cs]"]
  node_save_records["Save records<br/>[Models.cs]"]
  node_song_mapping["Song mapping<br/>[Models.cs]"]
  node_cache_store[("Analysis cache<br/>[DataLoader.cs]")]
end

subgraph group_analysis["Analysis and fitting"]
  node_song_analysis["Song analysis"]
  node_difficulty_analysis["Difficulty analysis"]
  node_statistics["Statistics engine<br/>[AnalysisEngine.cs]"]
  node_fitting["Fitting and weights<br/>[FittingCoeff.cs]"]
  node_export["Analysis export"]
end

node_user(("CLI user"))
node_save_input["Save JSON files"]
node_song_input["Song list CSV"]

node_user -->|"enters commands"| node_commands
node_program -->|"creates settings"| node_settings
node_program -->|"loads data"| node_loader
node_program -->|"starts loop"| node_commands
node_program -->|"sets smoothing"| node_fitting
node_loader -->|"reads paths"| node_settings
node_loader -->|"reads saves"| node_save_input
node_loader -->|"reads song list"| node_song_input
node_loader -->|"builds records"| node_save_records
node_loader -->|"builds mapping"| node_song_mapping
node_loader -->|"reads and writes"| node_cache_store
node_commands -->|"updates settings"| node_settings
node_commands -->|"loads and queries"| node_loader
node_commands -->|"routes song mode"| node_song_analysis
node_commands -->|"routes difficulty mode"| node_difficulty_analysis
node_commands -->|"requests calculations"| node_statistics
node_commands -->|"uses fitting logic"| node_fitting
node_commands -.->|"exports results"| node_export
node_song_analysis -.->|"calculates statistics"| node_statistics
node_difficulty_analysis -.->|"calculates statistics"| node_statistics

click node_program "https://github.com/nwuww/phi-analysaves/blob/main/Program.cs"
click node_settings "https://github.com/nwuww/phi-analysaves/blob/main/Settings.cs"
click node_commands "https://github.com/nwuww/phi-analysaves/blob/main/CommandProcessor.cs"
click node_loader "https://github.com/nwuww/phi-analysaves/blob/main/DataLoader.cs"
click node_save_records "https://github.com/nwuww/phi-analysaves/blob/main/Models.cs"
click node_song_mapping "https://github.com/nwuww/phi-analysaves/blob/main/Models.cs"
click node_cache_store "https://github.com/nwuww/phi-analysaves/blob/main/DataLoader.cs"
click node_song_analysis "https://github.com/nwuww/phi-analysaves/blob/main/CommandProcessor.cs"
click node_difficulty_analysis "https://github.com/nwuww/phi-analysaves/blob/main/CommandProcessor.cs"
click node_statistics "https://github.com/nwuww/phi-analysaves/blob/main/AnalysisEngine.cs"
click node_fitting "https://github.com/nwuww/phi-analysaves/blob/main/FittingCoeff.cs"
click node_export "https://github.com/nwuww/phi-analysaves/blob/main/CommandProcessor.cs"

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_program,node_settings,node_commands,node_user toneBlue
class node_loader,node_save_records,node_song_mapping,node_cache_store toneAmber
class node_song_analysis,node_difficulty_analysis,node_statistics,node_fitting,node_export toneMint
class node_save_input,node_song_input toneIndigo
```

## Components

### CLI and configuration

- [Application startup](https://github.com/nwuww/phi-analysaves/blob/main/Program.cs): `Program.cs`
- [Runtime settings](https://github.com/nwuww/phi-analysaves/blob/main/Settings.cs): `Settings.cs`
- [Command processor](https://github.com/nwuww/phi-analysaves/blob/main/CommandProcessor.cs): `CommandProcessor.cs`

### Data and caching

- [Data loader](https://github.com/nwuww/phi-analysaves/blob/main/DataLoader.cs): `DataLoader.cs`
- [Save records](https://github.com/nwuww/phi-analysaves/blob/main/Models.cs): `Models.cs`
- [Song mapping](https://github.com/nwuww/phi-analysaves/blob/main/Models.cs): `Models.cs`
- [Analysis cache](https://github.com/nwuww/phi-analysaves/blob/main/DataLoader.cs): `DataLoader.cs`

### Analysis and fitting

- [Song analysis](https://github.com/nwuww/phi-analysaves/blob/main/CommandProcessor.cs): `CommandProcessor.cs`
- [Difficulty analysis](https://github.com/nwuww/phi-analysaves/blob/main/CommandProcessor.cs): `CommandProcessor.cs`
- [Statistics engine](https://github.com/nwuww/phi-analysaves/blob/main/AnalysisEngine.cs): `AnalysisEngine.cs`
- [Fitting and weights](https://github.com/nwuww/phi-analysaves/blob/main/FittingCoeff.cs): `FittingCoeff.cs`
- [Analysis export](https://github.com/nwuww/phi-analysaves/blob/main/CommandProcessor.cs): `CommandProcessor.cs`

### Other components

- **CLI user**
- **Save JSON files**
- **Song list CSV**

## Connections

- CLI user → Command processor: enters commands (evidence: `README`)
- Application startup → Runtime settings: creates settings (evidence: `Program.cs`)
- Application startup → Data loader: loads data (evidence: `Program.cs`)
- Application startup → Command processor: starts loop (evidence: `Program.cs`)
- Application startup → Fitting and weights: sets smoothing (evidence: `Program.cs`)
- Data loader → Runtime settings: reads paths (evidence: `DataLoader.cs`)
- Data loader → Save JSON files: reads saves (evidence: `DataLoader.cs`)
- Data loader → Song list CSV: reads song list (evidence: `DataLoader.cs`)
- Data loader → Save records: builds records (evidence: `DataLoader.cs`)
- Data loader → Song mapping: builds mapping (evidence: `DataLoader.cs`)
- Data loader → Analysis cache: reads and writes (evidence: `DataLoader.cs`)
- Command processor → Runtime settings: updates settings (evidence: `CommandProcessor.cs`)
- Command processor → Data loader: loads and queries (evidence: `CommandProcessor.cs`)
- Command processor → Song analysis: routes song mode (evidence: `README`)
- Command processor → Difficulty analysis: routes difficulty mode (evidence: `README`)
- Command processor → Statistics engine: requests calculations (evidence: `CommandProcessor.cs`)
- Command processor → Fitting and weights: uses fitting logic (evidence: `CommandProcessor.cs`)
- Command processor → Analysis export: exports results (evidence: `README`)
- Song analysis → Statistics engine: calculates statistics (evidence: `CommandProcessor.cs`)
- Difficulty analysis → Statistics engine: calculates statistics (evidence: `CommandProcessor.cs`)
