# nnd-dev/aicourse-group7 architecture

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

- Interactive diagram: https://gitdiagram.com/nnd-dev/aicourse-group7
- Repository: https://github.com/nnd-dev/aicourse-group7

## Overview

##### Project type and purpose
- From the README (“AI Travel Planner”) and file tree, this is a Python-based CLI application that guides the user through planning a trip by chatting with an AI, checking weather, suggesting destinations, and building an itinerary. It is not a web or microservices system, but a single‐process CLI tool that orchestrates interactions with an external AI/HTTP API.

##### File structure
- Top-level files:
- main.py – application entrypoint
- requirements.txt – dependencies
- README.md – documentation
- src/
- src/presentation/cli/ai_travel_cli.py – CLI module implementing user prompts and menu
- No explicit “domain” or “data” directories—business logic and API calls are likely embedded in the CLI or imported by it.

##### README for additional insights
- Dependencies: openai, httpx, colorama
- Runtime flow:
1. User runs python main.py
2. CLI prompts for API key
3. “Start Planning” menu => interactive chat
4. Behind the scenes, HTTP requests to the AI portal, weather calls, itinerary assembly.

a. Main components:
- User (Terminal)
- CLI Layer (ai_travel_cli.py + main.py)
- Application Logic/Service Layer (modules or functions that handle chat state, preference extraction, weather lookup, itinerary generation)
- External AI API (openai or custom endpoint)
- External Weather Service (if separate)
- Configuration store (local env or config file for API key)
b. Relationships & data flow:
- User → CLI Layer: keyboard input
- CLI Layer → Service Layer: method calls with user messages
- Service Layer → External AI API (via httpx/openai client) → returns AI response
- Service Layer → External Weather Service (optional) → returns weather data
- Service Layer → CLI Layer: formatted response strings
- CLI Layer → User: console output (with colorama styling)
c. Architectural patterns/principles:
- Layered/Onion or Hexagonal architecture: the CLI is an adapter, business logic is core, external services are ports
- Single responsibility: each module handles one aspect (presentation vs. API integration)
d. Key technologies/frameworks:
- Python 3.8+
- openai SDK for chat
- httpx for HTTP requests
- colorama for terminal UI

##### Detailed, essential elements
- Do not clutter with trivial file names; instead, focus on logical modules
- Sequence: user input → CLI → business logic → external API → response → CLI → user
- Configuration retrieval (API key) as a separate step or component

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Entry["Application Entry Point"]:::cli
        CLI["CLI Adapter"]:::cli
        RootPkg["Python Package Root"]:::cli
        PkgInit["Presentation Package Initialization"]:::cli
        Deps["Project Dependencies Configuration"]:::doc
        Docs["Project Documentation"]:::doc
    end

    %% Core Logic
    subgraph "Service Core"
        Config["Configuration Loader"]:::core
        Itinerary["Itinerary Generator"]:::core
        AIClient["AI Service Client"]:::core
        WeatherClient["Weather Client"]:::core
    end

    %% External Services
    subgraph "External Services"
        OpenAI["OpenAI Chat API"]:::external
        WeatherAPI["Weather Service"]:::external
    end

    %% Data Flow
    User["User (Terminal)"]:::external
    User --> CLI
    Entry --> CLI
    Entry --> Deps
    Entry --> Docs

    CLI --> Config
    CLI --> Itinerary
    Config --> AIClient
    Config --> WeatherClient

    Itinerary --> AIClient
    AIClient -->|HTTP/REST| OpenAI
    Itinerary --> WeatherClient
    WeatherClient -->|HTTP/REST| WeatherAPI

    AIClient --> Itinerary
    WeatherClient --> Itinerary
    Itinerary --> CLI
    CLI --> User

    %% Click events
    click CLI "https://github.com/nnd-dev/aicourse-group7/blob/master/src/presentation/cli/ai_travel_cli.py"
    click Entry "https://github.com/nnd-dev/aicourse-group7/blob/master/main.py"
    click Deps "https://github.com/nnd-dev/aicourse-group7/blob/master/requirements.txt"
    click Docs "https://github.com/nnd-dev/aicourse-group7/blob/master/README.md"
    click RootPkg "https://github.com/nnd-dev/aicourse-group7/blob/master/src/__init__.py"
    click PkgInit "https://github.com/nnd-dev/aicourse-group7/blob/master/src/presentation/cli/__init__.py"

    %% Styles
    classDef cli fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef core fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
    classDef doc fill:#D3D3D3,stroke:#000,stroke-width:1px
```
