# nicemeet1920-collab/week3_day1 architecture

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

- Interactive diagram: https://gitdiagram.com/nicemeet1920-collab/week3_day1
- Repository: https://github.com/nicemeet1920-collab/week3_day1

## Overview

This is a Tamil government-scheme knowledge-graph chatbot. Its main user workflow sends a question through a Neo4j-backed QA chain and, when the graph answer is missing, searches the web and summarizes results. The separate data workflow loads scheme text, maps relationships with an LLM, and stores triples in Neo4j; entity extraction is an additional standalone step. The tree also includes sample-document generation. The README is empty, and the graph reflects only relationships visible in the supplied source excerpts.

Main entry points: [`app.py`](https://github.com/nicemeet1920-collab/week3_day1/blob/main/app.py) (Chatbot App), [`process_1_loader.py`](https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_1_loader.py) (Document Loader), [`process_3_mapping.py`](https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_3_mapping.py) (Relationship Mapper), [`scraper.py`](https://github.com/nicemeet1920-collab/week3_day1/blob/main/scraper.py) (Sample Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_documents["Scheme Documents"]
  node_scraper["Sample Generator<br/>[scraper.py]"]
  node_penn_doc["Pudhumai Penn Text<br/>[pudhumai_penn.txt]"]
  node_pudhalvan_doc["Tamil Pudhalvan Text"]
end

subgraph group_processing["Knowledge Processing"]
  node_loader["Document Loader"]
  node_extract["Entity Extraction"]
  node_mapping["Relationship Mapper"]
end

subgraph group_storage["Graph Storage"]
  node_storage["Neo4j Writer"]
  node_neo4j[("Neo4j Graph")]
end

subgraph group_chat["Question Answering"]
  node_app["Chatbot App<br/>[app.py]"]
  node_web_search{{"DuckDuckGo Search"}}
end

node_user(("Questioner"))
node_openai{{"OpenAI LLM"}}

node_scraper -->|"writes"| node_penn_doc
node_scraper -->|"writes"| node_pudhalvan_doc
node_loader -->|"reads"| node_penn_doc
node_loader -->|"reads"| node_pudhalvan_doc
node_extract -->|"loads documents"| node_loader
node_extract -->|"extracts entities"| node_openai
node_mapping -->|"loads documents"| node_loader
node_mapping -->|"maps relationships"| node_openai
node_storage -->|"gets triples"| node_mapping
node_storage -->|"writes triples"| node_neo4j
node_user -->|"asks"| node_app
node_app -->|"queries via QA chain"| node_neo4j
node_app -->|"searches on fallback"| node_web_search
node_app -->|"summarizes fallback"| node_openai

click node_scraper "https://github.com/nicemeet1920-collab/week3_day1/blob/main/scraper.py"
click node_penn_doc "https://github.com/nicemeet1920-collab/week3_day1/blob/main/data/pudhumai_penn.txt"
click node_pudhalvan_doc "https://github.com/nicemeet1920-collab/week3_day1/blob/main/data/tamil_pudhalvan.txt"
click node_loader "https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_1_loader.py"
click node_extract "https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_2_extraction.py"
click node_mapping "https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_3_mapping.py"
click node_storage "https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_4_neo4j_storage.py"
click node_app "https://github.com/nicemeet1920-collab/week3_day1/blob/main/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_scraper,node_penn_doc,node_pudhalvan_doc toneBlue
class node_loader,node_extract,node_mapping toneAmber
class node_storage,node_neo4j toneMint
class node_app,node_web_search toneRose
class node_user,node_openai toneIndigo
```

## Components

### Scheme Documents

- [Sample Generator](https://github.com/nicemeet1920-collab/week3_day1/blob/main/scraper.py): `scraper.py`
- [Pudhumai Penn Text](https://github.com/nicemeet1920-collab/week3_day1/blob/main/data/pudhumai_penn.txt): `data/pudhumai_penn.txt`
- [Tamil Pudhalvan Text](https://github.com/nicemeet1920-collab/week3_day1/blob/main/data/tamil_pudhalvan.txt): `data/tamil_pudhalvan.txt`

### Knowledge Processing

- [Document Loader](https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_1_loader.py): `process_1_loader.py`
- [Entity Extraction](https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_2_extraction.py): `process_2_extraction.py`
- [Relationship Mapper](https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_3_mapping.py): `process_3_mapping.py`

### Graph Storage

- [Neo4j Writer](https://github.com/nicemeet1920-collab/week3_day1/blob/main/process_4_neo4j_storage.py): `process_4_neo4j_storage.py`
- **Neo4j Graph**

### Question Answering

- [Chatbot App](https://github.com/nicemeet1920-collab/week3_day1/blob/main/app.py): `app.py`
- **DuckDuckGo Search**

### Other components

- **Questioner**
- **OpenAI LLM**

## Connections

- Sample Generator → Pudhumai Penn Text: writes (evidence: `scraper.py`)
- Sample Generator → Tamil Pudhalvan Text: writes (evidence: `scraper.py`)
- Document Loader → Pudhumai Penn Text: reads (evidence: `process_1_loader.py`)
- Document Loader → Tamil Pudhalvan Text: reads (evidence: `process_1_loader.py`)
- Entity Extraction → Document Loader: loads documents (evidence: `process_2_extraction.py`)
- Entity Extraction → OpenAI LLM: extracts entities (evidence: `process_2_extraction.py`)
- Relationship Mapper → Document Loader: loads documents (evidence: `process_3_mapping.py`)
- Relationship Mapper → OpenAI LLM: maps relationships (evidence: `process_3_mapping.py`)
- Neo4j Writer → Relationship Mapper: gets triples (evidence: `process_4_neo4j_storage.py`)
- Neo4j Writer → Neo4j Graph: writes triples (evidence: `process_4_neo4j_storage.py`)
- Questioner → Chatbot App: asks (evidence: `app.py`)
- Chatbot App → Neo4j Graph: queries via QA chain (evidence: `app.py`)
- Chatbot App → DuckDuckGo Search: searches on fallback (evidence: `app.py`)
- Chatbot App → OpenAI LLM: summarizes fallback (evidence: `app.py`)
