# ashwinjo/ixinventorymanagement architecture

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

- Interactive diagram: https://gitdiagram.com/ashwinjo/ixinventorymanagement
- Repository: https://github.com/ashwinjo/ixinventorymanagement

## Overview

##### Main Components
- User Browser (UI client)
- Docker Host / Container
- Flask Application (myapp.py + app/ package)
– Controllers (routes in myapp.py and app/__init__.py)
– Views / Templates (app/templates/*.html)
– Static Assets (app/static/css, js, img)
- Background Data Poller (data_poller.py)
- Database Layer
– SQLite (init_db.py, sqlite3_utilities.py, db_queries.py)
- External Services (IxOS REST APIs)
– chassis swagger endpoints (chassis, platform)
- Utility Modules
– RestApi/IxOSRestInterface.py for wrapping external calls
– IxOSRestCallerModifier.py for request customization

##### Relationships & Data Flows
- Browser → HTTP Requests → Flask App
– GET/POST routes render templates or return JSON
- Flask App → Local SQLite
– Reads from / writes to DB via db_queries.py
- Flask App → RestApi Module
– On‑demand calls to IxOS REST via IxOSRestInterface
- Data Poller (scheduled or on‑demand) → RestApi Module → SQLite
– Periodic polling imports chassis/card/port/license data
- Shell Script (runApplication.sh) → Docker Entry
– Boots the Flask server inside container

##### Architectural Patterns
- MVC‑like separation
– Models: SQLite + db_queries layer
– Views: Jinja2 templates under app/templates
– Controllers: Flask routes in myapp.py
- Repository / Adapter pattern
– IxOSRestInterface abstracts external API details
– sqlite3_utilities abstracts direct SQL calls
- Containerization
– Single Dockerfile mounts code, exposes port 3000
- Background Worker vs Web Worker separation
– data_poller runs asynchronously vs request‑driven Flask

##### Technologies & Frameworks
- Python 3.x, Flask
- Jinja2 templating, JavaScript/CSS static assets
- SQLite database
- Docker container (Dockerfile, runApplication.sh)

##### Detail‑Capture Checklist
- User flows: login (if any), data‑view, CSV download
- Background flows: periodic data refresh, log collection
- Docker start process: runApplication.sh invokes Flask
- Configuration: RestApi/requirements.txt, root requirements.txt

- Clearly separates UI, application logic, data store, background jobs, and external services
- Shows how data moves through the system synchronously and asynchronously
- Highlights key design patterns and technologies

## Diagram (Mermaid)

```mermaid
flowchart TD
  Browser["User Browser"]:::external

  subgraph "Docker Container" 
    direction TB
    DockerfileNode["Dockerfile"]:::internal
    DockerEntry["runApplication.sh"]:::internal

    subgraph "UI Layer"
      direction TB
      Templates["Templates (Jinja2)"]:::internal
      StaticCSS["CSS"]:::internal
      StaticJS["JavaScript"]:::internal
      StaticImg["Images"]:::internal
    end

    subgraph "API Layer"
      direction TB
      myapp["myapp.py (Controllers)"]:::internal
      AppInit["app/__init__.py"]:::internal
      RestMod["IxOSRestInterface"]:::internal
      Modifier["IxOSRestCallerModifier"]:::internal
    end

    subgraph "Background Worker"
      direction TB
      Poller["data_poller.py"]:::internal
    end

    subgraph "Database Layer"
      direction TB
      InitDB["init_db.py"]:::internal
      SQLUtil["sqlite3_utilities.py"]:::internal
      DBQueries["db_queries.py"]:::internal
      SQLite["SQLite DB"]:::datastore
    end

    RequirementsRoot["requirements.txt"]:::internal
    RequirementsRest["RestApi/requirements.txt"]:::internal
  end

  IxOS["IxOS REST Service"]:::external

  Browser -->|"HTTP (GET/POST)"| myapp
  myapp -->|"renders UI"| Templates
  myapp -->|"serves static"| StaticCSS
  myapp --> StaticJS
  myapp --> StaticImg
  myapp -->|"SQL"| DBQueries
  myapp -->|"calls"| RestMod
  RestMod -->|"HTTP" | IxOS
  Modifier --> RestMod
  Poller -.->|"scheduled HTTP"| RestMod
  Poller -.->|"writes SQL"| DBQueries
  DBQueries --> SQLUtil
  DBQueries --> SQLite
  InitDB --> SQLUtil
  DockerEntry --> myapp
  DockerEntry --> Poller
  DockerfileNode --> DockerEntry

  click Templates "https://github.com/ashwinjo/ixinventorymanagement/tree/main/app/templates/"
  click StaticCSS "https://github.com/ashwinjo/ixinventorymanagement/blob/main/app/static/css/styles.css"
  click StaticJS "https://github.com/ashwinjo/ixinventorymanagement/blob/main/app/static/js/scripts.js"
  click StaticImg "https://github.com/ashwinjo/ixinventorymanagement/tree/main/app/static/assets/img/"
  click myapp "https://github.com/ashwinjo/ixinventorymanagement/blob/main/myapp.py"
  click AppInit "https://github.com/ashwinjo/ixinventorymanagement/blob/main/app/__init__.py"
  click Poller "https://github.com/ashwinjo/ixinventorymanagement/blob/main/data_poller.py"
  click InitDB "https://github.com/ashwinjo/ixinventorymanagement/blob/main/init_db.py"
  click SQLUtil "https://github.com/ashwinjo/ixinventorymanagement/blob/main/sqlite3_utilities.py"
  click DBQueries "https://github.com/ashwinjo/ixinventorymanagement/blob/main/db_queries.py"
  click RestMod "https://github.com/ashwinjo/ixinventorymanagement/blob/main/RestApi/IxOSRestInterface.py"
  click AppModuleInit "https://github.com/ashwinjo/ixinventorymanagement/blob/main/RestApi/__init__.py"
  click Modifier "https://github.com/ashwinjo/ixinventorymanagement/blob/main/IxOSRestCallerModifier.py"
  click DockerfileNode "https://github.com/ashwinjo/ixinventorymanagement/tree/main/Dockerfile"
  click DockerEntry "https://github.com/ashwinjo/ixinventorymanagement/blob/main/runApplication.sh"
  click RequirementsRoot "https://github.com/ashwinjo/ixinventorymanagement/blob/main/requirements.txt"
  click RequirementsRest "https://github.com/ashwinjo/ixinventorymanagement/blob/main/RestApi/requirements.txt"

  classDef internal fill:#9cf,stroke:#036;
  classDef external fill:#f96,stroke:#933;
  classDef datastore fill:#7f7,stroke:#070;
  classDef container fill:#eee,stroke:#999;
  class DockerfileNode,DockerEntry,Templates,StaticCSS,StaticJS,StaticImg,myapp,AppInit,RestMod,Modifier,Poller,InitDB,SQLUtil,DBQueries,RequirementsRoot,RequirementsRest internal
  class SQLite datastore
  class Browser,IxOS external
```
