# zentech-innovations/zentech-knowledgegraph architecture

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

- Interactive diagram: https://gitdiagram.com/zentech-innovations/zentech-knowledgegraph
- Repository: https://github.com/zentech-innovations/zentech-knowledgegraph

## Overview

This Streamlit application ingests PDFs into a Neo4j knowledge graph and answers questions using graph data and an LLM. The main workflow runs from the UI through PDF extraction and graph storage, or through Cypher generation, graph retrieval, and answer synthesis; it can also display a relevant graph snippet. The source excerpts show these call paths, but the README is empty and some UI and database responsibilities share modules, so related capabilities are represented as separate components with the same source path.

Main entry points: [`Modules/appUi.py`](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/appUi.py) (Interaction UI), [`Modules/LLMWrapper.py`](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/LLMWrapper.py) (LLM Wrapper), [`main.py`](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/main.py) (Streamlit Entry), [`Modules/DBUtils.py`](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/DBUtils.py) (Graph Query Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_entry["Streamlit Entry<br/>[main.py]"]
  node_ui["Interaction UI<br/>[appUi.py]"]
  node_prompts["Prompts and Questions<br/>[Constants.py]"]
end

subgraph group_ingest["Document Ingestion"]
  node_pdf["PDF Extraction<br/>[pdfProcessor.py]"]
  node_graphwrite["Triple Storage<br/>[DBUtils.py]"]
end

subgraph group_query["Question Answering"]
  node_queryservice["Graph Query Service<br/>[DBUtils.py]"]
  node_answer["Answer Generation<br/>[appUi.py]"]
  node_visualize["Graph Snippet<br/>[DBUtils.py]"]
  node_modelwrapper["LLM Wrapper<br/>[LLMWrapper.py]"]
end

subgraph group_platform["Configuration and Storage"]
  node_config["Configuration<br/>[loadConfig.py]"]
end

node_user(("User"))
node_neo4j[("Neo4j")]
node_gemini{{"Google Gemini"}}
node_openai{{"OpenAI"}}
node_anthropic{{"Anthropic"}}

node_user -->|"uses"| node_entry
node_entry -->|"configures APIs"| node_config
node_entry -->|"opens connection"| node_queryservice
node_entry -->|"renders"| node_ui
node_entry -->|"creates wrapper"| node_modelwrapper
node_entry -->|"initializes prompt"| node_prompts
node_ui -->|"processes uploads"| node_pdf
node_ui -->|"uses questions"| node_prompts
node_pdf -->|"stores triples"| node_graphwrite
node_pdf -->|"extracts with"| node_gemini
node_graphwrite -->|"writes graph"| node_neo4j
node_ui -->|"generates Cypher"| node_queryservice
node_queryservice -->|"generates query"| node_modelwrapper
node_queryservice -->|"reads graph"| node_neo4j
node_ui -->|"executes query"| node_queryservice
node_ui -->|"handles response"| node_answer
node_answer -->|"generates answer"| node_modelwrapper
node_ui -->|"requests snippet"| node_visualize
node_visualize -->|"extracts entities"| node_modelwrapper
node_visualize -->|"searches graph"| node_neo4j
node_modelwrapper -->|"generates with"| node_gemini
node_modelwrapper -->|"generates with"| node_openai
node_modelwrapper -->|"generates with"| node_anthropic
node_config -->|"configures key"| node_gemini

click node_entry "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/main.py"
click node_ui "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/appUi.py"
click node_prompts "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/Constants.py"
click node_pdf "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/pdfProcessor.py"
click node_graphwrite "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/DBUtils.py"
click node_queryservice "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/DBUtils.py"
click node_answer "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/appUi.py"
click node_visualize "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/DBUtils.py"
click node_modelwrapper "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/LLMWrapper.py"
click node_config "https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/loadConfig.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_entry,node_ui,node_prompts,node_user toneBlue
class node_pdf,node_graphwrite,node_neo4j toneAmber
class node_queryservice,node_answer,node_visualize,node_modelwrapper toneMint
class node_config toneRose
class node_gemini,node_openai,node_anthropic toneIndigo
```

## Components

### Application UI

- [Streamlit Entry](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/main.py): `main.py`
- [Interaction UI](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/appUi.py): `Modules/appUi.py`
- [Prompts and Questions](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/Constants.py): `Modules/Constants.py`

### Document Ingestion

- [PDF Extraction](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/pdfProcessor.py): `Modules/pdfProcessor.py`
- [Triple Storage](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/DBUtils.py): `Modules/DBUtils.py`

### Question Answering

- [Graph Query Service](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/DBUtils.py): `Modules/DBUtils.py`
- [Answer Generation](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/appUi.py): `Modules/appUi.py`
- [Graph Snippet](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/DBUtils.py): `Modules/DBUtils.py`
- [LLM Wrapper](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/LLMWrapper.py): `Modules/LLMWrapper.py`

### Configuration and Storage

- [Configuration](https://github.com/zentech-innovations/zentech-knowledgegraph/blob/main/Modules/loadConfig.py): `Modules/loadConfig.py`

### Other components

- **User**
- **Neo4j**
- **Google Gemini**
- **OpenAI**
- **Anthropic**

## Connections

- User → Streamlit Entry: uses (evidence: `main.py`)
- Streamlit Entry → Configuration: configures APIs (evidence: `main.py`)
- Streamlit Entry → Graph Query Service: opens connection (evidence: `main.py`)
- Streamlit Entry → Interaction UI: renders (evidence: `main.py`)
- Streamlit Entry → LLM Wrapper: creates wrapper (evidence: `main.py`)
- Streamlit Entry → Prompts and Questions: initializes prompt (evidence: `main.py`)
- Interaction UI → PDF Extraction: processes uploads (evidence: `Modules/appUi.py`)
- Interaction UI → Prompts and Questions: uses questions (evidence: `Modules/appUi.py`)
- PDF Extraction → Triple Storage: stores triples (evidence: `Modules/pdfProcessor.py`)
- PDF Extraction → Google Gemini: extracts with (evidence: `Modules/pdfProcessor.py`)
- Triple Storage → Neo4j: writes graph (evidence: `Modules/DBUtils.py`)
- Interaction UI → Graph Query Service: generates Cypher (evidence: `Modules/appUi.py`)
- Graph Query Service → LLM Wrapper: generates query (evidence: `Modules/DBUtils.py`)
- Graph Query Service → Neo4j: reads graph (evidence: `Modules/DBUtils.py`)
- Interaction UI → Graph Query Service: executes query (evidence: `Modules/appUi.py`)
- Interaction UI → Answer Generation: handles response (evidence: `Modules/appUi.py`)
- Answer Generation → LLM Wrapper: generates answer (evidence: `Modules/appUi.py`)
- Interaction UI → Graph Snippet: requests snippet (evidence: `Modules/appUi.py`)
- Graph Snippet → LLM Wrapper: extracts entities (evidence: `Modules/DBUtils.py`)
- Graph Snippet → Neo4j: searches graph (evidence: `Modules/DBUtils.py`)
- LLM Wrapper → Google Gemini: generates with (evidence: `Modules/LLMWrapper.py`)
- LLM Wrapper → OpenAI: generates with (evidence: `Modules/LLMWrapper.py`)
- LLM Wrapper → Anthropic: generates with (evidence: `Modules/LLMWrapper.py`)
- Configuration → Google Gemini: configures key (evidence: `Modules/loadConfig.py`)
