# luisalfred1/sistemas-expertos-proyecto architecture

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

- Interactive diagram: https://gitdiagram.com/luisalfred1/sistemas-expertos-proyecto
- Repository: https://github.com/luisalfred1/sistemas-expertos-proyecto

## Overview

SaborChapínExperto is a web-based Guatemalan food recommender. A user selects a category and/or ingredient in the recommendations page; its JavaScript loads available options and submits the selection to FastAPI. The API delegates recommendation work to a Python CLIPS engine, which loads the version 2 knowledge base, evaluates rules, and returns ranked recommendations for display. The graph also includes the documented general site and the shared response contracts. Source evidence is limited to the README and sampled files, so unsampled page wiring and rule-level behavior are not expanded.

Main entry points: [`backend/main.py`](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/main.py) (FastAPI endpoints), [`frontend/js/recomendaciones.js`](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/frontend/js/recomendaciones.js) (Recommendation form), [`backend/motor_experto.py`](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/motor_experto.py) (CLIPS recommendation engine), [`frontend/index.html`](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/frontend/index.html) (General site)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_site["General site<br/>[index.html]"]
  node_recommendation_ui["Recommendation form<br/>[recomendaciones.js]"]
  node_site_interactions["Site interactions<br/>[main.js]"]
end

subgraph group_api["API layer"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_contracts["Request and response models<br/>[modelos.py]"]
end

subgraph group_logic["Recommendation engine"]
  node_engine["CLIPS recommendation engine<br/>[motor_experto.py]"]
  node_knowledge["Food facts and rules<br/>[conocimientoV2.clp]"]
  node_other_dishes["Other documented dishes<br/>[conocimiento.clp]"]
end

node_user(("Food seeker"))

node_user -->|"selects food"| node_recommendation_ui
node_user -->|"visits"| node_site
node_recommendation_ui -->|"fetches options and recommendations"| node_api
node_api -->|"delegates evaluation"| node_engine
node_api -->|"validates and shapes"| node_contracts
node_engine -->|"loads and evaluates"| node_knowledge

click node_site "https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/frontend/index.html"
click node_recommendation_ui "https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/frontend/js/recomendaciones.js"
click node_site_interactions "https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/frontend/js/main.js"
click node_api "https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/main.py"
click node_contracts "https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/modelos.py"
click node_engine "https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/motor_experto.py"
click node_knowledge "https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/conocimientoV2.clp"
click node_other_dishes "https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/conocimiento.clp"

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_site,node_recommendation_ui,node_site_interactions toneBlue
class node_api,node_contracts toneAmber
class node_engine,node_knowledge,node_other_dishes toneMint
class node_user toneIndigo
```

## Components

### Web experience

- [General site](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/frontend/index.html): `frontend/index.html`
- [Recommendation form](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/frontend/js/recomendaciones.js): `frontend/js/recomendaciones.js`
- [Site interactions](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/frontend/js/main.js): `frontend/js/main.js`

### API layer

- [FastAPI endpoints](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/main.py): `backend/main.py`
- [Request and response models](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/modelos.py): `backend/modelos.py`

### Recommendation engine

- [CLIPS recommendation engine](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/motor_experto.py): `backend/motor_experto.py`
- [Food facts and rules](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/conocimientoV2.clp): `backend/conocimientoV2.clp`
- [Other documented dishes](https://github.com/luisalfred1/sistemas-expertos-proyecto/blob/main/backend/conocimiento.clp): `backend/conocimiento.clp`

### Other components

- **Food seeker**

## Connections

- Food seeker → Recommendation form: selects food (evidence: `README.md`)
- Food seeker → General site: visits (evidence: `README.md`)
- Recommendation form → FastAPI endpoints: fetches options and recommendations (evidence: `frontend/js/recomendaciones.js`)
- FastAPI endpoints → CLIPS recommendation engine: delegates evaluation (evidence: `backend/main.py`)
- FastAPI endpoints → Request and response models: validates and shapes (evidence: `backend/main.py`)
- CLIPS recommendation engine → Food facts and rules: loads and evaluates (evidence: `backend/motor_experto.py`)
