# yasminacarlafernandez/lex_ia architecture

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

- Interactive diagram: https://gitdiagram.com/yasminacarlafernandez/lex_ia
- Repository: https://github.com/yasminacarlafernandez/lex_ia

## Overview

LexIA is a Streamlit app for preliminary contract review: a user uploads a document, the app extracts text, calls the contract agent, and displays its report. The sampled app extracts PDF, DOCX, and TXT content directly; the separate PDF/DOCX reader helpers are not called in that flow. The agent excerpt builds a fixed Spanish report template, rather than showing Gemini analysis or bilingual output. Those capabilities are described in the README, but their implementation and wiring are not evidenced in the sampled source.

Main entry points: [`app.py`](https://github.com/yasminacarlafernandez/lex_ia/blob/master/app.py) (Upload and display), [`agents/contract_agent.py`](https://github.com/yasminacarlafernandez/lex_ia/blob/master/agents/contract_agent.py) (Report template)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_streamlit["Upload and display<br/>[app.py]"]
end

subgraph group_ingestion["Document ingestion"]
  node_text_extraction["Text extraction<br/>[app.py]"]
  node_pdf_helper["PDF reader helper<br/>[pdf_reader.py]"]
  node_docx_helper["DOCX reader helper<br/>[docx_reader.py]"]
end

subgraph group_analysis["Contract reporting"]
  node_agent["Report template<br/>[contract_agent.py]"]
end

node_user(("Contract reviewer"))
node_gemini["Google Gemini"]

node_user -->|"uploads contract"| node_streamlit
node_streamlit -->|"extracts text"| node_text_extraction
node_streamlit -->|"calls analysis"| node_agent
node_agent -->|"returns report"| node_streamlit
node_streamlit -->|"displays report"| node_user
node_agent -.->|"uses AI analysis"| node_gemini

click node_streamlit "https://github.com/yasminacarlafernandez/lex_ia/blob/master/app.py"
click node_text_extraction "https://github.com/yasminacarlafernandez/lex_ia/blob/master/app.py"
click node_pdf_helper "https://github.com/yasminacarlafernandez/lex_ia/blob/master/utils/pdf_reader.py"
click node_docx_helper "https://github.com/yasminacarlafernandez/lex_ia/blob/master/utils/docx_reader.py"
click node_agent "https://github.com/yasminacarlafernandez/lex_ia/blob/master/agents/contract_agent.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_streamlit,node_user toneBlue
class node_text_extraction,node_pdf_helper,node_docx_helper toneAmber
class node_agent toneMint
class node_gemini toneIndigo
```

## Components

### User interface

- [Upload and display](https://github.com/yasminacarlafernandez/lex_ia/blob/master/app.py): `app.py`

### Document ingestion

- [Text extraction](https://github.com/yasminacarlafernandez/lex_ia/blob/master/app.py): `app.py`
- [PDF reader helper](https://github.com/yasminacarlafernandez/lex_ia/blob/master/utils/pdf_reader.py): `utils/pdf_reader.py`
- [DOCX reader helper](https://github.com/yasminacarlafernandez/lex_ia/blob/master/utils/docx_reader.py): `utils/docx_reader.py`

### Contract reporting

- [Report template](https://github.com/yasminacarlafernandez/lex_ia/blob/master/agents/contract_agent.py): `agents/contract_agent.py`

### Other components

- **Contract reviewer**
- **Google Gemini**

## Connections

- Contract reviewer → Upload and display: uploads contract (evidence: `README.md`)
- Upload and display → Text extraction: extracts text (evidence: `app.py`)
- Upload and display → Report template: calls analysis (evidence: `app.py`)
- Report template → Upload and display: returns report (evidence: `app.py`)
- Upload and display → Contract reviewer: displays report (evidence: `app.py`)
- Report template → Google Gemini: uses AI analysis
