# argelion14/sport-car architecture

> Architecture diagram of the GitHub repository argelion14/sport-car, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/argelion14/sport-car
- Repository: https://github.com/argelion14/sport-car

## Overview

##### Project type and purpose
- This is an open-source Python application/library (Sport-car) whose core responsibility is matchmaking between users who need a ride and users who can provide a ride for outdoor sports activities.
- It is packaged as a Python module (`sportcar/`), uses Invoke (`tasks.py`) to orchestrate checks/tests, and is containerized via Docker for portability. CI/CD is configured via GitHub Actions and Azure CI.

##### File structure
- Top-level directories and files:
- `sportcar/` – the core domain packages (`actividad.py`, `usuario.py`, `grupo.py`, `grupos.py`, plus `constantes.py`, `errores.py`).
- `test/` – unit tests (`test.py`).
- `tasks.py` – Invoke tasks (`check`, `test`, possibly `docker` build).
- `Dockerfile` and `iv.yaml` – containerization.
- CI workflows under `.github/workflows/` and `azureCI.yml`.
- `docs/` – design, user journeys, Docker and CI instructions.
- `pyproject.toml` – project metadata and dependencies.

##### README for additional insights
- Confirms domain: users, vehicles, activities, institutions.
- Invoke commands to build/check/test.
- Docker instructions in docs.
- No frontend; this is purely service/CLI-style backend logic intended for packaging and deployment.

a. Main components
- Domain Model Layer (Python modules in `sportcar/`)
– Entities: Usuario, Actividad, Grupo, Grupos
– Support: constantes, errores
- CLI & Task Orchestration (Invoke via `tasks.py`)
- Test Harness (pytest test suite in `test/`)
- Packaging & Containerization (Dockerfile, iv.yaml)
- CI/CD Pipelines (GitHub Actions + AzureCI)
b. Relationships and interactions
- CLI/Invoke tasks call into the Domain Model to perform schema checks and business-logic operations.
- Test harness invokes domain code via CLI tasks or directly via pytest.
- Docker build constructs a container image bundling the `sportcar` package and entry points.
- CI workflows trigger checks → tests → Docker image build → (optionally) publish.
c. Architectural patterns & principles
- Layered separation:
– Domain Layer (pure Python modules)
– Orchestration Layer (Invoke tasks)
– Infrastructure Layer (Docker container + CI pipelines)
- Single Responsibility – each Python module encapsulates one concept.
- Modular packaging – decoupled tests, docs, CI.
d. Key technologies/frameworks
- Python 3 (pyproject.toml managed)
- Invoke for task automation
- pytest for testing
- Docker for containerization
- GitHub Actions & Azure CI for continuous integration

##### Detail is key
- Configuration files (`pyproject.toml`, `Dockerfile`, `.github/workflows/*`) as artifacts feeding into builds.

