# anushka3031/hotel_booking_chatboat architecture

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

- Interactive diagram: https://gitdiagram.com/anushka3031/hotel_booking_chatboat
- Repository: https://github.com/anushka3031/hotel_booking_chatboat

## Overview

##### Project type and purpose
- This is a specialized chatbot application built around an LSTM model for hotel booking.
- Its main purpose is to gather user information (name, number of people, room type, etc.), save booking details, generate and return a booking ID, and support cancellation by ID.

##### File structure
Top-level files and directories:
- Assingment_1.docx – project description (not part of runtime)
- Chatboat.ipynb – interactive prototype of the chatbot logic
- Fchat_model/ – serialized TensorFlow LSTM model (saved_model.pb, fingerprint, variables, metadata)
- intents.json – dialogue intents and sample utterances
- tokenizer1.pickle, label_encoder1.pickle – preprocessing artifacts for text → token indices and label encoding
- Result.mp4 – demo recording (not part of runtime)
- README.md – high-level project overview

Observations:
- There is no explicit “frontend” folder; interaction likely occurs through a Python script or notebook (could be extended via a REST API).
- Persistence layer is implied by “Save details” but no database driver or config file is present; you may choose SQLite or another datastore.

##### README for additional insights
- Describes features: gather booking info, save it, generate a Booking_ID, enable cancellation.

a. Main components
1. User Interface (UI)
– CLI, Jupyter notebook or Web UI (Flask/Streamlit) where user enters booking details.
2. Chatbot Service
– “Controller” layer that accepts user input, orchestrates preprocessing, model inference, and booking logic.
3. NLP Pipeline
– Tokenizer (tokenizer1.pickle)
– Label Encoder (label_encoder1.pickle)
– LSTM Model (Fchat_model/saved_model.pb)
– intents.json lookup for response templates
4. Dialogue Manager / Booking Manager
– Business logic to parse model output, collect parameters (name, people count, dates, room type).
– Generates unique Booking_ID, stores/cancels records.
5. Persistence Layer
– Database or file-based storage for booking records.
6. Model Artifacts Storage
– Filesystem location for the TensorFlow saved model and pickled preprocessing objects.

b. Relationships and interactions
- UI → Chatbot Service: user sends text message
- Chatbot Service → NLP Pipeline: preprocess & run inference
- NLP Pipeline → Chatbot Service: returns intent + entities
- Chatbot Service → Dialogue Manager: apply business rules (create or cancel booking)
- Dialogue Manager → Persistence Layer: write/read booking records
- Dialogue Manager → Chatbot Service: returns confirmation or error message
- Chatbot Service → UI: display the response

c. Architectural patterns / design principles
– Modular separation: keep NLP pipeline, business logic, and storage separate
– Stateless service layer: each request carries all needed context (or use session tokens)
– Single responsibility: one module for inference, one for booking logic
– Easily replaceable model artifacts: model folder can be swapped without changing code

d. Key technologies and frameworks
– Python 3.x
– TensorFlow SavedModel (LSTM)
– Pickle for tokenizer and label encoder
– JSON for intents definitions
– Optional web framework (Flask/FastAPI/Streamlit) for a UI
– SQLite or other RDBMS / file storage for bookings

##### Essential details to capture
– Exact artifact locations (Fchat_model folder, pickles, JSON)
– Data flows: tokenization → inference → intent→ booking
– Booking lifecycle: create/read/delete

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph "User Interface"
    UI["Chatboat.ipynb"]:::ui
  end

  subgraph "Chatbot Service"
    CS["Chatbot Service\nController"]:::processing
  end

  subgraph "NLP Pipeline"
    Tok["tokenizer1.pickle"]:::processing
    Label["label_encoder1.pickle"]:::processing
    Intents["intents.json"]:::processing

    subgraph "Model Artifacts Storage"
      Dir["Fchat_model/"]:::storage
      SM["saved_model.pb"]:::storage
      VD["variables.data-00000-of-00001"]:::storage
      VI["variables.index"]:::storage
      KM["keras_metadata.pb"]:::storage
      FP["fingerprint.pb"]:::storage
    end
  end

  subgraph "Dialogue Manager"
    DM["Booking Logic"]:::processing
  end

  DB["Booking Database\n(SQLite)"]:::storage

  subgraph "Documentation (non-runtime)"
    RD["README.md"]:::doc
    AD["Assingment_1.docx"]:::doc
    RM["Result.mp4"]:::doc
  end

  UI --> CS
  CS -->|"preprocess & inference"| Tok
  CS -->|"preprocess & inference"| Label
  CS -->|"preprocess & inference"| Intents
  CS -->|"model inference"| SM

  Tok -->|"tokens"| CS
  Label -->|"labels"| CS
  Intents -->|"intent lookup"| CS
  SM -->|"prediction"| CS

  Dir --> SM
  Dir --> VD
  Dir --> VI
  Dir --> KM
  Dir --> FP

  CS --> DM
  DM -->|"write/read"| DB
  DM --> CS
  CS --> UI

  click UI "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/Chatboat.ipynb"
  click Tok "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/tokenizer1.pickle"
  click Label "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/label_encoder1.pickle"
  click Intents "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/intents.json"
  click SM "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/Fchat_model/saved_model.pb"
  click VD "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/Fchat_model/variables/variables.data-00000-of-00001"
  click VI "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/Fchat_model/variables/variables.index"
  click KM "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/Fchat_model/keras_metadata.pb"
  click FP "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/Fchat_model/fingerprint.pb"
  click Dir "https://github.com/anushka3031/hotel_booking_chatboat/tree/master/Fchat_model/"
  click RD "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/README.md"
  click AD "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/Assingment_1.docx"
  click RM "https://github.com/anushka3031/hotel_booking_chatboat/blob/master/Result.mp4"

  classDef ui fill:#D6E9FF,stroke:#333,stroke-width:1px
  classDef processing fill:#D6F5D6,stroke:#333,stroke-width:1px
  classDef storage fill:#FFE5B4,stroke:#333,stroke-width:1px
  classDef doc fill:#F0F0F0,stroke:#333,stroke-width:1px
```
