# donatopy/vietnam-cinema architecture

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

- Interactive diagram: https://gitdiagram.com/donatopy/vietnam-cinema
- Repository: https://github.com/donatopy/vietnam-cinema

## Overview

##### Main Components
- Frontend Layer: The Streamlit application (app.py) acts as the presentation layer. This is what the user interacts with in the browser.
- Insight/Analytics Modules: Numerous Python scripts (insight1.py through insight7.py) likely serve as modules for processing data and generating individual insights.
- Data Storage/Source Files: Various Excel files (e.g., insight1.xlsx, insight7.xlsx, key_dates.xlsx, revenue_by_time.xlsx, normalized_theatres_combined_revenue_with_city.xlsx) and a CSV (release_dates.csv) serve as the raw data sources. These files are read and used by the insight modules.
- Static Visualization Assets: The city_revenue_map.html file appears to be a static or pre-generated HTML component, potentially used for displaying geographical data.
- Dependencies & Environment: The requirements.txt file defines the technical stack (Python libraries and frameworks, including Streamlit) necessary to run the application.

##### Relationships and Data Flow
- The user launches the application (using Streamlit) via app.py.
- The Streamlit frontend (app.py) directly calls or integrates the individual insight scripts to process and present analytical data.
- Each insight script may read from one or more associated data files (Excel or CSV files) and then produce visualizations or numerical summaries.
- The pre-generated HTML (city_revenue_map.html) is used as an embedded component or output of one of the insights, possibly rendered inside the Streamlit interface.
- Data flows from the raw files into the insight modules, then gets presented on the Streamlit interface.

##### Architectural Patterns or Design Principles
- Modular Design: Separation of concerns between the presentation layer (app.py) and the various insight modules.
- Data-Driven Analysis: The project operates by reading from external data sources and transforming them via dedicated Python scripts.
- Integration of Static and Dynamic Content: Use of both dynamic (Streamlit-driven) and static (HTML map) components.

##### Technologies and Frameworks
- Python and Streamlit for the frontend and overall application control.
- Data processing libraries that might be specified in requirements.txt (e.g., pandas, matplotlib, etc.) – though specifics are not detailed, they are implied.
- Excel and CSV file handling, likely using libraries like pandas or openpyxl.
- HTML visualization integrated with the Streamlit app.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Data Sources Subgraph
    subgraph "Data Sources"
        A1["insight1.xlsx"]:::data
        A2["insight2.xlsx"]:::data
        A3["insight7.xlsx"]:::data
        B1["key_dates.xlsx"]:::data
        B2["revenue_by_time.xlsx"]:::data
        B3["normalized_theatres_combined_revenue_with_city.xlsx"]:::data
        B4["release_dates.csv"]:::data
        SVA["city_revenue_map.html"]:::data
    end

    %% Insight Modules Subgraph
    subgraph "Insight Modules"
        M1["Insight Module 1 (insight1.py)"]:::module
        M2["Insight Module 2 (insight2.py)"]:::module
        M3["Insight Module 3 (insight3.py)"]:::module
        M4["Insight Module 4 (insight4.py)"]:::module
        M5["Insight Module 5 (insight5.py)"]:::module
        M6["Insight Module 6 (insight6.py)"]:::module
        M7["Insight Module 7 (insight7.py)"]:::module
    end

    %% Frontend and Dependencies
    F["Streamlit Frontend (app.py)"]:::frontend
    D["Dependencies & Environment (requirements.txt)"]:::dependency

    %% Data Sources to Insight Modules (explicit mappings)
    A1 -->|"uses"| M1
    A2 -->|"uses"| M2
    A3 -->|"uses"| M7

    %% Insight Modules to Frontend
    M1 -->|"sendsData"| F
    M2 -->|"sendsData"| F
    M3 -->|"sendsData"| F
    M4 -->|"sendsData"| F
    M5 -->|"sendsData"| F
    M6 -->|"sendsData"| F
    M7 -->|"sendsData"| F

    %% Static Visualization Asset embedded in Frontend
    SVA -->|"embedded"| F

    %% Dependencies to Frontend
    D -->|"dependencies"| F

    %% Click Events
    click F "https://github.com/donatopy/vietnam-cinema/blob/main/app.py"
    click M1 "https://github.com/donatopy/vietnam-cinema/blob/main/insight1.py"
    click M1 "https://github.com/donatopy/vietnam-cinema/blob/main/insight1.xlsx"
    click M2 "https://github.com/donatopy/vietnam-cinema/blob/main/insight2.py"
    click M2 "https://github.com/donatopy/vietnam-cinema/blob/main/insight2.xlsx"
    click M3 "https://github.com/donatopy/vietnam-cinema/blob/main/insight3.py"
    click M4 "https://github.com/donatopy/vietnam-cinema/blob/main/insight4.py"
    click M5 "https://github.com/donatopy/vietnam-cinema/blob/main/insight5.py"
    click M6 "https://github.com/donatopy/vietnam-cinema/blob/main/insight6.py"
    click M7 "https://github.com/donatopy/vietnam-cinema/blob/main/insight7.py"
    click M7 "https://github.com/donatopy/vietnam-cinema/blob/main/insight7.xlsx"
    click A1 "https://github.com/donatopy/vietnam-cinema/blob/main/insight1.xlsx"
    click A2 "https://github.com/donatopy/vietnam-cinema/blob/main/insight2.xlsx"
    click A3 "https://github.com/donatopy/vietnam-cinema/blob/main/insight7.xlsx"
    click B1 "https://github.com/donatopy/vietnam-cinema/blob/main/key_dates.xlsx"
    click B2 "https://github.com/donatopy/vietnam-cinema/blob/main/revenue_by_time.xlsx"
    click B3 "https://github.com/donatopy/vietnam-cinema/blob/main/normalized_theatres_combined_revenue_with_city.xlsx"
    click B4 "https://github.com/donatopy/vietnam-cinema/blob/main/release_dates.csv"
    click SVA "https://github.com/donatopy/vietnam-cinema/blob/main/city_revenue_map.html"
    click D "https://github.com/donatopy/vietnam-cinema/blob/main/requirements.txt"

    %% Styles
    classDef frontend fill:#f4de7e,stroke:#333,stroke-width:2px;
    classDef module fill:#aed581,stroke:#333,stroke-width:2px;
    classDef data fill:#81d4fa,stroke:#333,stroke-width:2px;
    classDef dependency fill:#f8bbd0,stroke:#333,stroke-width:2px;
```
