# shaik-nowshinfarhana/federated_knowledge_graph architecture

> Architecture diagram of the GitHub repository shaik-nowshinfarhana/federated_knowledge_graph, 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/shaik-nowshinfarhana/federated_knowledge_graph
- Repository: https://github.com/shaik-nowshinfarhana/federated_knowledge_graph

## Overview

Federated Knowledge Graph turns organizational documents into provenance-bearing Neo4j facts, then exposes graph exploration, GraphRAG answers, entity resolution, conflict detection, failure simulation, temporal views, and a fact ledger. The main path is upload or directory ingestion through parsing, chunking, LLM extraction and workflow validation into graph storage; the API serves the resulting capabilities to the React UI. Edges reflect README architecture and the shown imports, calls, and endpoint requests; several feature modules were not excerpted, so their internals are represented at directory level.

Main entry points: [`backend/main.py`](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/main.py) (FastAPI service), [`backend/workflow/pipeline.py`](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/workflow/pipeline.py) (Ingestion workflow), [`backend/rag/graphrag.py`](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/rag/graphrag.py) (GraphRAG answers), [`frontend/src/pages/LiveGraphPage.jsx`](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/pages/LiveGraphPage.jsx) (Live graph page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingestion"]
  node_parser["Document parser<br/>[parsers.py]"]
  node_ocr["Image OCR<br/>[ocr.py]"]
  node_chunker["Text chunker<br/>[chunker.py]"]
  node_watcher["Directory watcher<br/>[watcher.py]"]
end

subgraph group_knowledge["Knowledge construction"]
  node_workflow["Ingestion workflow<br/>[pipeline.py]"]
  node_extractor["Triple extractor<br/>[extractor.py]"]
  node_ollama["Local LLM"]
  node_resolver["Entity resolver<br/>[resolver.py]"]
  node_embeddings["Entity embeddings<br/>[embeddings.py]"]
  node_graphstore[("Neo4j graph<br/>[neo4j_client.py]")]
end

subgraph group_analysis["Graph analysis"]
  node_queries["Graph queries<br/>[queries.py]"]
  node_chunkstore[("Chunk and summary store<br/>[chunk_store.py]")]
  node_graphrag["GraphRAG answers<br/>[graphrag.py]"]
  node_simulation["Failure simulation<br/>[failure.py]"]
  node_ledger[("Fact provenance ledger<br/>[ledger.py]")]
  node_conflicts["Conflict detection<br/>[queries.py]"]
  node_temporal["Temporal lineage<br/>[queries.py]"]
end

subgraph group_service["API and interface"]
  node_api["FastAPI service<br/>[main.py]"]
  node_webapp["React application<br/>[App.jsx]"]
  node_querybox["Question interface<br/>[QueryBox.jsx]"]
  node_livepage["Live graph page<br/>[LiveGraphPage.jsx]"]
  node_graphview["Graph visualization<br/>[GraphView.jsx]"]
  node_ingestviz["Ingestion progress"]
  node_failurepanel["Failure panel"]
end

node_user(("User"))
node_documents["Source documents"]

node_user -->|"provides"| node_documents
node_documents -->|"parsed by"| node_parser
node_parser -->|"dispatches images"| node_ocr
node_parser -->|"produces text"| node_chunker
node_watcher -.->|"starts ingestion"| node_workflow
node_chunker -->|"provides chunks"| node_workflow
node_workflow -->|"invokes extraction"| node_extractor
node_extractor -->|"requests extraction"| node_ollama
node_workflow -->|"persists facts"| node_graphstore
node_workflow -->|"stores chunks"| node_chunkstore
node_workflow -->|"records provenance"| node_ledger
node_workflow -->|"runs resolution"| node_resolver
node_resolver -->|"uses embeddings"| node_embeddings
node_embeddings -->|"requests vectors"| node_ollama
node_resolver -->|"merges entities"| node_graphstore
node_api -->|"starts jobs"| node_workflow
node_api -->|"answers questions"| node_graphrag
node_graphrag -->|"retrieves graph facts"| node_queries
node_graphrag -->|"searches excerpts"| node_chunkstore
node_graphrag -->|"generates answers"| node_ollama
node_queries -->|"runs Cypher"| node_graphstore
node_api -->|"simulates failures"| node_simulation
node_api -->|"serves conflicts"| node_conflicts
node_api -->|"serves temporal graph"| node_temporal
node_api -->|"serves graph data"| node_graphstore
node_user -->|"uses"| node_webapp
node_webapp -->|"renders"| node_livepage
node_livepage -->|"renders"| node_querybox
node_livepage -->|"renders"| node_graphview
node_webapp -->|"starts ingestion"| node_api
node_querybox -->|"asks questions"| node_api
node_livepage -->|"renders"| node_failurepanel
node_ingestviz -->|"polls job status"| node_api

click node_parser "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/ingestion/parsers.py"
click node_ocr "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/ingestion/ocr.py"
click node_chunker "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/ingestion/chunker.py"
click node_watcher "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/ingestion/watcher.py"
click node_workflow "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/workflow/pipeline.py"
click node_extractor "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/llm/extractor.py"
click node_resolver "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/resolution/resolver.py"
click node_embeddings "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/resolution/embeddings.py"
click node_graphstore "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/graph/neo4j_client.py"
click node_queries "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/graph/queries.py"
click node_chunkstore "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/rag/chunk_store.py"
click node_graphrag "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/rag/graphrag.py"
click node_simulation "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/simulation/failure.py"
click node_ledger "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/provenance/ledger.py"
click node_api "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/main.py"
click node_webapp "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/App.jsx"
click node_querybox "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/components/QueryBox.jsx"
click node_livepage "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/pages/LiveGraphPage.jsx"
click node_graphview "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/components/GraphView.jsx"
click node_ingestviz "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/components/IngestionPipelineViz.jsx"
click node_failurepanel "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/components/FailureSimPanel.jsx"
click node_conflicts "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/graph/queries.py"
click node_temporal "https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/graph/queries.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_parser,node_ocr,node_chunker,node_watcher,node_user toneBlue
class node_workflow,node_extractor,node_ollama,node_resolver,node_embeddings,node_graphstore toneAmber
class node_queries,node_chunkstore,node_graphrag,node_simulation,node_ledger,node_conflicts,node_temporal toneMint
class node_api,node_webapp,node_querybox,node_livepage,node_graphview,node_ingestviz,node_failurepanel toneRose
class node_documents toneIndigo
```

## Components

### Ingestion

- [Document parser](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/ingestion/parsers.py): `backend/ingestion/parsers.py`
- [Image OCR](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/ingestion/ocr.py): `backend/ingestion/ocr.py`
- [Text chunker](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/ingestion/chunker.py): `backend/ingestion/chunker.py`
- [Directory watcher](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/ingestion/watcher.py): `backend/ingestion/watcher.py`

### Knowledge construction

- [Ingestion workflow](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/workflow/pipeline.py): `backend/workflow/pipeline.py`
- [Triple extractor](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/llm/extractor.py): `backend/llm/extractor.py`
- **Local LLM**
- [Entity resolver](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/resolution/resolver.py): `backend/resolution/resolver.py`
- [Entity embeddings](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/resolution/embeddings.py): `backend/resolution/embeddings.py`
- [Neo4j graph](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/graph/neo4j_client.py): `backend/graph/neo4j_client.py`

### Graph analysis

- [Graph queries](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/graph/queries.py): `backend/graph/queries.py`
- [Chunk and summary store](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/rag/chunk_store.py): `backend/rag/chunk_store.py`
- [GraphRAG answers](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/rag/graphrag.py): `backend/rag/graphrag.py`
- [Failure simulation](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/simulation/failure.py): `backend/simulation/failure.py`
- [Fact provenance ledger](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/provenance/ledger.py): `backend/provenance/ledger.py`
- [Conflict detection](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/graph/queries.py): `backend/graph/queries.py`
- [Temporal lineage](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/graph/queries.py): `backend/graph/queries.py`

### API and interface

- [FastAPI service](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/backend/main.py): `backend/main.py`
- [React application](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Question interface](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/components/QueryBox.jsx): `frontend/src/components/QueryBox.jsx`
- [Live graph page](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/pages/LiveGraphPage.jsx): `frontend/src/pages/LiveGraphPage.jsx`
- [Graph visualization](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/components/GraphView.jsx): `frontend/src/components/GraphView.jsx`
- [Ingestion progress](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/components/IngestionPipelineViz.jsx): `frontend/src/components/IngestionPipelineViz.jsx`
- [Failure panel](https://github.com/shaik-nowshinfarhana/federated_knowledge_graph/blob/main/frontend/src/components/FailureSimPanel.jsx): `frontend/src/components/FailureSimPanel.jsx`

### Other components

- **User**
- **Source documents**

## Connections

- User → Source documents: provides (evidence: `README.md`)
- Source documents → Document parser: parsed by (evidence: `backend/ingestion/parsers.py`)
- Document parser → Image OCR: dispatches images (evidence: `backend/ingestion/parsers.py`)
- Document parser → Text chunker: produces text (evidence: `README.md`)
- Directory watcher → Ingestion workflow: starts ingestion
- Text chunker → Ingestion workflow: provides chunks (evidence: `backend/workflow/pipeline.py`)
- Ingestion workflow → Triple extractor: invokes extraction (evidence: `backend/workflow/pipeline.py`)
- Triple extractor → Local LLM: requests extraction
- Ingestion workflow → Neo4j graph: persists facts (evidence: `README.md`)
- Ingestion workflow → Chunk and summary store: stores chunks (evidence: `backend/workflow/pipeline.py`)
- Ingestion workflow → Fact provenance ledger: records provenance (evidence: `README.md`)
- Ingestion workflow → Entity resolver: runs resolution (evidence: `backend/workflow/pipeline.py`)
- Entity resolver → Entity embeddings: uses embeddings (evidence: `backend/resolution/resolver.py`)
- Entity embeddings → Local LLM: requests vectors (evidence: `backend/resolution/embeddings.py`)
- Entity resolver → Neo4j graph: merges entities (evidence: `backend/resolution/resolver.py`)
- FastAPI service → Ingestion workflow: starts jobs (evidence: `backend/main.py`)
- FastAPI service → GraphRAG answers: answers questions (evidence: `backend/main.py`)
- GraphRAG answers → Graph queries: retrieves graph facts (evidence: `backend/rag/graphrag.py`)
- GraphRAG answers → Chunk and summary store: searches excerpts (evidence: `backend/rag/graphrag.py`)
- GraphRAG answers → Local LLM: generates answers (evidence: `backend/rag/graphrag.py`)
- Graph queries → Neo4j graph: runs Cypher (evidence: `backend/graph/queries.py`)
- FastAPI service → Failure simulation: simulates failures (evidence: `backend/main.py`)
- FastAPI service → Conflict detection: serves conflicts (evidence: `README.md`)
- FastAPI service → Temporal lineage: serves temporal graph (evidence: `README.md`)
- FastAPI service → Neo4j graph: serves graph data (evidence: `backend/main.py`)
- User → React application: uses (evidence: `README.md`)
- React application → Live graph page: renders (evidence: `frontend/src/App.jsx`)
- Live graph page → Question interface: renders (evidence: `frontend/src/pages/LiveGraphPage.jsx`)
- Live graph page → Graph visualization: renders (evidence: `frontend/src/pages/LiveGraphPage.jsx`)
- React application → FastAPI service: starts ingestion (evidence: `frontend/src/App.jsx`)
- Question interface → FastAPI service: asks questions (evidence: `frontend/src/components/QueryBox.jsx`)
- Live graph page → Failure panel: renders (evidence: `frontend/src/pages/LiveGraphPage.jsx`)
- Ingestion progress → FastAPI service: polls job status (evidence: `frontend/src/components/IngestionPipelineViz.jsx`)
