# ttstive/challenge02_grupo10 architecture

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

- Interactive diagram: https://gitdiagram.com/ttstive/challenge02_grupo10
- Repository: https://github.com/ttstive/challenge02_grupo10

## Overview

This is a lightweight neurocognitive-speech RAG scaffold. In the documented example, a caller supplies a query and curated speech context to the RAG factory; retrieval builds a typed page index, searches it, and formats matching pages as context. A separate optional LangGraph entry point retrieves pages and assembles a simple answer from the question and context. The index uses term matching, not embeddings or a persistent vector store. Connections reflect the README example and sampled source; no unsampled document-ingestion-to-runtime path is established.

Main entry points: [`src/challenge02_grupo10/rag/retrieval_chain.py`](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/rag/retrieval_chain.py) (RAG factory), [`src/challenge02_grupo10/indexing/page_index.py`](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/indexing/page_index.py) (Page index), [`src/challenge02_grupo10/langgraph/workflow.py`](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/langgraph/workflow.py) (LangGraph workflow), [`src/challenge02_grupo10/data/speech_context.py`](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/data/speech_context.py) (Speech context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_domain["Domain content"]
  node_speech_context["Speech context<br/>[speech_context.py]"]
end

subgraph group_retrieval["Retrieval"]
  node_rag_api["RAG factory<br/>[retrieval_chain.py]"]
  node_page_index["Page index<br/>[page_index.py]"]
  node_context_result["Retrieved context<br/>[retrieval_chain.py]"]
end

subgraph group_workflow["Graph workflow"]
  node_rag_graph["LangGraph workflow<br/>[workflow.py]"]
  node_answer_result["Formatted answer<br/>[workflow.py]"]
end

node_caller(("RAG caller"))

node_caller -->|"builds chain"| node_rag_api
node_caller -->|"supplies context"| node_speech_context
node_rag_api -->|"builds index"| node_page_index
node_rag_api -->|"searches pages"| node_page_index
node_rag_api -->|"formats matches"| node_context_result
node_rag_graph -->|"searches pages"| node_page_index
node_rag_graph -->|"formats answer"| node_answer_result

click node_speech_context "https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/data/speech_context.py"
click node_rag_api "https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/rag/retrieval_chain.py"
click node_page_index "https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/indexing/page_index.py"
click node_context_result "https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/rag/retrieval_chain.py"
click node_rag_graph "https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/langgraph/workflow.py"
click node_answer_result "https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/langgraph/workflow.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_speech_context toneBlue
class node_rag_api,node_page_index,node_context_result toneAmber
class node_rag_graph,node_answer_result toneMint
class node_caller toneIndigo
```

## Components

### Domain content

- [Speech context](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/data/speech_context.py): `src/challenge02_grupo10/data/speech_context.py`

### Retrieval

- [RAG factory](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/rag/retrieval_chain.py): `src/challenge02_grupo10/rag/retrieval_chain.py`
- [Page index](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/indexing/page_index.py): `src/challenge02_grupo10/indexing/page_index.py`
- [Retrieved context](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/rag/retrieval_chain.py): `src/challenge02_grupo10/rag/retrieval_chain.py`

### Graph workflow

- [LangGraph workflow](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/langgraph/workflow.py): `src/challenge02_grupo10/langgraph/workflow.py`
- [Formatted answer](https://github.com/ttstive/challenge02_grupo10/blob/main/src/challenge02_grupo10/langgraph/workflow.py): `src/challenge02_grupo10/langgraph/workflow.py`

### Other components

- **RAG caller**

## Connections

- RAG caller → RAG factory: builds chain (evidence: `README.md`)
- RAG caller → Speech context: supplies context (evidence: `README.md`)
- RAG factory → Page index: builds index (evidence: `src/challenge02_grupo10/rag/retrieval_chain.py`)
- RAG factory → Page index: searches pages (evidence: `src/challenge02_grupo10/rag/retrieval_chain.py`)
- RAG factory → Retrieved context: formats matches (evidence: `src/challenge02_grupo10/rag/retrieval_chain.py`)
- LangGraph workflow → Page index: searches pages (evidence: `src/challenge02_grupo10/langgraph/workflow.py`)
- LangGraph workflow → Formatted answer: formats answer (evidence: `src/challenge02_grupo10/langgraph/workflow.py`)
