# nick6988/corner-rate-engine architecture

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

- Interactive diagram: https://gitdiagram.com/nick6988/corner-rate-engine
- Repository: https://github.com/nick6988/corner-rate-engine

## Overview

This is a Streamlit in-play football pricing and risk dashboard. Users enter match context, live statistics and market odds; the app calculates corner and goal probabilities, expected value and trade diagnostics, then presents metrics and signals. Corner pricing combines pace, shot heat and tactical modifiers with a Negative Binomial model; goal pricing uses a separate goal-rate model. League tiers provide risk controls and are stored in JSON. The excerpts show the corner calculation calls and league persistence; the app’s goal-engine invocation is not shown, so that relationship is marked unverified.

Main entry points: [`app.py`](https://github.com/nick6988/corner-rate-engine/blob/main/app.py) (Streamlit dashboard), [`league_filter.py`](https://github.com/nick6988/corner-rate-engine/blob/main/league_filter.py) (League tiers), [`corner_engine.py`](https://github.com/nick6988/corner-rate-engine/blob/main/corner_engine.py) (Corner pricing), [`goal_engine.py`](https://github.com/nick6988/corner-rate-engine/blob/main/goal_engine.py) (Goal pricing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_app["Streamlit dashboard<br/>[app.py]"]
end

subgraph group_pricing["Pricing engines"]
  node_corner["Corner pricing<br/>[corner_engine.py]"]
  node_goal["Goal pricing<br/>[goal_engine.py]"]
end

subgraph group_risk["League risk"]
  node_league["League tiers<br/>[league_filter.py]"]
  node_league_data[("League data<br/>[leagues.json]")]
end

node_user(("Dashboard user"))

node_user -->|"enters match data"| node_app
node_app -->|"calculates corner signals"| node_corner
node_app -.->|"uses goal pricing"| node_goal
node_app -->|"manages league tiers"| node_league
node_corner -->|"gets league tier"| node_league
node_league -->|"reads and writes"| node_league_data

click node_app "https://github.com/nick6988/corner-rate-engine/blob/main/app.py"
click node_corner "https://github.com/nick6988/corner-rate-engine/blob/main/corner_engine.py"
click node_goal "https://github.com/nick6988/corner-rate-engine/blob/main/goal_engine.py"
click node_league "https://github.com/nick6988/corner-rate-engine/blob/main/league_filter.py"
click node_league_data "https://github.com/nick6988/corner-rate-engine/blob/main/leagues.json"

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_app,node_user toneBlue
class node_corner,node_goal toneAmber
class node_league,node_league_data toneMint
```

## Components

### Dashboard

- [Streamlit dashboard](https://github.com/nick6988/corner-rate-engine/blob/main/app.py): `app.py`

### Pricing engines

- [Corner pricing](https://github.com/nick6988/corner-rate-engine/blob/main/corner_engine.py): `corner_engine.py`
- [Goal pricing](https://github.com/nick6988/corner-rate-engine/blob/main/goal_engine.py): `goal_engine.py`

### League risk

- [League tiers](https://github.com/nick6988/corner-rate-engine/blob/main/league_filter.py): `league_filter.py`
- [League data](https://github.com/nick6988/corner-rate-engine/blob/main/leagues.json): `leagues.json`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Streamlit dashboard: enters match data (evidence: `README.md`)
- Streamlit dashboard → Corner pricing: calculates corner signals (evidence: `app.py`)
- Streamlit dashboard → Goal pricing: uses goal pricing (evidence: `app.py`)
- Streamlit dashboard → League tiers: manages league tiers (evidence: `app.py`)
- Corner pricing → League tiers: gets league tier (evidence: `corner_engine.py`)
- League tiers → League data: reads and writes (evidence: `league_filter.py`)
