# patvela/proyectos-universidad architecture

> Architecture diagram of the GitHub repository patvela/proyectos-universidad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/patvela/proyectos-universidad
- Repository: https://github.com/patvela/proyectos-universidad

## Overview

ECG classification with a residual deep-learning model is the product. The principal workflow is CSV upload in the Flask interface, signal preparation and model inference, then a summary with plots shown to the user. Separate capabilities include MIT-BIH data preparation and model training, plus CINC2017-based prediction. Edges reflect the README workflows and the available source references; several web and prediction internals are only partially excerpted, so their finer-grained wiring is not expanded.

Main entry points: [`src/app.py`](https://github.com/patvela/proyectos-universidad/blob/main/src/app.py) (Flask application), [`src/train.py`](https://github.com/patvela/proyectos-universidad/blob/main/src/train.py) (Model training), [`src/predict.py`](https://github.com/patvela/proyectos-universidad/blob/main/src/predict.py) (Prediction and summary), [`src/data.py`](https://github.com/patvela/proyectos-universidad/blob/main/src/data.py) (MIT-BIH preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_browser["Browser interface<br/>[main.js]"]
  node_templates["Page templates"]
  node_webapp["Flask application<br/>[app.py]"]
  node_uploads["Uploaded ECG"]
  node_results["Plots and results<br/>[app.py]"]
end

subgraph group_inference["Prediction"]
  node_prediction["Prediction and summary<br/>[predict.py]"]
  node_preprocess["Signal preprocessing<br/>[utils.py]"]
  node_cinc["CINC2017 records<br/>[predict.py]"]
end

subgraph group_model["Data and model"]
  node_training["Model training<br/>[train.py]"]
  node_architecture["ECG model<br/>[graph.py]"]
  node_mitdata["MIT-BIH preparation<br/>[data.py]"]
  node_datasets[("Prepared datasets<br/>[data.py]")]
  node_modelstore[("Trained model files<br/>[train.py]")]
end

subgraph group_shared["Configuration and support"]
  node_evaluation["Evaluation utilities<br/>[utils.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_user(("ECG user"))
node_physionet[("PhysioNet datasets")]

node_user -->|"uses"| node_browser
node_browser -->|"submits ECG"| node_webapp
node_webapp -.->|"renders pages"| node_templates
node_webapp -.->|"saves uploads"| node_uploads
node_webapp -->|"invokes prediction"| node_prediction
node_webapp -->|"configures sampling"| node_config
node_webapp -->|"serves plots"| node_results
node_browser -->|"displays results"| node_results
node_prediction -->|"preprocesses signal"| node_preprocess
node_prediction -->|"uses model"| node_architecture
node_prediction -->|"reads settings"| node_config
node_prediction -.->|"loads records"| node_cinc
node_user -->|"requests preparation"| node_mitdata
node_mitdata -->|"downloads records"| node_physionet
node_mitdata -->|"writes prepared data"| node_datasets
node_user -->|"starts training"| node_training
node_training -->|"loads training data"| node_datasets
node_training -->|"builds model"| node_architecture
node_training -->|"saves checkpoints"| node_modelstore
node_training -->|"evaluates model"| node_evaluation
node_training -->|"reads settings"| node_config
node_mitdata -->|"reads settings"| node_config

click node_browser "https://github.com/patvela/proyectos-universidad/blob/main/src/static/js/main.js"
click node_templates "https://github.com/patvela/proyectos-universidad/tree/main/src/templates"
click node_webapp "https://github.com/patvela/proyectos-universidad/blob/main/src/app.py"
click node_uploads "https://github.com/patvela/proyectos-universidad/tree/main/src/uploads"
click node_results "https://github.com/patvela/proyectos-universidad/blob/main/src/app.py"
click node_prediction "https://github.com/patvela/proyectos-universidad/blob/main/src/predict.py"
click node_preprocess "https://github.com/patvela/proyectos-universidad/blob/main/src/utils.py"
click node_cinc "https://github.com/patvela/proyectos-universidad/blob/main/src/predict.py"
click node_training "https://github.com/patvela/proyectos-universidad/blob/main/src/train.py"
click node_architecture "https://github.com/patvela/proyectos-universidad/blob/main/src/graph.py"
click node_mitdata "https://github.com/patvela/proyectos-universidad/blob/main/src/data.py"
click node_datasets "https://github.com/patvela/proyectos-universidad/blob/main/src/data.py"
click node_modelstore "https://github.com/patvela/proyectos-universidad/blob/main/src/train.py"
click node_evaluation "https://github.com/patvela/proyectos-universidad/blob/main/src/utils.py"
click node_config "https://github.com/patvela/proyectos-universidad/blob/main/src/config.py"

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_browser,node_templates,node_webapp,node_uploads,node_results,node_user toneBlue
class node_prediction,node_preprocess,node_cinc,node_physionet toneAmber
class node_training,node_architecture,node_mitdata,node_datasets,node_modelstore toneMint
class node_evaluation,node_config toneRose
```

## Components

### Web application

- [Browser interface](https://github.com/patvela/proyectos-universidad/blob/main/src/static/js/main.js): `src/static/js/main.js`
- [Page templates](https://github.com/patvela/proyectos-universidad/tree/main/src/templates): `src/templates`
- [Flask application](https://github.com/patvela/proyectos-universidad/blob/main/src/app.py): `src/app.py`
- [Uploaded ECG](https://github.com/patvela/proyectos-universidad/tree/main/src/uploads): `src/uploads`
- [Plots and results](https://github.com/patvela/proyectos-universidad/blob/main/src/app.py): `src/app.py`

### Prediction

- [Prediction and summary](https://github.com/patvela/proyectos-universidad/blob/main/src/predict.py): `src/predict.py`
- [Signal preprocessing](https://github.com/patvela/proyectos-universidad/blob/main/src/utils.py): `src/utils.py`
- [CINC2017 records](https://github.com/patvela/proyectos-universidad/blob/main/src/predict.py): `src/predict.py`

### Data and model

- [Model training](https://github.com/patvela/proyectos-universidad/blob/main/src/train.py): `src/train.py`
- [ECG model](https://github.com/patvela/proyectos-universidad/blob/main/src/graph.py): `src/graph.py`
- [MIT-BIH preparation](https://github.com/patvela/proyectos-universidad/blob/main/src/data.py): `src/data.py`
- [Prepared datasets](https://github.com/patvela/proyectos-universidad/blob/main/src/data.py): `src/data.py`
- [Trained model files](https://github.com/patvela/proyectos-universidad/blob/main/src/train.py): `src/train.py`

### Configuration and support

- [Evaluation utilities](https://github.com/patvela/proyectos-universidad/blob/main/src/utils.py): `src/utils.py`
- [Runtime configuration](https://github.com/patvela/proyectos-universidad/blob/main/src/config.py): `src/config.py`

### Other components

- **ECG user**
- **PhysioNet datasets**

## Connections

- ECG user → Browser interface: uses (evidence: `README.md`)
- Browser interface → Flask application: submits ECG (evidence: `src/static/js/main.js`)
- Flask application → Page templates: renders pages
- Flask application → Uploaded ECG: saves uploads
- Flask application → Prediction and summary: invokes prediction (evidence: `src/app.py`)
- Flask application → Runtime configuration: configures sampling (evidence: `src/app.py`)
- Flask application → Plots and results: serves plots (evidence: `src/app.py`)
- Browser interface → Plots and results: displays results (evidence: `src/static/js/main.js`)
- Prediction and summary → Signal preprocessing: preprocesses signal (evidence: `src/predict.py`)
- Prediction and summary → ECG model: uses model (evidence: `src/predict.py`)
- Prediction and summary → Runtime configuration: reads settings (evidence: `src/predict.py`)
- Prediction and summary → CINC2017 records: loads records (evidence: `src/predict.py`)
- ECG user → MIT-BIH preparation: requests preparation (evidence: `README.md`)
- MIT-BIH preparation → PhysioNet datasets: downloads records (evidence: `src/data.py`)
- MIT-BIH preparation → Prepared datasets: writes prepared data (evidence: `src/data.py`)
- ECG user → Model training: starts training (evidence: `README.md`)
- Model training → Prepared datasets: loads training data (evidence: `src/train.py`)
- Model training → ECG model: builds model (evidence: `src/train.py`)
- Model training → Trained model files: saves checkpoints (evidence: `src/train.py`)
- Model training → Evaluation utilities: evaluates model (evidence: `src/train.py`)
- Model training → Runtime configuration: reads settings (evidence: `src/train.py`)
- MIT-BIH preparation → Runtime configuration: reads settings (evidence: `src/data.py`)
