# alejandromt17/proyecto-busqueda-semantica architecture

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

- Interactive diagram: https://gitdiagram.com/alejandromt17/proyecto-busqueda-semantica
- Repository: https://github.com/alejandromt17/proyecto-busqueda-semantica

## Overview

This is a Streamlit application for semantic and hybrid document search, backed by a distributed Spark pipeline. The principal workflow is raw-document ETL and chunking, embedding generation, Elasticsearch indexing, then user search and ranked results. The UI also exposes service status, pipeline guidance, and automatic setup. The README documents the pipeline stages and storage flow; some implementation details are unsampled, so only documented or excerpt-supported links are shown.

Main entry points: [`src/app_common.py`](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/app_common.py) (UI utilities), [`pages/1_Busqueda.py`](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/pages/1_Busqueda.py) (Search page), [`src/etl_features.py`](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/etl_features.py) (ETL and chunking), [`src/batch_inference.py`](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/batch_inference.py) (Embedding inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Search interface"]
  node_home["Application home<br/>[app.py]"]
  node_search_page["Search page<br/>[1_Busqueda.py]"]
  node_search_logic["Search client<br/>[semantic_search.py]"]
  node_status_page["Service status<br/>[2_Estado.py]"]
  node_pipeline_page["Pipeline guide<br/>[3_Pipeline.py]"]
  node_auto_page["Automatic setup"]
  node_shared_ui["UI utilities<br/>[app_common.py]"]
end

subgraph group_pipeline["Data pipeline"]
  node_raw_docs["Raw documents"]
  node_etl["ETL and chunking<br/>[etl_features.py]"]
  node_features["Feature files"]
  node_inference["Embedding inference<br/>[batch_inference.py]"]
  node_predictions["Embedding files"]
  node_persistence["Index persistence<br/>[persistence.py]"]
  node_quality["ETL quality report"]
  node_es[("Elasticsearch index")]
end

subgraph group_config["Configuration"]
  node_config_loader["Config loader<br/>[project_config.py]"]
  node_config_file["Runtime settings<br/>[config.yaml]"]
end

subgraph group_ops["Service operations"]
  node_auto_script["Service orchestrator<br/>[servicio_auto.ps1]"]
  node_minio[("MinIO object store")]
end

node_user(("Search user"))
node_model{{"Embedding model"}}

node_user -->|"submits query"| node_search_page
node_search_page -->|"loads config"| node_shared_ui
node_search_page -->|"executes search"| node_search_logic
node_search_logic -->|"queries index"| node_es
node_search_page -->|"encodes query"| node_model
node_home -->|"loads config"| node_shared_ui
node_status_page -->|"checks services"| node_shared_ui
node_pipeline_page -->|"loads config"| node_shared_ui
node_auto_page -->|"checks status"| node_shared_ui
node_auto_page -->|"runs setup"| node_auto_script
node_config_loader -->|"loads settings"| node_config_file
node_raw_docs -->|"provides inputs"| node_etl
node_etl -->|"reads raw data"| node_minio
node_etl -->|"writes chunks"| node_features
node_features -->|"provides features"| node_inference
node_inference -->|"generates embeddings"| node_model
node_inference -->|"writes embeddings"| node_predictions
node_predictions -->|"provides predictions"| node_persistence
node_persistence -->|"upserts chunks"| node_es
node_quality -->|"validates output"| node_features

click node_home "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/app.py"
click node_search_page "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/pages/1_Busqueda.py"
click node_search_logic "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/semantic_search.py"
click node_status_page "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/pages/2_Estado.py"
click node_pipeline_page "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/pages/3_Pipeline.py"
click node_auto_page "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/pages/4_Servicio_Automatico.py"
click node_shared_ui "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/app_common.py"
click node_etl "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/etl_features.py"
click node_inference "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/batch_inference.py"
click node_persistence "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/persistence.py"
click node_quality "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/scripts/reporte_calidad_etl_fase1.py"
click node_config_loader "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/project_config.py"
click node_config_file "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/conf/config.yaml"
click node_auto_script "https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/scripts/servicio_auto.ps1"

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_home,node_search_page,node_search_logic,node_status_page,node_pipeline_page,node_auto_page,node_shared_ui,node_user toneBlue
class node_raw_docs,node_etl,node_features,node_inference,node_predictions,node_persistence,node_quality,node_es toneAmber
class node_config_loader,node_config_file toneMint
class node_auto_script,node_minio toneRose
class node_model toneIndigo
```

## Components

### Search interface

- [Application home](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/app.py): `app.py`
- [Search page](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/pages/1_Busqueda.py): `pages/1_Busqueda.py`
- [Search client](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/semantic_search.py): `src/semantic_search.py`
- [Service status](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/pages/2_Estado.py): `pages/2_Estado.py`
- [Pipeline guide](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/pages/3_Pipeline.py): `pages/3_Pipeline.py`
- [Automatic setup](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/pages/4_Servicio_Automatico.py): `pages/4_Servicio_Automatico.py`
- [UI utilities](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/app_common.py): `src/app_common.py`

### Data pipeline

- **Raw documents**
- [ETL and chunking](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/etl_features.py): `src/etl_features.py`
- **Feature files**
- [Embedding inference](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/batch_inference.py): `src/batch_inference.py`
- **Embedding files**
- [Index persistence](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/persistence.py): `src/persistence.py`
- [ETL quality report](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/scripts/reporte_calidad_etl_fase1.py): `scripts/reporte_calidad_etl_fase1.py`
- **Elasticsearch index**

### Configuration

- [Config loader](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/src/project_config.py): `src/project_config.py`
- [Runtime settings](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/conf/config.yaml): `conf/config.yaml`

### Service operations

- [Service orchestrator](https://github.com/alejandromt17/proyecto-busqueda-semantica/blob/main/scripts/servicio_auto.ps1): `scripts/servicio_auto.ps1`
- **MinIO object store**

### Other components

- **Search user**
- **Embedding model**

## Connections

- Search user → Search page: submits query (evidence: `pages/1_Busqueda.py`)
- Search page → UI utilities: loads config (evidence: `pages/1_Busqueda.py`)
- Search page → Search client: executes search (evidence: `pages/1_Busqueda.py`)
- Search client → Elasticsearch index: queries index (evidence: `src/semantic_search.py`)
- Search page → Embedding model: encodes query (evidence: `pages/1_Busqueda.py`)
- Application home → UI utilities: loads config (evidence: `app.py`)
- Service status → UI utilities: checks services (evidence: `pages/2_Estado.py`)
- Pipeline guide → UI utilities: loads config (evidence: `pages/3_Pipeline.py`)
- Automatic setup → UI utilities: checks status (evidence: `pages/4_Servicio_Automatico.py`)
- Automatic setup → Service orchestrator: runs setup (evidence: `pages/4_Servicio_Automatico.py`)
- Config loader → Runtime settings: loads settings (evidence: `src/project_config.py`)
- Raw documents → ETL and chunking: provides inputs (evidence: `README.md`)
- ETL and chunking → MinIO object store: reads raw data (evidence: `README.md`)
- ETL and chunking → Feature files: writes chunks (evidence: `README.md`)
- Feature files → Embedding inference: provides features (evidence: `README.md`)
- Embedding inference → Embedding model: generates embeddings (evidence: `README.md`)
- Embedding inference → Embedding files: writes embeddings (evidence: `README.md`)
- Embedding files → Index persistence: provides predictions (evidence: `README.md`)
- Index persistence → Elasticsearch index: upserts chunks (evidence: `README.md`)
- ETL quality report → Feature files: validates output (evidence: `README.md`)
