# invitha123/real_estate_chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/invitha123/real_estate_chatbot
- Repository: https://github.com/invitha123/real_estate_chatbot

## Overview

#### Purpose and principal workflow
GrowEasy AI Agent simulates a real-estate lead-qualification conversation. The documented entry point is a person running `node src/index.js` in a terminal: the CLI asks configured questions, records answers, classifies the lead, and saves the result. The repository also contains a modular chat/extraction/classification implementation, but the sampled orchestrator references module paths that are not present in the tree.

#### Components

##### CLI qualification workflow
- **Interactive CLI runner** — `src/index.js`: Reads questions and rules from the real-estate configuration, prompts the terminal user, collects answers, classifies the lead, and writes the result.
- **Lead and conversation records** — `chats/Rohit_Sharma_chat.json`: A saved chat/lead record; the README documents chat output under `chats/`.
- **Classification result records** — `metadata/lead_Rohit_Sharma.json`: A saved lead-metadata result; the tree identifies this as optional metadata storage.

##### Qualification configuration
- **Real-estate rules and prompts** — `config/real_estate.json`: Holds the questions and classification rules used by the CLI; the README documents these as configurable business rules.

##### Modular chat and qualification implementation
- **Modular workflow coordinator** — `config/index.js`: Defines a sample lead, invokes chat simulation, metadata extraction, and classification, then writes transcript and result files; its imported `./agent`, `./classifier`, and `./extractor` paths do not match the listed `src/` modules.
- **Prompt-driven chat simulator** — `src/agent.js`: Runs configured prompts through a synchronous terminal input interface and returns a transcript.
- **Transcript metadata extractor** — `src/extractor.js`: Scans user messages for fixed real-estate cues and returns location, property type, purpose, budget, and timeline fields.
- **Rule-based classifier** — `src/classifier.js`: Returns Cold when budget or timeline is missing, and Hot when the parsed timeline is at most three months and purpose matches the configured hot intent.

##### External participants
- **Terminal user** — null: Supplies answers during the interactive qualification session.
- **CLI runtime** — null: Runs the documented Node.js command and provides standard input/output.

#### Relationships
- Terminal user -> CLI runtime: invokes the documented command `node src/index.js`; evidence: `README.md`.
- CLI runtime -> Interactive CLI runner: executes the documented entry point; evidence: `README.md`.
- Interactive CLI runner -> Real-estate rules and prompts: reads the JSON configuration; evidence: `src/index.js`.
- Interactive CLI runner -> Terminal user: presents prompts and receives answers through readline; evidence: `src/index.js`.
- Interactive CLI runner -> Lead and conversation records: writes the classified lead and collected metadata as JSON; evidence: `src/index.js`.
- Modular workflow coordinator -> Prompt-driven chat simulator: attempts to call `simulateChat`; evidence: `config/index.js` (the referenced `./agent` module is absent from the tree, so this connection is not established to `src/agent.js`).
- Modular workflow coordinator -> Transcript metadata extractor: attempts to call `extractMetadata`; evidence: `config/index.js` (the referenced `./extractor` module is absent from the tree).
- Modular workflow coordinator -> Rule-based classifier: attempts to call `classifyLead`; evidence: `config/index.js` (the referenced `./classifier` module is absent from the tree).
- Prompt-driven chat simulator -> Terminal user: asks configured questions and reads answers; evidence: `src/agent.js`.
- Transcript metadata extractor -> Rule-based classifier: no supported relationship; the modular coordinator attempts to pass extracted metadata onward, but its imports do not resolve to the listed `src/` modules.
- Modular workflow coordinator -> Real-estate rules and prompts: loads the configuration; evidence: `config/index.js`.
- Modular workflow coordinator -> Lead and conversation records: writes a transcript under `chats/`; evidence: `config/index.js`.
- Modular workflow coordinator -> Classification result records: writes classification and metadata under `metadata/`; evidence: `config/index.js`.

#### Coverage limits
The configuration file contents and saved JSON contents were not sampled. The modular coordinator’s imports point to files absent from the tree, so its runtime wiring to the listed `src/` modules cannot be established; the CLI runner contains its own classification logic rather than calling the sampled classifier module.

