# okld/streamlit-pandas-profiling architecture

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

- Interactive diagram: https://gitdiagram.com/okld/streamlit-pandas-profiling
- Repository: https://github.com/okld/streamlit-pandas-profiling

## Overview

##### Project type and purpose
- This is an open-source Python library that provides a custom Streamlit component. Its purpose is to embed a pandas-profiling ProfileReport inside a Streamlit app by wrapping a React frontend.

##### File structure
- Top-level files: setup.py, setup.cfg, Makefile, MANIFEST.in, version.py → Python packaging and build configuration.
- Directory “streamlit_pandas_profiling/”: the Python package namespace.
- __init__.py / version.py → expose st_profile_report function and version metadata.
- frontend/ → React-based Streamlit component source.
– package.json, tsconfig.json, .env → JS build and dev configuration.
– public/index.html → entry HTML for the component iframe.
– src/*.tsx → React code that receives the serialized report and renders it.

##### README for additional insights
- Usage snippet shows that the Python side calls pandas_profiling to generate a ProfileReport, then calls st_profile_report(report).
- Under the hood, st_profile_report is implemented as a Streamlit custom component: a Python wrapper that launches/serves the React bundle in an iframe and passes data back and forth.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Script
    User["User's Streamlit App (Python Script)"]:::user

    %% Python Side
    subgraph "Python Side"
        direction TB
        Package["streamlit_pandas_profiling\n(Python Package)"]:::python
        Wrapper["st_profile_report\n& Component Declaration"]:::python
        Version["version.py"]:::python
        PandasProfiling["pandas_profiling"]:::external
    end

    %% Streamlit Server
    StreamlitServer["Streamlit Server"]:::external

    %% Frontend Source
    subgraph "React Frontend Source"
        direction TB
        FrontendRoot["frontend"]:::js
        PackageJSON["package.json"]:::js
        TSConfig["tsconfig.json"]:::js
        EnvFile[".env"]:::js
        PublicHTML["public/index.html"]:::js
        EntryPoint["src/index.tsx"]:::js
        ProfileComp["src/ProfileReport.tsx"]:::js
        Declarations["src/react-app-env.d.ts"]:::js
    end

    %% Browser
    Browser["User's Browser"]:::browser

    %% Relationships
    User -->|"calls st_profile_report()"| Wrapper
    Wrapper -->|"generate report object"| PandasProfiling
    PandasProfiling -->|"report (HTML/JSON)"| Wrapper
    Wrapper -->|"serialize/send via component API"| StreamlitServer
    StreamlitServer -->|"serve JS bundle via HTTP"| PublicHTML
    PublicHTML -->|loads React app| EntryPoint
    EntryPoint -->|renders component| ProfileComp
    ProfileComp -->|"renders report inside iframe"| Browser

    %% Click Events
    click Package "https://github.com/okld/streamlit-pandas-profiling/tree/main/streamlit_pandas_profiling/"
    click Wrapper "https://github.com/okld/streamlit-pandas-profiling/blob/main/streamlit_pandas_profiling/__init__.py"
    click Version "https://github.com/okld/streamlit-pandas-profiling/blob/main/streamlit_pandas_profiling/version.py"
    click FrontendRoot "https://github.com/okld/streamlit-pandas-profiling/tree/main/streamlit_pandas_profiling/frontend/"
    click PackageJSON "https://github.com/okld/streamlit-pandas-profiling/blob/main/streamlit_pandas_profiling/frontend/package.json"
    click TSConfig "https://github.com/okld/streamlit-pandas-profiling/blob/main/streamlit_pandas_profiling/frontend/tsconfig.json"
    click EnvFile "https://github.com/okld/streamlit-pandas-profiling/blob/main/streamlit_pandas_profiling/frontend/.env"
    click PublicHTML "https://github.com/okld/streamlit-pandas-profiling/blob/main/streamlit_pandas_profiling/frontend/public/index.html"
    click EntryPoint "https://github.com/okld/streamlit-pandas-profiling/blob/main/streamlit_pandas_profiling/frontend/src/index.tsx"
    click ProfileComp "https://github.com/okld/streamlit-pandas-profiling/blob/main/streamlit_pandas_profiling/frontend/src/ProfileReport.tsx"
    click Declarations "https://github.com/okld/streamlit-pandas-profiling/blob/main/streamlit_pandas_profiling/frontend/src/react-app-env.d.ts"

    %% Styles
    classDef python fill:#E5F5E0,stroke:#333,stroke-width:1px
    classDef js fill:#E0F0FF,stroke:#333,stroke-width:1px
    classDef external fill:#F0E0FF,stroke:#333,stroke-width:1px
    classDef browser fill:#FFF5E0,stroke:#333,stroke-width:1px
    classDef user fill:#FFE0E0,stroke:#333,stroke-width:1px
```
