# kaja-avinash/narrativenexus architecture

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

- Interactive diagram: https://gitdiagram.com/kaja-avinash/narrativenexus
- Repository: https://github.com/kaja-avinash/narrativenexus

## Overview

NarrativeNexus AI is a Streamlit document-intelligence application. Users provide documents, which the app extracts and prepares for analysis; analysis capabilities produce summaries, sentiment, topics, entities, similarity, search results, and visualizations, with reports available for export. Session state supports the dashboard and history. The README documents these capabilities, but the sampled app excerpt shows only parts of the workflow, so unshown orchestration links are dashed and unverified.

Main entry points: [`app.py`](https://github.com/kaja-avinash/narrativenexus/blob/main/app.py) (Streamlit App), [`utils/models.py`](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/models.py) (Model Loading), [`utils/config.py`](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/config.py) (Configuration), [`utils/file_utils.py`](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/file_utils.py) (File Extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Application"]
  node_app["Streamlit App<br/>[app.py]"]
  node_session["Session State<br/>[state.py]"]
end

subgraph group_ingestion["Document Preparation"]
  node_file_processing["File Extraction<br/>[file_utils.py]"]
  node_preprocessing["Text Preprocessing<br/>[preprocessing.py]"]
  node_language["Language Detection<br/>[language.py]"]
  node_translation["Translation<br/>[translate.py]"]
end

subgraph group_analysis["AI Analysis"]
  node_summarizer["Summarization<br/>[summarizer.py]"]
  node_sentiment["Sentiment Analysis<br/>[sentiment.py]"]
  node_topics["Topic Modeling<br/>[topic_modeling.py]"]
  node_ner["Entity Recognition<br/>[ner.py]"]
  node_knowledge_graph["Knowledge Graph<br/>[graph.py]"]
  node_semantic_search["Semantic Search<br/>[semantic_search.py]"]
  node_similarity["Document Similarity<br/>[cosine_sim.py]"]
end

subgraph group_presentation["Results and Export"]
  node_visualization["Visualizations<br/>[visualization.py]"]
  node_reports["Report Export<br/>[report.py]"]
end

subgraph group_runtime["Shared Runtime"]
  node_models["Model Loading<br/>[models.py]"]
  node_config["Configuration<br/>[config.py]"]
end

node_user(("Document User"))

node_user -->|"uses"| node_app
node_app -.->|"processes uploads"| node_file_processing
node_app -.->|"prepares text"| node_preprocessing
node_app -.->|"detects language"| node_language
node_app -.->|"translates text"| node_translation
node_app -.->|"requests summaries"| node_summarizer
node_app -.->|"requests sentiment"| node_sentiment
node_app -.->|"requests topics"| node_topics
node_app -->|"extracts entities"| node_ner
node_app -.->|"builds graph"| node_knowledge_graph
node_app -->|"builds search index"| node_semantic_search
node_app -.->|"compares documents"| node_similarity
node_app -.->|"renders results"| node_visualization
node_app -.->|"exports reports"| node_reports
node_app -.->|"tracks session"| node_session
node_summarizer -->|"loads model"| node_models
node_sentiment -->|"loads model"| node_models
node_ner -->|"loads model"| node_models
node_knowledge_graph -->|"loads model"| node_models
node_semantic_search -->|"loads model"| node_models
node_file_processing -->|"uses limits"| node_config
node_models -->|"reads model settings"| node_config
node_reports -->|"reads app identity"| node_config

click node_app "https://github.com/kaja-avinash/narrativenexus/blob/main/app.py"
click node_session "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/state.py"
click node_file_processing "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/file_utils.py"
click node_preprocessing "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/preprocessing.py"
click node_language "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/language.py"
click node_translation "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/translate.py"
click node_summarizer "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/summarizer.py"
click node_sentiment "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/sentiment.py"
click node_topics "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/topic_modeling.py"
click node_ner "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/ner.py"
click node_knowledge_graph "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/graph.py"
click node_semantic_search "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/semantic_search.py"
click node_similarity "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/cosine_sim.py"
click node_visualization "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/visualization.py"
click node_reports "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/report.py"
click node_models "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/models.py"
click node_config "https://github.com/kaja-avinash/narrativenexus/blob/main/utils/config.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_app,node_session,node_user toneBlue
class node_file_processing,node_preprocessing,node_language,node_translation toneAmber
class node_summarizer,node_sentiment,node_topics,node_ner,node_knowledge_graph,node_semantic_search,node_similarity toneMint
class node_visualization,node_reports toneRose
class node_models,node_config toneIndigo
```

## Components

### Application

- [Streamlit App](https://github.com/kaja-avinash/narrativenexus/blob/main/app.py): `app.py`
- [Session State](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/state.py): `utils/state.py`

### Document Preparation

- [File Extraction](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/file_utils.py): `utils/file_utils.py`
- [Text Preprocessing](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/preprocessing.py): `utils/preprocessing.py`
- [Language Detection](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/language.py): `utils/language.py`
- [Translation](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/translate.py): `utils/translate.py`

### AI Analysis

- [Summarization](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/summarizer.py): `utils/summarizer.py`
- [Sentiment Analysis](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/sentiment.py): `utils/sentiment.py`
- [Topic Modeling](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/topic_modeling.py): `utils/topic_modeling.py`
- [Entity Recognition](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/ner.py): `utils/ner.py`
- [Knowledge Graph](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/graph.py): `utils/graph.py`
- [Semantic Search](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/semantic_search.py): `utils/semantic_search.py`
- [Document Similarity](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/cosine_sim.py): `utils/cosine_sim.py`

### Results and Export

- [Visualizations](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/visualization.py): `utils/visualization.py`
- [Report Export](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/report.py): `utils/report.py`

### Shared Runtime

- [Model Loading](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/models.py): `utils/models.py`
- [Configuration](https://github.com/kaja-avinash/narrativenexus/blob/main/utils/config.py): `utils/config.py`

### Other components

- **Document User**

## Connections

- Document User → Streamlit App: uses (evidence: `README.md`)
- Streamlit App → File Extraction: processes uploads (evidence: `app.py`)
- Streamlit App → Text Preprocessing: prepares text (evidence: `app.py`)
- Streamlit App → Language Detection: detects language (evidence: `app.py`)
- Streamlit App → Translation: translates text (evidence: `app.py`)
- Streamlit App → Summarization: requests summaries (evidence: `app.py`)
- Streamlit App → Sentiment Analysis: requests sentiment (evidence: `app.py`)
- Streamlit App → Topic Modeling: requests topics (evidence: `app.py`)
- Streamlit App → Entity Recognition: extracts entities (evidence: `app.py`)
- Streamlit App → Knowledge Graph: builds graph (evidence: `app.py`)
- Streamlit App → Semantic Search: builds search index (evidence: `app.py`)
- Streamlit App → Document Similarity: compares documents (evidence: `app.py`)
- Streamlit App → Visualizations: renders results (evidence: `app.py`)
- Streamlit App → Report Export: exports reports (evidence: `app.py`)
- Streamlit App → Session State: tracks session (evidence: `app.py`)
- Summarization → Model Loading: loads model (evidence: `utils/summarizer.py`)
- Sentiment Analysis → Model Loading: loads model (evidence: `utils/sentiment.py`)
- Entity Recognition → Model Loading: loads model (evidence: `utils/ner.py`)
- Knowledge Graph → Model Loading: loads model (evidence: `utils/graph.py`)
- Semantic Search → Model Loading: loads model (evidence: `utils/semantic_search.py`)
- File Extraction → Configuration: uses limits (evidence: `utils/file_utils.py`)
- Model Loading → Configuration: reads model settings (evidence: `utils/models.py`)
- Report Export → Configuration: reads app identity (evidence: `utils/report.py`)
