# darragh7/cs6422-complex-systems-design-group-3 architecture

> Architecture diagram of the GitHub repository darragh7/cs6422-complex-systems-design-group-3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/darragh7/cs6422-complex-systems-design-group-3
- Repository: https://github.com/darragh7/cs6422-complex-systems-design-group-3

## Overview

ScoreLine combines a FastAPI football-match and prediction API with a separate match-result model-training workflow. A user requests matches; the controller delegates retrieval to the football-data.org client, which normalizes provider data for the API response. Prediction requests currently return fixed probabilities, not trained-model inference. Training code prepares historical match data, labels and chronologically splits it, then builds features, selects a model, and evaluates it. The README documents backend startup; sampled files do not show training-to-serving integration or database use by these routes.

Main entry points: [`backend/app/database/database.py`](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/database/database.py) (SQLAlchemy database), [`backend/app/main.py`](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/main.py) (FastAPI app), [`backend/app/controllers/match_controller.py`](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/controllers/match_controller.py) (Match routes), [`backend/app/services/football_api.py`](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/services/football_api.py) (Football API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Backend API"]
  node_app["FastAPI app<br/>[main.py]"]
  node_match_controller["Match routes"]
  node_match_schema["Match response schema<br/>[match_schema.py]"]
  node_prediction_controller["Prediction route"]
  node_prediction_service["Prediction service"]
  node_settings["Runtime settings<br/>[settings.py]"]
end

subgraph group_training["Model Training"]
  node_preprocessing["Match preprocessing<br/>[preprocessing.py]"]
  node_training_pipeline["Training pipeline<br/>[pipeline.py]"]
  node_model_selection["Feature and model selection<br/>[train.py]"]
end

subgraph group_storage["Persistence"]
  node_database[("SQLAlchemy database<br/>[database.py]")]
  node_match_model["Match ORM model<br/>[match.py]"]
  node_prediction_model["Prediction ORM model<br/>[prediction.py]"]
  node_user_model["User ORM model<br/>[user.py]"]
  node_schema_sql["Database schema<br/>[schema.sql]"]
end

subgraph group_integrations["External Systems"]
  node_football_client["Football API client<br/>[football_api.py]"]
  node_football_provider["football-data.org"]
end

node_user(("API user"))

node_user -->|"requests API"| node_app
node_app -->|"registers routes"| node_match_controller
node_app -->|"registers routes"| node_prediction_controller
node_match_controller -->|"fetches matches"| node_football_client
node_football_client -->|"requests match data"| node_football_provider
node_match_controller -->|"formats response"| node_match_schema
node_prediction_controller -->|"requests prediction"| node_prediction_service
node_football_client -->|"reads configuration"| node_settings
node_database -->|"reads database URL"| node_settings
node_training_pipeline -->|"runs preparation"| node_preprocessing
node_training_pipeline -->|"builds and evaluates"| node_model_selection
node_match_model -->|"uses declarative base"| node_database
node_prediction_model -->|"uses declarative base"| node_database
node_user_model -->|"uses declarative base"| node_database

click node_app "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/main.py"
click node_match_controller "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/controllers/match_controller.py"
click node_match_schema "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/schemas/match_schema.py"
click node_prediction_controller "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/controllers/prediction_controller.py"
click node_prediction_service "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/services/prediction_service.py"
click node_football_client "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/services/football_api.py"
click node_settings "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/config/settings.py"
click node_preprocessing "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/ai/training/preprocessing.py"
click node_training_pipeline "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/ai/training/pipeline.py"
click node_model_selection "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/ai/training/train.py"
click node_database "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/database/database.py"
click node_match_model "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/models/match.py"
click node_prediction_model "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/models/prediction.py"
click node_user_model "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/models/user.py"
click node_schema_sql "https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/database/schema.sql"

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_match_controller,node_match_schema,node_prediction_controller,node_prediction_service,node_settings,node_user toneBlue
class node_preprocessing,node_training_pipeline,node_model_selection toneAmber
class node_database,node_match_model,node_prediction_model,node_user_model,node_schema_sql toneMint
class node_football_client,node_football_provider toneRose
```

## Components

### Backend API

- [FastAPI app](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/main.py): `backend/app/main.py`
- [Match routes](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/controllers/match_controller.py): `backend/app/controllers/match_controller.py`
- [Match response schema](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/schemas/match_schema.py): `backend/app/schemas/match_schema.py`
- [Prediction route](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/controllers/prediction_controller.py): `backend/app/controllers/prediction_controller.py`
- [Prediction service](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/services/prediction_service.py): `backend/app/services/prediction_service.py`
- [Runtime settings](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/config/settings.py): `backend/app/config/settings.py`

### Model Training

- [Match preprocessing](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/ai/training/preprocessing.py): `ai/training/preprocessing.py`
- [Training pipeline](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/ai/training/pipeline.py): `ai/training/pipeline.py`
- [Feature and model selection](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/ai/training/train.py): `ai/training/train.py`

### Persistence

- [SQLAlchemy database](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/database/database.py): `backend/app/database/database.py`
- [Match ORM model](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/models/match.py): `backend/app/models/match.py`
- [Prediction ORM model](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/models/prediction.py): `backend/app/models/prediction.py`
- [User ORM model](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Database schema](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/database/schema.sql): `database/schema.sql`

### External Systems

- [Football API client](https://github.com/darragh7/cs6422-complex-systems-design-group-3/blob/main/backend/app/services/football_api.py): `backend/app/services/football_api.py`
- **football-data.org**

### Other components

- **API user**

## Connections

- API user → FastAPI app: requests API (evidence: `README.md`)
- FastAPI app → Match routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Prediction route: registers routes (evidence: `backend/app/main.py`)
- Match routes → Football API client: fetches matches (evidence: `backend/app/controllers/match_controller.py`)
- Football API client → football-data.org: requests match data (evidence: `backend/app/services/football_api.py`)
- Match routes → Match response schema: formats response (evidence: `backend/app/controllers/match_controller.py`)
- Prediction route → Prediction service: requests prediction (evidence: `backend/app/controllers/prediction_controller.py`)
- Football API client → Runtime settings: reads configuration (evidence: `backend/app/services/football_api.py`)
- SQLAlchemy database → Runtime settings: reads database URL (evidence: `backend/app/database/database.py`)
- Training pipeline → Match preprocessing: runs preparation (evidence: `ai/training/pipeline.py`)
- Training pipeline → Feature and model selection: builds and evaluates (evidence: `ai/training/pipeline.py`)
- Match ORM model → SQLAlchemy database: uses declarative base (evidence: `backend/app/models/match.py`)
- Prediction ORM model → SQLAlchemy database: uses declarative base (evidence: `backend/app/models/prediction.py`)
- User ORM model → SQLAlchemy database: uses declarative base (evidence: `backend/app/models/user.py`)
