# adhithya7/is601-007 architecture

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

- Interactive diagram: https://gitdiagram.com/adhithya7/is601-007
- Repository: https://github.com/adhithya7/is601-007

## Overview

##### Project Type and Purpose
- The projects are full-stack web applications built in Python with Flask. They include common web application components such as templates for the frontend, views/routes for HTTP endpoints, business logic, and database interaction via SQL scripts.
- The “Project” folder – likely the “Shop Project” – includes modules for authentication (auth), role management (roles), common utility functions, and SQL setups. It contains a clear separation of concerns that suggests an MVC-like pattern (views and templates in different folders, with business logic in auth, roles, and common).
- The “BusinessManagement” project also follows a similar structure with routes (under views), templates for the UI, and database interaction scripts.

##### File Structure for Architectural Clues
- Top-Level Directories and Files:
- .github: Contains workflow definitions (especially for Heroku deploys), indicating continuous deployment integration.
- BusinessManagement: Contains its own Dockerfile, main.py, templates for various pages (company/employee management), SQL folder for database scripts, and a dedicated test folder.
- Project: Holds a Dockerfile, main.py, separate modules for auth and roles (each with models, forms, templates), common utilities, SQL scripts for setting up tables, and test directories.
- Additional directories (flask_sample, M2, MP1_ICM, etc.) seem to be supplementary exercises or demonstration samples.
- Architectural Choices:
- There is a defined separation between modules that handle user-interface rendering (“templates”), the application logic (inside the “views”, “auth”, “roles”, “common”), and database operations (SQL scripts and db/init_db.py files).
- Use of Docker (presence of Dockerfile) and CI/CD configuration (GitHub workflows) indicate a modern deployment pipeline.

a. For the “Shop Project” (Project directory):
- Web Layer (Frontend):
– Templates (found in Project/templates, Project/auth/templates, Project/roles/templates): These render the HTML pages such as login, registration, landing page, item views, cart, order, payment, etc.
- Application Layer (Backend):
– Main entry point (Project/main.py) which initializes the app.
– Authentication Module (Project/auth): Contains auth.py, forms.py, models.py for user management.
– Role Management Module (Project/roles): Manages user roles, permissions, and provides templates for role assignment.
– Common Utilities (Project/common): Provides helper functions used across modules.
– Views (Project/views): Handles additional endpoints like admin panels, items, and static pages.
- Data Layer:
– SQL Scripts (Project/sql): Contains versioned SQL scripts to create and initialize tables (users, roles, items, orders, etc.), along with database access and initialization code (db.py and init_db.py).
- Data flow:
- Docker container (using the provided Dockerfile) that encapsulates the application.

b. For the “BusinessManagement” Project:
- Frontend with templates (add/edit company and employee views, etc.).
- Backend with views modules (company.py, employee.py, admin.py, forms.py, geography.py, index.py).
- Data Layer containing SQL scripts for company and employee tables, along with CSV data handling.
- Testing components (the test directory, containing tests for add, edit, upload, and search operations).
- Simplicity of design but note that the separation of concerns is analogous to the shop project.

