# epfl-enac/ccfatigueplatform architecture

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

- Interactive diagram: https://gitdiagram.com/epfl-enac/ccfatigueplatform
- Repository: https://github.com/epfl-enac/ccfatigueplatform

## Overview

##### Project type and purpose
- This is a full-stack web application (“CCFatigue Platform”) for managing, harmonizing, storing, and analyzing composite-materials testing datasets.
- The backend (folder “backend/”) is a Python FastAPI service with database migrations (Alembic), data-preprocessing utilities, and core analysis logic.
- The frontend (folder “frontend/”) is a Vue.js single-page application, using an OpenAPI-generated client to call the backend.
- Data (folder “Data/”) holds raw/preprocessed CSV/JSON experimental files and conventions.

##### File structure
Top-level directories:
- Data/ ‑- raw & preprocessed datasets, sample files, metadata.
- backend/ ‑- Python service:
– api.py, routers/, services/, models/, config, Alembic migrations under backend/alembic/
– analysis modules under ccfatigue/analysis/
– preprocessing scripts under backend/preprocessing/
– tests/ for pytest.
- frontend/ ‑- Vue.js app:
– public/ (static assets), src/ (components/, views/, store/, router/, backend/ generated OpenAPI client)
– build config (babel, vue.config.js), Dockerfile.
- docker-compose.yml, traefik.yaml, deploy/ for container orchestration & reverse-proxy.

##### Insights from README
- The README outlines “make dev-backend”, “make dev-frontend”, preprocessing, API regeneration, and links to a high-level flowchart (flowchart_CCFATIGUE.png).
- Key tech: PostgreSQL (configured via env secrets), Docker, FastAPI, Vue.js, OpenAPI.

##### Essential elements
- Do not omit the preprocessing pipeline (a separate step/service).
- Analysis engine and external data sources (ASTM CSVs).
- Reverse-proxy (Traefik), particularly in a production context.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Proxy
    B(Browser):::ui
    TP("Traefik (reverse-proxy)"):::infra
    B --> TP
    TP --> FE_entry

    %% Frontend Container
    subgraph "Frontend Container"
        FE_entry["Entry: main.js"]:::ui
        FE_components["Vue Components"]:::ui
        FE_views["Views (pages & layouts)"]:::ui
        FE_router["Vue Router"]:::ui
        FE_store["Vuex Store"]:::ui
        FE_client["OpenAPI Client"]:::ui
        FE_utils["Utils (CSV parsing)"]:::ui
    end
    TP -->|"serves SPA"| FE_entry
    FE_entry --> FE_components
    FE_entry --> FE_views
    FE_entry --> FE_router
    FE_entry --> FE_store
    FE_entry --> FE_client
    FE_entry --> FE_utils

    %% Frontend to Backend API Call
    FE_client -->|"HTTP API calls"| TP
    TP --> BE_entry

    %% Backend Container
    subgraph "Backend Container"
        BE_entry["Entry: api.py"]:::api
        BE_app["App Module: main.py"]:::api
        BE_config["Config"]:::api
        BE_routers["Routers (HTTP Controllers)"]:::api
        BE_dbserv["Services (business logic)"]:::api
        BE_dbmodels["DB Models (ORM schemas)"]:::api
        BE_apimodels["API Models (Pydantic)"]:::api
        BE_utils["API Utils"]:::api
        BE_analyzer["Core Analyzer"]:::api
        BE_analysis["Analysis Modules"]:::api
        BE_experiment["Experiment Domain Logic"]:::api
        init_db["DB Init Script"]:::api
        BE_alembic["Alembic Migrations"]:::api
        BE_tests["Backend Tests"]:::api
        Preproc_script["Preprocessing Script"]:::api
        Preproc_utils["Preproc Utilities"]:::api
    end
    BE_entry --> BE_app
    BE_app --> BE_config
    BE_app --> BE_routers
    BE_routers --> BE_dbserv
    BE_dbserv --> BE_dbmodels
    BE_dbserv --> BE_apimodels
    BE_dbserv --> BE_utils
    BE_dbserv --> BE_analysis
    BE_analysis --> BE_analyzer
    BE_analysis --> BE_experiment
    BE_app --> init_db
    BE_app --> BE_alembic
    BE_entry --> BE_tests
    BE_entry --> Preproc_script
    Preproc_script --> Preproc_utils

    %% Data Storage
    subgraph "Data Storage"
        Data_storage_raw["Raw Datasets"]:::data
        Data_storage_pre["Preprocessed Datasets"]:::data
    end

    %% Storage and DB
    subgraph "Persistent Storage"
        DB("PostgreSQL Database"):::data
        FileStorage("File Storage (volume/blob)"):::data
    end

    %% Flows
    Preproc_script -->|"reads"| Data_storage_raw
    Preproc_script -->|"writes"| Data_storage_pre
    Preproc_script --> DB
    BE_dbserv --> DB
    BE_dbserv --> FileStorage
    BE_client --> TP
    TP --> BE_entry

    %% Click Events
    click Data_storage_raw "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/Data/raw"
    click Data_storage_pre "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/Data/preprocessed"
    click BE_entry "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/api.py"
    click BE_app "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/ccfatigue/main.py"
    click BE_config "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/ccfatigue/config.py"
    click BE_alembic "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/backend/alembic/versions"
    click BE_dbmodels "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/ccfatigue/models/database.py"
    click BE_apimodels "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/ccfatigue/models/api.py"
    click BE_routers "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/backend/ccfatigue/routers"
    click BE_dbserv "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/ccfatigue/services/database.py"
    click BE_analysis "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/backend/ccfatigue/analysis"
    click BE_analyzer "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/ccfatigue/analyzer.py"
    click Preproc_script "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/preprocessing/tst_preprocessing.py"
    click Preproc_utils "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/backend/preprocessing/*"
    click BE_experiment "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/backend/ccfatigue/experiment"
    click BE_utils "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/backend/ccfatigue/utils"
    click init_db "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/init_db.py"
    click BE_tests "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/backend/tests/test_analysis.py"
    click FE_entry "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/frontend/src/main.js"
    click FE_components "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/frontend/src/components"
    click FE_router "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/frontend/src/router/index.js"
    click FE_store "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/frontend/src/store"
    click FE_client "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/frontend/src/backend/api"
    click FE_views "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/frontend/src/views"
    click FE_utils "https://github.com/epfl-enac/ccfatigueplatform/tree/develop/frontend/src/utils"
    click Traefik "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/traefik.yaml"
    click DockerCompose "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/docker-compose.yml"
    click Deploy1 "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/deploy/test/gunicorn.conf.py"
    click Deploy2 "https://github.com/epfl-enac/ccfatigueplatform/blob/develop/deploy/test/nginx.conf"

    %% Styles
    classDef ui fill:#DDF,stroke:#88F,stroke-width:1px
    classDef api fill:#DFD,stroke:#8F8,stroke-width:1px
    classDef data fill:#FFD,stroke:#DFD,stroke-width:1px
    classDef infra fill:#FDD,stroke:#F88,stroke-width:1px
```
