# adizaen/demo_streamlit architecture

> Architecture diagram of the GitHub repository adizaen/demo_streamlit, 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/adizaen/demo_streamlit
- Repository: https://github.com/adizaen/demo_streamlit

## Overview

##### Main Components
a. User Interface Layer (Frontend):
- That users interact through a web browser.
- Streamlit interface that renders the content from demo.py and the additional page(s) provided in the pages folder (e.g., Halaman Dua.py).
b. Application Logic Layer (Backend):
- Demo.py acts as the main entry point and controller.
- The pages folder houses additional scripts for multi-page functionality, which indicates a modular design where each page handles distinct views or functions.
c. Data Layer:
- The data_input directory holds data (for instance, loan_clean), which the app likely interacts with or visualizes.
d. Dependency & Configuration:
- A note for the requirements.txt file that lists all external libraries (most notably, Streamlit) needed to run the project.

##### Relationships and Data Flow
- That user actions in the browser trigger functions in demo.py.
- How demo.py and the modules in the pages folder collaborate to generate views.
- Flow of data from the data_input directory (especially loan_clean) into the application logic for processing or visualization.
- Optionally, denote that the requirements.txt file reflects configuration/dependencies that support the whole system.

##### Architectural Patterns and Design Principles
- That the project follows a modular design, with a clear separation between the UI (Streamlit interface), application logic (demo.py and pages), and data resources.
- That the project might adhere to a simplified MVC-like pattern (where demo.py acts as a controller, pages as views, and data_input as the model) even if not formally structured that way.
- Mention the use of a multi-page approach in Streamlit to enhance separation of concerns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction Layer
    subgraph "User Interaction Layer"
        Browser["User (Browser)"]:::ui
    end

    %% Streamlit Frontend Layer
    subgraph "Streamlit Frontend"
        MC["Main Controller (demo.py)"]:::backend
        AP["Additional Pages (pages/Halaman Dua.py)"]:::backend
    end

    %% Data Layer
    subgraph "Data Layer"
        DS["Data Sources (data_input/loan_clean)"]:::data
    end

    %% Dependencies & Configuration
    DEP["Dependencies (requirements.txt)"]:::dependency

    %% Relationships
    Browser -->|"interacts"| MC
    MC -->|"renders"| AP
    MC -->|"loads_data"| DS
    MC -->|"reads_config"| DEP

    %% Click Events
    click MC "https://github.com/adizaen/demo_streamlit/blob/main/demo.py"
    click AP "https://github.com/adizaen/demo_streamlit/blob/main/pages/Halaman Dua.py"
    click DS "https://github.com/adizaen/demo_streamlit/tree/main/data_input/loan_clean"
    click DEP "https://github.com/adizaen/demo_streamlit/blob/main/requirements.txt"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#2874A6,stroke-width:2px;
    classDef backend fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef data fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef dependency fill:#F5B7B1,stroke:#E74C3C,stroke-width:2px;
```
