# gustavolibano/conectadistribuicao architecture

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

- Interactive diagram: https://gitdiagram.com/gustavolibano/conectadistribuicao
- Repository: https://github.com/gustavolibano/conectadistribuicao

## Overview

Conecta Distribuição is a WhatsApp bot for querying delivery orders stored in an Excel spreadsheet. Twilio posts incoming messages to the Flask webhook, which interprets help, list, and order-detail requests, consults the in-memory order cache, and returns TwiML. The cache loads at startup and a background watcher refreshes it when the sheet changes; a separate health endpoint reports readiness. The single source file combines these responsibilities, so the graph separates them by role while retaining its exact path. Relationships shown are supported by the README or the excerpted app.py.

Main entry points: [`app.py`](https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py) (Order responses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["Messaging and HTTP"]
  node_webhook["WhatsApp endpoint<br/>[app.py]"]
  node_health["Health endpoint<br/>[app.py]"]
end

subgraph group_query["Request interpretation"]
  node_interpret["Message interpretation<br/>[app.py]"]
  node_order_query["Order responses<br/>[app.py]"]
  node_help_list["Help and listing<br/>[app.py]"]
end

subgraph group_orders["Order data"]
  node_excel["Excel workbook"]
  node_loader["Workbook loader<br/>[app.py]"]
  node_cache[("Order cache<br/>[app.py]")]
  node_watcher["Refresh watcher<br/>[app.py]"]
end

node_twilio(("Twilio webhook"))

node_twilio -->|"posts messages"| node_webhook
node_webhook -->|"passes message"| node_interpret
node_webhook -->|"returns TwiML"| node_order_query
node_interpret -->|"dispatches intent"| node_order_query
node_order_query -->|"looks up orders"| node_cache
node_order_query -->|"handles help/list"| node_help_list
node_health -->|"checks readiness"| node_cache
node_excel -->|"provides workbook"| node_loader
node_loader -->|"loads records"| node_cache
node_watcher -->|"refreshes data"| node_loader
node_watcher -->|"checks changes"| node_excel

click node_webhook "https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py"
click node_health "https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py"
click node_interpret "https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py"
click node_order_query "https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py"
click node_help_list "https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py"
click node_loader "https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py"
click node_cache "https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py"
click node_watcher "https://github.com/gustavolibano/conectadistribuicao/blob/main/app.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_webhook,node_health toneBlue
class node_interpret,node_order_query,node_help_list toneAmber
class node_excel,node_loader,node_cache,node_watcher,node_twilio toneMint
```

## Components

### Messaging and HTTP

- [WhatsApp endpoint](https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py): `app.py`
- [Health endpoint](https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py): `app.py`

### Request interpretation

- [Message interpretation](https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py): `app.py`
- [Order responses](https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py): `app.py`
- [Help and listing](https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py): `app.py`

### Order data

- **Excel workbook**
- [Workbook loader](https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py): `app.py`
- [Order cache](https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py): `app.py`
- [Refresh watcher](https://github.com/gustavolibano/conectadistribuicao/blob/main/app.py): `app.py`

### Other components

- **Twilio webhook**

## Connections

- Twilio webhook → WhatsApp endpoint: posts messages (evidence: `README.md`)
- WhatsApp endpoint → Message interpretation: passes message (evidence: `app.py`)
- WhatsApp endpoint → Order responses: returns TwiML (evidence: `app.py`)
- Message interpretation → Order responses: dispatches intent (evidence: `app.py`)
- Order responses → Order cache: looks up orders (evidence: `app.py`)
- Order responses → Help and listing: handles help/list (evidence: `app.py`)
- Health endpoint → Order cache: checks readiness (evidence: `app.py`)
- Excel workbook → Workbook loader: provides workbook (evidence: `README.md`)
- Workbook loader → Order cache: loads records (evidence: `app.py`)
- Refresh watcher → Workbook loader: refreshes data (evidence: `app.py`)
- Refresh watcher → Excel workbook: checks changes (evidence: `app.py`)
