# dev-atri/projeto_oficina architecture

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

- Interactive diagram: https://gitdiagram.com/dev-atri/projeto_oficina
- Repository: https://github.com/dev-atri/projeto_oficina

## Overview

RPA Atri consolidates repair orders (OSs), supports human review and insurer validation, and prepares OS closure through the Conference API. The principal workflow runs from Conference data and required documents through AI extraction, validation, persistence, and dashboard curation; the README describes closure as a later third step. The graph also includes the web dashboard and its authentication, plus the documented portal-credential and execution-management capabilities. Some relationships rely on SOURCE INDEX references or README statements; unsampled route and worker internals are not inferred.

Main entry points: [`steps/passo_1_consolidacao/triagem.py`](https://github.com/dev-atri/projeto_oficina/blob/main/steps/passo_1_consolidacao/triagem.py) (OS triage), [`app/api/dashboard/consolidacoes/route.js`](https://github.com/dev-atri/projeto_oficina/blob/main/app/api/dashboard/consolidacoes/route.js) (Dashboard routes), [`steps/passo_1_consolidacao/executar.py`](https://github.com/dev-atri/projeto_oficina/blob/main/steps/passo_1_consolidacao/executar.py) (Step 1 runner), [`integrations/conference/client.py`](https://github.com/dev-atri/projeto_oficina/blob/main/integrations/conference/client.py) (Conference client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard"]
  node_dashboard_ui["Dashboard UI<br/>[page.jsx]"]
  node_login_ui["Login page<br/>[page.jsx]"]
end

subgraph group_api["API and access"]
  node_auth_api["Authentication routes<br/>[route.js]"]
  node_auth_access["Auth and permissions<br/>[permissions.js]"]
  node_dashboard_routes["Dashboard routes<br/>[route.js]"]
  node_dashboard_helpers["Dashboard utilities<br/>[dashboard.js]"]
  node_web_database[("Prisma database client<br/>[prisma.js]")]
  node_service_api["Python service API<br/>[client.py]"]
end

subgraph group_consolidation["Order consolidation"]
  node_conference_client["Conference client<br/>[client.py]"]
  node_step1_runner["Step 1 runner<br/>[executar.py]"]
  node_step1_triage["OS triage<br/>[triagem.py]"]
  node_document_reader["Document reader<br/>[document_reader.py]"]
  node_validation["Document and data checks<br/>[anexos.py]"]
  node_cnpj_validation["Insurer CNPJ validation<br/>[cnpj.py]"]
  node_budget_validation["Budget validation<br/>[orcamento.py]"]
  node_validation_classifier["Validation classification<br/>[classificador.py]"]
  node_insurer_registry["Insurer CNPJ registry<br/>[cnpjs.py]"]
end

subgraph group_review["Human review"]
  node_mysql_repository[("Consolidation and review store")]
  node_sqlite_repository[("SQLite result store")]
  node_human_review["Human curation<br/>[client.py]"]
  node_portal_credentials[("Portal credentials<br/>[route.js]")]
end

subgraph group_closure["Conference closure"]
  node_step3["Step 3 closure<br/>[executar.py]"]
end

node_operator(("Operator"))
node_conference_service{{"Conference service"}}
node_document_ai{{"Document AI provider"}}

node_operator -->|"signs in"| node_login_ui
node_operator -->|"uses"| node_dashboard_ui
node_login_ui -.->|"authenticates"| node_auth_api
node_auth_api -->|"uses sessions"| node_auth_access
node_dashboard_routes -->|"checks access"| node_auth_access
node_dashboard_routes -->|"uses"| node_dashboard_helpers
node_dashboard_routes -.->|"requests data"| node_service_api
node_dashboard_routes -.->|"queries"| node_web_database
node_dashboard_ui -.->|"requests data"| node_dashboard_routes
node_operator -->|"runs triage"| node_step1_runner
node_step1_runner -->|"gets OS data"| node_conference_client
node_step1_runner -->|"runs triage"| node_step1_triage
node_step1_runner -->|"persists results"| node_sqlite_repository
node_step1_triage -->|"reads OS and documents"| node_conference_client
node_step1_triage -->|"extracts documents"| node_document_reader
node_document_reader -->|"delegates reading"| node_document_ai
node_step1_triage -->|"checks attachments"| node_validation
node_step1_triage -->|"checks CNPJ"| node_cnpj_validation
node_cnpj_validation -->|"looks up insurer"| node_insurer_registry
node_step1_triage -->|"checks budget"| node_budget_validation
node_step1_triage -->|"classifies result"| node_validation_classifier
node_step1_triage -.->|"persists triage"| node_mysql_repository
node_service_api -->|"reads and writes"| node_mysql_repository
node_operator -->|"curates OSs"| node_human_review
node_human_review -->|"updates review"| node_mysql_repository
node_operator -->|"manages portals"| node_portal_credentials
node_portal_credentials -->|"stores credentials"| node_web_database
node_operator -.->|"runs closure"| node_step3
node_step3 -.->|"closes OS"| node_conference_service
node_conference_client -->|"queries and downloads"| node_conference_service

click node_dashboard_ui "https://github.com/dev-atri/projeto_oficina/blob/main/app/page.jsx"
click node_login_ui "https://github.com/dev-atri/projeto_oficina/blob/main/app/login/page.jsx"
click node_auth_api "https://github.com/dev-atri/projeto_oficina/blob/main/app/api/auth/login/route.js"
click node_auth_access "https://github.com/dev-atri/projeto_oficina/blob/main/lib/auth/permissions.js"
click node_dashboard_routes "https://github.com/dev-atri/projeto_oficina/blob/main/app/api/dashboard/consolidacoes/route.js"
click node_dashboard_helpers "https://github.com/dev-atri/projeto_oficina/blob/main/lib/dashboard.js"
click node_web_database "https://github.com/dev-atri/projeto_oficina/blob/main/lib/prisma.js"
click node_service_api "https://github.com/dev-atri/projeto_oficina/blob/main/client.py"
click node_conference_client "https://github.com/dev-atri/projeto_oficina/blob/main/integrations/conference/client.py"
click node_step1_runner "https://github.com/dev-atri/projeto_oficina/blob/main/steps/passo_1_consolidacao/executar.py"
click node_step1_triage "https://github.com/dev-atri/projeto_oficina/blob/main/steps/passo_1_consolidacao/triagem.py"
click node_document_reader "https://github.com/dev-atri/projeto_oficina/blob/main/services/ia/document_reader.py"
click node_validation "https://github.com/dev-atri/projeto_oficina/blob/main/services/validacoes/anexos.py"
click node_cnpj_validation "https://github.com/dev-atri/projeto_oficina/blob/main/services/validacoes/cnpj.py"
click node_budget_validation "https://github.com/dev-atri/projeto_oficina/blob/main/services/validacoes/orcamento.py"
click node_validation_classifier "https://github.com/dev-atri/projeto_oficina/blob/main/services/validacoes/classificador.py"
click node_insurer_registry "https://github.com/dev-atri/projeto_oficina/blob/main/modules/seguradora/cnpjs.py"
click node_mysql_repository "https://github.com/dev-atri/projeto_oficina/blob/main/repositories/mysql_consolidacao_repository.py"
click node_sqlite_repository "https://github.com/dev-atri/projeto_oficina/blob/main/repositories/consolidacao_repository.py"
click node_human_review "https://github.com/dev-atri/projeto_oficina/blob/main/client.py"
click node_portal_credentials "https://github.com/dev-atri/projeto_oficina/blob/main/app/api/dashboard/portais-senhas/route.js"
click node_step3 "https://github.com/dev-atri/projeto_oficina/blob/main/steps/passo_3_fechamento/executar.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_dashboard_ui,node_login_ui toneBlue
class node_auth_api,node_auth_access,node_dashboard_routes,node_dashboard_helpers,node_web_database,node_service_api toneAmber
class node_conference_client,node_step1_runner,node_step1_triage,node_document_reader,node_validation,node_cnpj_validation,node_budget_validation,node_validation_classifier,node_insurer_registry toneMint
class node_mysql_repository,node_sqlite_repository,node_human_review,node_portal_credentials toneRose
class node_step3,node_operator,node_conference_service,node_document_ai toneIndigo
```

## Components

### Dashboard

- [Dashboard UI](https://github.com/dev-atri/projeto_oficina/blob/main/app/page.jsx): `app/page.jsx`
- [Login page](https://github.com/dev-atri/projeto_oficina/blob/main/app/login/page.jsx): `app/login/page.jsx`

### API and access

- [Authentication routes](https://github.com/dev-atri/projeto_oficina/blob/main/app/api/auth/login/route.js): `app/api/auth/login/route.js`
- [Auth and permissions](https://github.com/dev-atri/projeto_oficina/blob/main/lib/auth/permissions.js): `lib/auth/permissions.js`
- [Dashboard routes](https://github.com/dev-atri/projeto_oficina/blob/main/app/api/dashboard/consolidacoes/route.js): `app/api/dashboard/consolidacoes/route.js`
- [Dashboard utilities](https://github.com/dev-atri/projeto_oficina/blob/main/lib/dashboard.js): `lib/dashboard.js`
- [Prisma database client](https://github.com/dev-atri/projeto_oficina/blob/main/lib/prisma.js): `lib/prisma.js`
- [Python service API](https://github.com/dev-atri/projeto_oficina/blob/main/client.py): `client.py`

### Order consolidation

- [Conference client](https://github.com/dev-atri/projeto_oficina/blob/main/integrations/conference/client.py): `integrations/conference/client.py`
- [Step 1 runner](https://github.com/dev-atri/projeto_oficina/blob/main/steps/passo_1_consolidacao/executar.py): `steps/passo_1_consolidacao/executar.py`
- [OS triage](https://github.com/dev-atri/projeto_oficina/blob/main/steps/passo_1_consolidacao/triagem.py): `steps/passo_1_consolidacao/triagem.py`
- [Document reader](https://github.com/dev-atri/projeto_oficina/blob/main/services/ia/document_reader.py): `services/ia/document_reader.py`
- [Document and data checks](https://github.com/dev-atri/projeto_oficina/blob/main/services/validacoes/anexos.py): `services/validacoes/anexos.py`
- [Insurer CNPJ validation](https://github.com/dev-atri/projeto_oficina/blob/main/services/validacoes/cnpj.py): `services/validacoes/cnpj.py`
- [Budget validation](https://github.com/dev-atri/projeto_oficina/blob/main/services/validacoes/orcamento.py): `services/validacoes/orcamento.py`
- [Validation classification](https://github.com/dev-atri/projeto_oficina/blob/main/services/validacoes/classificador.py): `services/validacoes/classificador.py`
- [Insurer CNPJ registry](https://github.com/dev-atri/projeto_oficina/blob/main/modules/seguradora/cnpjs.py): `modules/seguradora/cnpjs.py`

### Human review

- [Consolidation and review store](https://github.com/dev-atri/projeto_oficina/blob/main/repositories/mysql_consolidacao_repository.py): `repositories/mysql_consolidacao_repository.py`
- [SQLite result store](https://github.com/dev-atri/projeto_oficina/blob/main/repositories/consolidacao_repository.py): `repositories/consolidacao_repository.py`
- [Human curation](https://github.com/dev-atri/projeto_oficina/blob/main/client.py): `client.py`
- [Portal credentials](https://github.com/dev-atri/projeto_oficina/blob/main/app/api/dashboard/portais-senhas/route.js): `app/api/dashboard/portais-senhas/route.js`

### Conference closure

- [Step 3 closure](https://github.com/dev-atri/projeto_oficina/blob/main/steps/passo_3_fechamento/executar.py): `steps/passo_3_fechamento/executar.py`

### Other components

- **Operator**
- **Conference service**
- **Document AI provider**

## Connections

- Operator → Login page: signs in (evidence: `app/login/page.jsx`)
- Operator → Dashboard UI: uses (evidence: `README.md`)
- Login page → Authentication routes: authenticates
- Authentication routes → Auth and permissions: uses sessions (evidence: `app/api/auth/login/route.js`)
- Dashboard routes → Auth and permissions: checks access (evidence: `app/api/dashboard/consolidacoes/route.js`)
- Dashboard routes → Dashboard utilities: uses (evidence: `app/api/dashboard/consolidacoes/route.js`)
- Dashboard routes → Python service API: requests data
- Dashboard routes → Prisma database client: queries
- Dashboard UI → Dashboard routes: requests data
- Operator → Step 1 runner: runs triage (evidence: `README.md`)
- Step 1 runner → Conference client: gets OS data (evidence: `apps/passo_1_consolidacao/main.py`)
- Step 1 runner → OS triage: runs triage
- Step 1 runner → SQLite result store: persists results (evidence: `apps/passo_1_consolidacao/main.py`)
- OS triage → Conference client: reads OS and documents (evidence: `steps/passo_1_consolidacao/triagem.py`)
- OS triage → Document reader: extracts documents (evidence: `steps/passo_1_consolidacao/triagem.py`)
- Document reader → Document AI provider: delegates reading (evidence: `services/ia/document_reader.py`)
- OS triage → Document and data checks: checks attachments (evidence: `steps/passo_1_consolidacao/triagem.py`)
- OS triage → Insurer CNPJ validation: checks CNPJ (evidence: `steps/passo_1_consolidacao/triagem.py`)
- Insurer CNPJ validation → Insurer CNPJ registry: looks up insurer (evidence: `services/validacoes/cnpj.py`)
- OS triage → Budget validation: checks budget (evidence: `steps/passo_1_consolidacao/triagem.py`)
- OS triage → Validation classification: classifies result (evidence: `steps/passo_1_consolidacao/triagem.py`)
- OS triage → Consolidation and review store: persists triage
- Python service API → Consolidation and review store: reads and writes (evidence: `client.py`)
- Operator → Human curation: curates OSs (evidence: `README.md`)
- Human curation → Consolidation and review store: updates review (evidence: `client.py`)
- Operator → Portal credentials: manages portals (evidence: `app/api/dashboard/portais-senhas/route.js`)
- Portal credentials → Prisma database client: stores credentials (evidence: `app/api/dashboard/portais-senhas/route.js`)
- Operator → Step 3 closure: runs closure
- Step 3 closure → Conference service: closes OS
- Conference client → Conference service: queries and downloads (evidence: `integrations/conference/client.py`)