- Top: External Actors (Developer CLI, CI Systems)
- Middle: Orchestration (Invoke Tasks) feeding into Domain Model
- Bottom: Infrastructure (Docker image, Tests, CI workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Actors
    Developer["Developer CLI"]:::external
    CI_GHA["GitHub Actions"]:::external
    CI_Azure["Azure CI"]:::external

    %% Orchestration Layer
    subgraph "Orchestration Layer"
        Invoke["Invoke Tasks"]:::orchestration
    end

    %% Domain Model Layer
    subgraph "Domain Model"
        Usuario["Usuario"]:::domain
        Actividad["Actividad"]:::domain
        Grupo["Grupo"]:::domain
        Grupos["Grupos"]:::domain
        Constantes["constantes"]:::domain
        Errores["errores"]:::domain
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        TestSuite["pytest Test Suite"]:::infra
        DockerImg["Docker Image"]:::infra
        IVCfg["iv.yaml"]:::infra
        PyProj["pyproject.toml"]:::infra
        CI_CodeQL["codeql.yml"]:::infra
        CI_DockerWf["docker-image.yml"]:::infra
        CI_Fortify["fortify.yml"]:::infra
        CI_Testear["testear.yml"]:::infra
        CI_AzureCfg["azureCI.yml"]:::infra
        Docs_CI["docs/CI_docs.md"]:::infra
        Docs_Docker["docs/docker.md"]:::infra
        Docs_UserJourney["docs/user_journey.md"]:::infra
        Docs_Objetivo1["docs/objetivo1.md"]:::infra
        Docs_Objetivo2["docs/objetivo2.md"]:::infra
        Docs_TestGuide["docs/test.md"]:::infra
    end

    %% Connections
    Developer -->|"runs invoke tasks"| Invoke
    CI_GHA -->|"triggers workflows"| CI_CodeQL
    CI_GHA -->|"triggers workflows"| CI_DockerWf
    CI_GHA -->|"triggers workflows"| CI_Fortify
    CI_GHA -->|"triggers workflows"| CI_Testear
    CI_Azure -->|"triggers pipeline"| CI_AzureCfg

    CI_CodeQL -->|"analyzes code"| Invoke
    CI_Testear -->|"runs tests"| TestSuite
    CI_DockerWf -->|"builds image"| DockerImg
    CI_AzureCfg -->|"runs tasks and build"| Invoke
    CI_AzureCfg -->|"runs tasks and build"| DockerImg

    Invoke -->|"calls domain modules"| Usuario
    Invoke -->|"calls domain modules"| Actividad
    Invoke -->|"calls domain modules"| Grupo
    Invoke -->|"calls domain modules"| Grupos
    Invoke -->|"calls domain modules"| Constantes
    Invoke -->|"calls domain modules"| Errores

    TestSuite -->|"executes tests against domain"| Usuario
    TestSuite -->|"executes tests against domain"| Actividad
    TestSuite -->|"executes tests against domain"| Grupo
    TestSuite -->|"executes tests against domain"| Grupos
    TestSuite -->|"executes tests against domain"| Constantes
    TestSuite -->|"executes tests against domain"| Errores

    DockerImg -->|"packages domain & CLI"| Invoke
    DockerImg -->|"packages domain modules"| Usuario
    DockerImg -->|"packages domain modules"| Actividad
    DockerImg -->|"packages domain modules"| Grupo
    DockerImg -->|"packages domain modules"| Grupos
    DockerImg -->|"includes config"| IVCfg
    DockerImg -->|"includes metadata"| PyProj

    %% Click Events
    click Usuario "https://github.com/argelion14/sport-car/blob/main/sportcar/usuario.py"
    click Actividad "https://github.com/argelion14/sport-car/blob/main/sportcar/actividad.py"
    click Grupo "https://github.com/argelion14/sport-car/blob/main/sportcar/grupo.py"
    click Grupos "https://github.com/argelion14/sport-car/blob/main/sportcar/grupos.py"
    click Constantes "https://github.com/argelion14/sport-car/blob/main/sportcar/constantes.py"
    click Errores "https://github.com/argelion14/sport-car/blob/main/sportcar/errores.py"
    click Invoke "https://github.com/argelion14/sport-car/blob/main/tasks.py"
    click TestSuite "https://github.com/argelion14/sport-car/blob/main/test/test.py"
    click PyProj "https://github.com/argelion14/sport-car/blob/main/pyproject.toml"
    click DockerImg "https://github.com/argelion14/sport-car/tree/main/Dockerfile"
    click IVCfg "https://github.com/argelion14/sport-car/blob/main/iv.yaml"
    click CI_CodeQL "https://github.com/argelion14/sport-car/blob/main/.github/workflows/codeql.yml"
    click CI_DockerWf "https://github.com/argelion14/sport-car/blob/main/.github/workflows/docker-image.yml"
    click CI_Fortify "https://github.com/argelion14/sport-car/blob/main/.github/workflows/fortify.yml"
    click CI_Testear "https://github.com/argelion14/sport-car/blob/main/.github/workflows/testear.yml"
    click CI_AzureCfg "https://github.com/argelion14/sport-car/blob/main/azureCI.yml"
    click Docs_CI "https://github.com/argelion14/sport-car/blob/main/docs/CI_docs.md"
    click Docs_Docker "https://github.com/argelion14/sport-car/blob/main/docs/docker.md"
    click Docs_UserJourney "https://github.com/argelion14/sport-car/blob/main/docs/user_journey.md"
    click Docs_Objetivo1 "https://github.com/argelion14/sport-car/blob/main/docs/objetivo1.md"
    click Docs_Objetivo2 "https://github.com/argelion14/sport-car/blob/main/docs/objetivo2.md"
    click Docs_TestGuide "https://github.com/argelion14/sport-car/blob/main/docs/test.md"

    %% Styles
    classDef domain fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef orchestration fill:#d4edda,stroke:#333,stroke-width:1px
    classDef infra fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px
```