c. For the “flask_sample” (and other smaller scripts):
- These can be represented as “Example/Supporting Projects” that follow similar Flask conventions. Their role may be to illustrate base patterns without full business logic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User("Client Browser"):::client

    subgraph "Shop Project"
        subgraph "Web Layer"
            ShopGen("General Templates"):::frontend
            ShopAuth("Auth Templates"):::frontend
            ShopRole("Role Management Templates"):::frontend
        end
        subgraph "Application Layer"
            ShopMain("Main Entrypoint"):::backend
            ShopAuthModule("Authentication Module"):::backend
            ShopRoleModule("Role Management Module"):::backend
            ShopCommon("Common Utilities"):::backend
            ShopViews("Views & Routes"):::backend
        end
        subgraph "Data Layer"
            ShopSQL("SQL Scripts & DB"):::data
        end
        subgraph "Containerization & CI/CD"
            ShopDocker("Shop Dockerfile"):::container
            ShopCI("Shop CI/CD Workflow"):::ci
        end
    end

    subgraph "BusinessManagement Project"
        subgraph "Web Layer"
            BMTemplates("BM Templates"):::frontend
        end
        subgraph "Application Layer"
            BMMain("BM Main Entrypoint"):::backend
            BMViews("BM Views & Routes"):::backend
        end
        subgraph "Data Layer"
            BMSQL("BM SQL & DB"):::data
            BMData("BM Data CSV"):::data
        end
        subgraph "Testing"
            BMTests("BM Tests"):::backend
        end
        subgraph "Containerization"
            BMDocker("BM Dockerfile"):::container
        end
    end

    subgraph "flask_sample (Example Project)"
        subgraph "Application Layer"
            FlaskMain("Flask Sample Main"):::backend
        end
        subgraph "Testing"
            FlaskTests("Flask Sample Tests"):::backend
        end
        subgraph "Containerization"
            FlaskDocker("Flask Sample Dockerfile"):::container
        end
    end

    subgraph "CI/CD & Infrastructure"
        GitHub("GitHub Workflows"):::ci
    end

    %% Client connections
    User -->|"HTTP_Request"| ShopGen
    User -->|"HTTP_Request"| BMTemplates
    User -->|"HTTP_Request"| FlaskMain

    %% Shop Project interactions
    ShopGen -->|"Render_page"| ShopMain
    ShopAuth -->|"Render_auth"| ShopAuthModule
    ShopRole -->|"Render_roles"| ShopRoleModule
    ShopMain -->|"Calls"| ShopAuthModule
    ShopMain -->|"Calls"| ShopRoleModule
    ShopMain -->|"Utilizes"| ShopCommon
    ShopMain -->|"Routes"| ShopViews
    ShopViews -->|"DB_query"| ShopSQL
    ShopAuthModule -->|"DB_query"| ShopSQL
    ShopRoleModule -->|"DB_query"| ShopSQL

    ShopDocker -->|"Containerizes"| ShopMain
    ShopCI -->|"Triggers_build"| ShopDocker

    %% BusinessManagement interactions
    BMTemplates -->|"Render_page"| BMMain
    BMMain -->|"Routes"| BMViews
    BMViews -->|"DB_query"| BMSQL
    BMMain -->|"Processes"| BMData
    BMTests -->|"Tests"| BMMain
    BMDocker -->|"Containerizes"| BMMain

    %% flask_sample interactions
    FlaskMain -->|"Tested_by"| FlaskTests
    FlaskDocker -->|"Containerizes"| FlaskMain

    %% CI/CD interactions
    GitHub -->|"Deploys"| ShopCI
    GitHub -->|"Deploys"| BMDocker
    GitHub -->|"Deploys"| FlaskDocker

    %% Click Events for Shop Project
    click ShopGen "https://github.com/adhithya7/is601-007/tree/main/Project/templates"
    click ShopAuth "https://github.com/adhithya7/is601-007/tree/main/Project/auth/templates"
    click ShopRole "https://github.com/adhithya7/is601-007/tree/main/Project/roles/templates"
    click ShopMain "https://github.com/adhithya7/is601-007/blob/main/Project/main.py"
    click ShopAuthModule "https://github.com/adhithya7/is601-007/tree/main/Project/auth"
    click ShopRoleModule "https://github.com/adhithya7/is601-007/tree/main/Project/roles"
    click ShopCommon "https://github.com/adhithya7/is601-007/blob/main/Project/common/utils.py"
    click ShopViews "https://github.com/adhithya7/is601-007/tree/main/Project/views"
    click ShopSQL "https://github.com/adhithya7/is601-007/tree/main/Project/sql"
    click ShopDocker "https://github.com/adhithya7/is601-007/tree/main/Project/Dockerfile"
    click ShopCI "https://github.com/adhithya7/is601-007/blob/main/.github/workflows/Deploy-Heroku-Project-*.yml"

    %% Click Events for BusinessManagement Project
    click BMTemplates "https://github.com/adhithya7/is601-007/tree/main/BusinessManagement/templates"
    click BMMain "https://github.com/adhithya7/is601-007/blob/main/BusinessManagement/main.py"
    click BMViews "https://github.com/adhithya7/is601-007/tree/main/BusinessManagement/views"
    click BMSQL "https://github.com/adhithya7/is601-007/tree/main/BusinessManagement/sql"
    click BMData "https://github.com/adhithya7/is601-007/blob/main/BusinessManagement/data.csv"
    click BMTests "https://github.com/adhithya7/is601-007/tree/main/BusinessManagement/test"
    click BMDocker "https://github.com/adhithya7/is601-007/tree/main/BusinessManagement/Dockerfile"

    %% Click Events for flask_sample Project
    click FlaskMain "https://github.com/adhithya7/is601-007/blob/main/flask_sample/main.py"
    click FlaskDocker "https://github.com/adhithya7/is601-007/tree/main/flask_sample/Dockerfile"
    click FlaskTests "https://github.com/adhithya7/is601-007/tree/main/flask_sample/test"

    %% Click Event for CI/CD
    click GitHub "https://github.com/adhithya7/is601-007/tree/main/.github/workflows"

    %% Styles
    classDef frontend fill:#fef2cc,stroke:#f39c12,stroke-width:2px;
    classDef backend fill:#c8e6c9,stroke:#27ae60,stroke-width:2px;
    classDef data fill:#d6eaf8,stroke:#3498db,stroke-width:2px;
    classDef ci fill:#f9ebea,stroke:#e74c3c,stroke-width:2px;
    classDef container fill:#e8daef,stroke:#8e44ad,stroke-width:2px;
    classDef client fill:#d5dbdb,stroke:#7f8c8d,stroke-width:2px;
```
