# nandinipatnaik9017-jpg/docustruct-ai architecture

> Architecture diagram of the GitHub repository nandinipatnaik9017-jpg/docustruct-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nandinipatnaik9017-jpg/docustruct-ai
- Repository: https://github.com/nandinipatnaik9017-jpg/docustruct-ai

## Overview

DocuStruct AI is a local invoice-PDF processing app. A user uploads a PDF through the Streamlit interface; the app invokes the extractor, which reads PDF text and requests structured fields from a local Ollama model. The app then validates the fields, lets the user correct them, and provides JSON and CSV exports. Validation, review, and export are responsibilities within the same app module, so they share its path. The README documents these capabilities; the excerpts show the extraction internals, but not the app’s full upload and export implementation.

Main entry points: [`DocuStruct_AI_shared_team/app.py`](https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/app.py) (Streamlit app), [`DocuStruct_AI_shared_team/extractor.py`](https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/extractor.py) (PDF text extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_streamlit_app["Streamlit app<br/>[app.py]"]
end

subgraph group_processing["Invoice processing"]
  node_pdf_text["PDF text extraction<br/>[extractor.py]"]
  node_field_extraction["Field extraction<br/>[extractor.py]"]
  node_ollama{{"Local Ollama"}}
end

subgraph group_results["Review and export"]
  node_validation["Invoice validation<br/>[app.py]"]
  node_human_review["Field review<br/>[app.py]"]
  node_export["JSON and CSV export<br/>[app.py]"]
end

node_user(("Invoice user"))

node_user -->|"uploads invoice"| node_streamlit_app
node_streamlit_app -->|"requests extraction"| node_pdf_text
node_pdf_text -->|"passes text"| node_field_extraction
node_field_extraction -->|"requests fields"| node_ollama
node_streamlit_app -->|"validates fields"| node_validation
node_streamlit_app -->|"presents fields"| node_human_review
node_human_review -->|"checks corrections"| node_validation
node_streamlit_app -->|"exports data"| node_export

click node_streamlit_app "https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/app.py"
click node_pdf_text "https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/extractor.py"
click node_field_extraction "https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/extractor.py"
click node_validation "https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/app.py"
click node_human_review "https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/app.py"
click node_export "https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/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_streamlit_app,node_user toneBlue
class node_pdf_text,node_field_extraction,node_ollama toneAmber
class node_validation,node_human_review,node_export toneMint
```

## Components

### User interface

- [Streamlit app](https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/app.py): `DocuStruct_AI_shared_team/app.py`

### Invoice processing

- [PDF text extraction](https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/extractor.py): `DocuStruct_AI_shared_team/extractor.py`
- [Field extraction](https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/extractor.py): `DocuStruct_AI_shared_team/extractor.py`
- **Local Ollama**

### Review and export

- [Invoice validation](https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/app.py): `DocuStruct_AI_shared_team/app.py`
- [Field review](https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/app.py): `DocuStruct_AI_shared_team/app.py`
- [JSON and CSV export](https://github.com/nandinipatnaik9017-jpg/docustruct-ai/blob/main/DocuStruct_AI_shared_team/app.py): `DocuStruct_AI_shared_team/app.py`

### Other components

- **Invoice user**

## Connections

- Invoice user → Streamlit app: uploads invoice (evidence: `README.md`)
- Streamlit app → PDF text extraction: requests extraction (evidence: `DocuStruct_AI_shared_team/app.py`)
- PDF text extraction → Field extraction: passes text (evidence: `DocuStruct_AI_shared_team/extractor.py`)
- Field extraction → Local Ollama: requests fields (evidence: `DocuStruct_AI_shared_team/extractor.py`)
- Streamlit app → Invoice validation: validates fields (evidence: `README.md`)
- Streamlit app → Field review: presents fields (evidence: `README.md`)
- Field review → Invoice validation: checks corrections (evidence: `README.md`)
- Streamlit app → JSON and CSV export: exports data (evidence: `README.md`)
