# nazarenofolica/optimizacion_tps architecture

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

- Interactive diagram: https://gitdiagram.com/nazarenofolica/optimizacion_tps
- Repository: https://github.com/nazarenofolica/optimizacion_tps

## Overview

The repository combines staged market-modeling exercises with a final SEPA-based grocery-basket application and two video implementations explaining the project. The clearest product workflow is a web user entering household needs, then receiving a computed basket; the tree and source index identify the relevant subsystems, but sampled evidence does not expose the full runtime wiring. Dashed, uncited links mark that uncertainty. The TP1 model and video branches are shown as separate deliverables.

Main entry points: [`TPF/base_sepa/canasta/rutas.py`](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/rutas.py) (Basket routes), [`TP1/src/reportes.py`](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/reportes.py) (Model reports), [`TPF/base_sepa/canasta/servidor.py`](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/servidor.py) (Web server), [`TPF/base_sepa/canasta/web/motor.js`](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/web/motor.js) (Basket optimizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Market model"]
  node_tp1_config["Model parameters<br/>[config.py]"]
  node_tp1_data["Derived tables<br/>[datos.py]"]
  node_tp1_model["Base model<br/>[modelo.py]"]
  node_tp1_reports["Model reports<br/>[reportes.py]"]
  node_tp1_charts["Model charts<br/>[graficos.py]"]
end

subgraph group_data["SEPA data"]
  node_sepa_config["SEPA settings<br/>[config.py]"]
  node_sepa_sources["Price and food sources"]
  node_sepa_geo["Store geography<br/>[geografia.py]"]
  node_sepa_nutrition["Nutrient profiles<br/>[nutrientes.py]"]
  node_sepa_products["Product classification<br/>[clasificacion.py]"]
  node_sepa_prices["Prices and promotions<br/>[promociones.py]"]
  node_sepa_output["SEPA output<br/>[salida.py]"]
end

subgraph group_basket["Basket application"]
  node_basket_web["Basket web UI<br/>[app.js]"]
  node_basket_server["Web server<br/>[servidor.py]"]
  node_basket_needs["Household needs<br/>[requerimientos.py]"]
  node_basket_offer["Store offers<br/>[oferta.py]"]
  node_basket_routes["Basket routes<br/>[rutas.py]"]
  node_basket_optimizer["Basket optimizer<br/>[motor.js]"]
  node_basket_result["Basket results<br/>[resultado.py]"]
  node_basket_llm["Request interpreter<br/>[llm.py]"]
end

subgraph group_video["Video deliverables"]
  node_video_manim["Manim scenes<br/>[escenas.py]"]
  node_video_style["Video style<br/>[estilo.py]"]
  node_video_montage["Screen montage<br/>[montar.py]"]
  node_video_reel["Animated reel<br/>[Reel.tsx]"]
  node_video_horizontal["Horizontal render<br/>[Horizontal.tsx]"]
  node_video_timing["Scene timing<br/>[tiempo.ts]"]
  node_video_motion["Motion utilities<br/>[anim.ts]"]
end

node_user(("Shopper"))
node_groq{{"Groq LLM"}}

node_tp1_model -->|"uses tables"| node_tp1_data
node_tp1_reports -->|"uses tables"| node_tp1_data
node_tp1_reports -->|"uses model"| node_tp1_model
node_tp1_reports -->|"uses settings"| node_tp1_config
node_sepa_sources -->|"uses settings"| node_sepa_config
node_sepa_nutrition -->|"uses food data"| node_sepa_sources
node_sepa_nutrition -->|"uses settings"| node_sepa_config
node_sepa_output -->|"uses profiles"| node_sepa_nutrition
node_sepa_output -->|"uses promotions"| node_sepa_prices
node_basket_web -.->|"submits requests"| node_basket_server
node_basket_server -.->|"dispatches to"| node_basket_routes
node_basket_routes -->|"uses offers"| node_basket_offer
node_basket_routes -.->|"uses requirements"| node_basket_needs
node_basket_server -.->|"offers interpretation"| node_basket_llm
node_basket_llm -.->|"requests parsing"| node_groq
node_basket_llm -->|"validates request"| node_basket_needs
node_basket_optimizer -.->|"uses offers"| node_basket_offer
node_basket_routes -.->|"calculates basket"| node_basket_optimizer
node_basket_optimizer -.->|"produces result"| node_basket_result
node_user -.->|"enters needs"| node_basket_web
node_video_manim -->|"uses style"| node_video_style
node_video_montage -->|"uses style"| node_video_style
node_video_montage -.->|"composes scene"| node_video_manim
node_video_reel -->|"uses timing"| node_video_timing
node_video_horizontal -->|"renders scenes"| node_video_reel
node_video_horizontal -->|"uses motion"| node_video_motion

click node_tp1_config "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/config.py"
click node_tp1_data "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/datos.py"
click node_tp1_model "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/modelo.py"
click node_tp1_reports "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/reportes.py"
click node_tp1_charts "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/graficos.py"
click node_sepa_config "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/config.py"
click node_sepa_sources "https://github.com/nazarenofolica/optimizacion_tps/tree/main/TPF/base_sepa/sepa/fuentes"
click node_sepa_geo "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/fuentes/geografia.py"
click node_sepa_nutrition "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/producto/nutrientes.py"
click node_sepa_products "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/producto/clasificacion.py"
click node_sepa_prices "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/precio/promociones.py"
click node_sepa_output "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/salida.py"
click node_basket_web "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/web/app.js"
click node_basket_server "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/servidor.py"
click node_basket_needs "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/requerimientos.py"
click node_basket_offer "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/oferta.py"
click node_basket_routes "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/rutas.py"
click node_basket_optimizer "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/web/motor.js"
click node_basket_result "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/resultado.py"
click node_basket_llm "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/llm.py"
click node_video_manim "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video/escenas.py"
click node_video_style "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video/estilo.py"
click node_video_montage "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video/montar.py"
click node_video_reel "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video_animado/src/Reel.tsx"
click node_video_horizontal "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video_animado/src/Horizontal.tsx"
click node_video_timing "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video_animado/src/lib/tiempo.ts"
click node_video_motion "https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video_animado/src/lib/anim.ts"

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_tp1_config,node_tp1_data,node_tp1_model,node_tp1_reports,node_tp1_charts toneBlue
class node_sepa_config,node_sepa_sources,node_sepa_geo,node_sepa_nutrition,node_sepa_products,node_sepa_prices,node_sepa_output toneAmber
class node_basket_web,node_basket_server,node_basket_needs,node_basket_offer,node_basket_routes,node_basket_optimizer,node_basket_result,node_basket_llm toneMint
class node_video_manim,node_video_style,node_video_montage,node_video_reel,node_video_horizontal,node_video_timing,node_video_motion toneRose
class node_user,node_groq toneIndigo
```

## Components

### Market model

- [Model parameters](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/config.py): `TP1/src/config.py`
- [Derived tables](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/datos.py): `TP1/src/datos.py`
- [Base model](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/modelo.py): `TP1/src/modelo.py`
- [Model reports](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/reportes.py): `TP1/src/reportes.py`
- [Model charts](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TP1/src/graficos.py): `TP1/src/graficos.py`

### SEPA data

- [SEPA settings](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/config.py): `TPF/base_sepa/sepa/config.py`
- [Price and food sources](https://github.com/nazarenofolica/optimizacion_tps/tree/main/TPF/base_sepa/sepa/fuentes): `TPF/base_sepa/sepa/fuentes`
- [Store geography](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/fuentes/geografia.py): `TPF/base_sepa/sepa/fuentes/geografia.py`
- [Nutrient profiles](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/producto/nutrientes.py): `TPF/base_sepa/sepa/producto/nutrientes.py`
- [Product classification](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/producto/clasificacion.py): `TPF/base_sepa/sepa/producto/clasificacion.py`
- [Prices and promotions](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/precio/promociones.py): `TPF/base_sepa/sepa/precio/promociones.py`
- [SEPA output](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/sepa/salida.py): `TPF/base_sepa/sepa/salida.py`

### Basket application

- [Basket web UI](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/web/app.js): `TPF/base_sepa/canasta/web/app.js`
- [Web server](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/servidor.py): `TPF/base_sepa/canasta/servidor.py`
- [Household needs](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/requerimientos.py): `TPF/base_sepa/canasta/requerimientos.py`
- [Store offers](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/oferta.py): `TPF/base_sepa/canasta/oferta.py`
- [Basket routes](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/rutas.py): `TPF/base_sepa/canasta/rutas.py`
- [Basket optimizer](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/web/motor.js): `TPF/base_sepa/canasta/web/motor.js`
- [Basket results](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/resultado.py): `TPF/base_sepa/canasta/resultado.py`
- [Request interpreter](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/base_sepa/canasta/llm.py): `TPF/base_sepa/canasta/llm.py`

### Video deliverables

- [Manim scenes](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video/escenas.py): `TPF/video/escenas.py`
- [Video style](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video/estilo.py): `TPF/video/estilo.py`
- [Screen montage](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video/montar.py): `TPF/video/montar.py`
- [Animated reel](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video_animado/src/Reel.tsx): `TPF/video_animado/src/Reel.tsx`
- [Horizontal render](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video_animado/src/Horizontal.tsx): `TPF/video_animado/src/Horizontal.tsx`
- [Scene timing](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video_animado/src/lib/tiempo.ts): `TPF/video_animado/src/lib/tiempo.ts`
- [Motion utilities](https://github.com/nazarenofolica/optimizacion_tps/blob/main/TPF/video_animado/src/lib/anim.ts): `TPF/video_animado/src/lib/anim.ts`

### Other components

- **Shopper**
- **Groq LLM**

## Connections

- Base model → Derived tables: uses tables (evidence: `TP1/src/modelo.py`)
- Model reports → Derived tables: uses tables (evidence: `TP1/src/reportes.py`)
- Model reports → Base model: uses model (evidence: `TP1/src/reportes.py`)
- Model reports → Model parameters: uses settings (evidence: `TP1/src/reportes.py`)
- Price and food sources → SEPA settings: uses settings (evidence: `TPF/base_sepa/sepa/fuentes/catalogos_web.py`)
- Nutrient profiles → Price and food sources: uses food data (evidence: `TPF/base_sepa/sepa/producto/nutrientes.py`)
- Nutrient profiles → SEPA settings: uses settings (evidence: `TPF/base_sepa/sepa/producto/nutrientes.py`)
- SEPA output → Nutrient profiles: uses profiles (evidence: `TPF/base_sepa/sepa/salida.py`)
- SEPA output → Prices and promotions: uses promotions (evidence: `TPF/base_sepa/sepa/salida.py`)
- Basket web UI → Web server: submits requests
- Web server → Basket routes: dispatches to
- Basket routes → Store offers: uses offers (evidence: `TPF/base_sepa/canasta/rutas.py`)
- Basket routes → Household needs: uses requirements
- Web server → Request interpreter: offers interpretation
- Request interpreter → Groq LLM: requests parsing
- Request interpreter → Household needs: validates request (evidence: `TPF/base_sepa/canasta/llm.py`)
- Basket optimizer → Store offers: uses offers
- Basket routes → Basket optimizer: calculates basket
- Basket optimizer → Basket results: produces result
- Shopper → Basket web UI: enters needs
- Manim scenes → Video style: uses style (evidence: `TPF/video/escenas.py`)
- Screen montage → Video style: uses style (evidence: `TPF/video/montar.py`)
- Screen montage → Manim scenes: composes scene
- Animated reel → Scene timing: uses timing (evidence: `TPF/video_animado/src/Reel.tsx`)
- Horizontal render → Animated reel: renders scenes (evidence: `TPF/video_animado/src/Horizontal.tsx`)
- Horizontal render → Motion utilities: uses motion (evidence: `TPF/video_animado/src/Horizontal.tsx`)