Main entry points: [`src/index.js`](https://github.com/invitha123/real_estate_chatbot/blob/main/src/index.js) (CLI Qualifier), [`config/index.js`](https://github.com/invitha123/real_estate_chatbot/blob/main/config/index.js) (Workflow Coordinator), [`config/real_estate.json`](https://github.com/invitha123/real_estate_chatbot/blob/main/config/real_estate.json) (Real-Estate Rules), [`chats/Rohit_Sharma_chat.json`](https://github.com/invitha123/real_estate_chatbot/blob/main/chats/Rohit_Sharma_chat.json) (Lead and Chat Records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI Workflow"]
  node_cli_runner["CLI Qualifier<br/>entry point"]
end

subgraph group_configuration["Qualification Configuration"]
  node_rules["Real-Estate Rules<br/>configuration"]
end

subgraph group_modular["Modular Qualification"]
  node_coordinator["Workflow Coordinator<br/>orchestrator"]
  node_chat_simulator["Chat Simulator<br/>[agent.js]"]
  node_extractor["Metadata Extractor<br/>[extractor.js]"]
  node_classifier["Lead Classifier<br/>[classifier.js]"]
end

subgraph group_records["Saved Records"]
  node_chat_records["Lead and Chat Records<br/>saved records"]
  node_result_records["Classification Records<br/>saved records"]
end

node_terminal_user(("Terminal User<br/>person"))
node_cli_runtime["CLI Runtime"]

node_terminal_user -->|"runs command"| node_cli_runtime
node_cli_runtime -->|"executes"| node_cli_runner
node_cli_runner -->|"reads"| node_rules
node_cli_runner -->|"prompts"| node_terminal_user
node_cli_runner -->|"writes"| node_chat_records
node_coordinator -->|"loads"| node_rules
node_coordinator -->|"writes transcript"| node_chat_records
node_coordinator -->|"writes results"| node_result_records
node_chat_simulator -->|"asks questions"| node_terminal_user

click node_cli_runner "https://github.com/invitha123/real_estate_chatbot/blob/main/src/index.js"
click node_rules "https://github.com/invitha123/real_estate_chatbot/blob/main/config/real_estate.json"
click node_coordinator "https://github.com/invitha123/real_estate_chatbot/blob/main/config/index.js"
click node_chat_simulator "https://github.com/invitha123/real_estate_chatbot/blob/main/src/agent.js"
click node_extractor "https://github.com/invitha123/real_estate_chatbot/blob/main/src/extractor.js"
click node_classifier "https://github.com/invitha123/real_estate_chatbot/blob/main/src/classifier.js"
click node_chat_records "https://github.com/invitha123/real_estate_chatbot/blob/main/chats/Rohit_Sharma_chat.json"
click node_result_records "https://github.com/invitha123/real_estate_chatbot/blob/main/metadata/lead_Rohit_Sharma.json"

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_cli_runner,node_terminal_user toneBlue
class node_rules toneAmber
class node_coordinator,node_chat_simulator,node_extractor,node_classifier toneMint
class node_chat_records,node_result_records toneRose
class node_cli_runtime toneIndigo
```

## Components

### CLI Workflow

- [CLI Qualifier](https://github.com/invitha123/real_estate_chatbot/blob/main/src/index.js): entry point · `src/index.js`

### Qualification Configuration

- [Real-Estate Rules](https://github.com/invitha123/real_estate_chatbot/blob/main/config/real_estate.json): configuration · `config/real_estate.json`

### Modular Qualification

- [Workflow Coordinator](https://github.com/invitha123/real_estate_chatbot/blob/main/config/index.js): orchestrator · References module paths that do not match the listed src modules. · `config/index.js`
- [Chat Simulator](https://github.com/invitha123/real_estate_chatbot/blob/main/src/agent.js): chat · `src/agent.js`
- [Metadata Extractor](https://github.com/invitha123/real_estate_chatbot/blob/main/src/extractor.js): extractor · `src/extractor.js`
- [Lead Classifier](https://github.com/invitha123/real_estate_chatbot/blob/main/src/classifier.js): classifier · `src/classifier.js`

### Saved Records

- [Lead and Chat Records](https://github.com/invitha123/real_estate_chatbot/blob/main/chats/Rohit_Sharma_chat.json): saved records · `chats/Rohit_Sharma_chat.json`
- [Classification Records](https://github.com/invitha123/real_estate_chatbot/blob/main/metadata/lead_Rohit_Sharma.json): saved records · Optional metadata storage. · `metadata/lead_Rohit_Sharma.json`

### Other components

- **Terminal User**: person
- **CLI Runtime**: runtime

## Connections

- Terminal User → CLI Runtime: runs command (evidence: `README.md`)
- CLI Runtime → CLI Qualifier: executes (evidence: `README.md`)
- CLI Qualifier → Real-Estate Rules: reads (evidence: `src/index.js`)
- CLI Qualifier → Terminal User: prompts · Presents questions and receives answers through readline. (evidence: `src/index.js`)
- CLI Qualifier → Lead and Chat Records: writes · Saves the classified lead and collected metadata as JSON. (evidence: `src/index.js`)
- Workflow Coordinator → Real-Estate Rules: loads (evidence: `config/index.js`)
- Workflow Coordinator → Lead and Chat Records: writes transcript (evidence: `config/index.js`)
- Workflow Coordinator → Classification Records: writes results · Writes classification and metadata. (evidence: `config/index.js`)
- Chat Simulator → Terminal User: asks questions · Reads answers through terminal input. (evidence: `src/agent.js`)
