# pathitharun/ds-lab architecture

> Architecture diagram of the GitHub repository pathitharun/ds-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pathitharun/ds-lab
- Repository: https://github.com/pathitharun/ds-lab

## Overview

DS-Lab is a browser-based data science learning library centered on selecting an experiment and running its notebook cells. The browser presents experiment material and routes cell execution through a native persistent Python server when available, with Pyodide as the documented in-browser fallback; results include text, errors, tables, and plots. The README also documents downloadable lab PDFs and offline datasets. The sampled excerpts show the native API and parts of both execution paths, but not the full experiment UI or routing, so those links are included only where documented.

Main entry points: [`server.py`](https://github.com/pathitharun/ds-lab/blob/main/server.py) (Native API server), [`script.js`](https://github.com/pathitharun/ds-lab/blob/main/script.js) (Cell runner), [`index.html`](https://github.com/pathitharun/ds-lab/blob/main/index.html) (Library interface), [`iris.csv`](https://github.com/pathitharun/ds-lab/blob/main/iris.csv) (Offline datasets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning library"]
  node_webapp["Library interface<br/>[index.html]"]
  node_ui["Experiment UI and routing<br/>[script.js]"]
end

subgraph group_execution["Python execution"]
  node_cellrun["Cell runner<br/>[script.js]"]
  node_native["Native API server<br/>[server.py]"]
  node_persistent["Persistent Python runtime<br/>[server.py]"]
  node_wasm["Pyodide runtime<br/>[script.js]"]
  node_output["Results display<br/>[script.js]"]
  node_tables["DataFrame rendering<br/>[server.py]"]
  node_plots["Plot capture<br/>[server.py]"]
  node_static["Static asset serving<br/>[server.py]"]
end

subgraph group_content["Learning resources"]
  node_datasets[("Offline datasets<br/>[iris.csv]")]
  node_customerdata[("Customer dataset<br/>[mall_customers.csv]")]
  node_manuals["Lab PDFs"]
  node_savedplots["Saved plot images"]
end

node_student(("Student"))

node_student -->|"uses"| node_webapp
node_webapp -->|"loads interface"| node_ui
node_student -.->|"selects experiments"| node_ui
node_ui -->|"runs cells"| node_cellrun
node_cellrun -->|"posts code"| node_native
node_native -->|"dispatches code"| node_persistent
node_persistent -->|"renders tables"| node_tables
node_persistent -->|"captures plots"| node_plots
node_cellrun -->|"fallback executes"| node_wasm
node_native -.->|"returns results"| node_output
node_wasm -->|"renders results"| node_output
node_native -->|"serves assets"| node_static
node_student -->|"downloads manuals"| node_manuals
node_student -.->|"views plots"| node_savedplots
node_student -.->|"uses in experiments"| node_datasets
node_student -.->|"uses in experiment"| node_customerdata

click node_webapp "https://github.com/pathitharun/ds-lab/blob/main/index.html"
click node_ui "https://github.com/pathitharun/ds-lab/blob/main/script.js"
click node_cellrun "https://github.com/pathitharun/ds-lab/blob/main/script.js"
click node_native "https://github.com/pathitharun/ds-lab/blob/main/server.py"
click node_persistent "https://github.com/pathitharun/ds-lab/blob/main/server.py"
click node_wasm "https://github.com/pathitharun/ds-lab/blob/main/script.js"
click node_output "https://github.com/pathitharun/ds-lab/blob/main/script.js"
click node_tables "https://github.com/pathitharun/ds-lab/blob/main/server.py"
click node_plots "https://github.com/pathitharun/ds-lab/blob/main/server.py"
click node_datasets "https://github.com/pathitharun/ds-lab/blob/main/iris.csv"
click node_customerdata "https://github.com/pathitharun/ds-lab/blob/main/mall_customers.csv"
click node_manuals "https://github.com/pathitharun/ds-lab/tree/main/pdfs"
click node_savedplots "https://github.com/pathitharun/ds-lab/tree/main/assets/plots"
click node_static "https://github.com/pathitharun/ds-lab/blob/main/server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_ui toneBlue
class node_cellrun,node_native,node_persistent,node_wasm,node_output,node_tables,node_plots,node_static toneAmber
class node_datasets,node_customerdata,node_manuals,node_savedplots toneMint
class node_student toneIndigo
```

## Components

### Learning library

- [Library interface](https://github.com/pathitharun/ds-lab/blob/main/index.html): `index.html`
- [Experiment UI and routing](https://github.com/pathitharun/ds-lab/blob/main/script.js): `script.js`

### Python execution

- [Cell runner](https://github.com/pathitharun/ds-lab/blob/main/script.js): `script.js`
- [Native API server](https://github.com/pathitharun/ds-lab/blob/main/server.py): `server.py`
- [Persistent Python runtime](https://github.com/pathitharun/ds-lab/blob/main/server.py): `server.py`
- [Pyodide runtime](https://github.com/pathitharun/ds-lab/blob/main/script.js): `script.js`
- [Results display](https://github.com/pathitharun/ds-lab/blob/main/script.js): `script.js`
- [DataFrame rendering](https://github.com/pathitharun/ds-lab/blob/main/server.py): `server.py`
- [Plot capture](https://github.com/pathitharun/ds-lab/blob/main/server.py): `server.py`
- [Static asset serving](https://github.com/pathitharun/ds-lab/blob/main/server.py): `server.py`

### Learning resources

- [Offline datasets](https://github.com/pathitharun/ds-lab/blob/main/iris.csv): `iris.csv`
- [Customer dataset](https://github.com/pathitharun/ds-lab/blob/main/mall_customers.csv): `mall_customers.csv`
- [Lab PDFs](https://github.com/pathitharun/ds-lab/tree/main/pdfs): `pdfs`
- [Saved plot images](https://github.com/pathitharun/ds-lab/tree/main/assets/plots): `assets/plots`

### Other components

- **Student**

## Connections

- Student → Library interface: uses (evidence: `README.md`)
- Library interface → Experiment UI and routing: loads interface (evidence: `README.md`)
- Student → Experiment UI and routing: selects experiments
- Experiment UI and routing → Cell runner: runs cells (evidence: `script.js`)
- Cell runner → Native API server: posts code (evidence: `script.js`)
- Native API server → Persistent Python runtime: dispatches code (evidence: `server.py`)
- Persistent Python runtime → DataFrame rendering: renders tables (evidence: `server.py`)
- Persistent Python runtime → Plot capture: captures plots (evidence: `server.py`)
- Cell runner → Pyodide runtime: fallback executes (evidence: `README.md`)
- Native API server → Results display: returns results
- Pyodide runtime → Results display: renders results (evidence: `script.js`)
- Native API server → Static asset serving: serves assets (evidence: `server.py`)
- Student → Lab PDFs: downloads manuals (evidence: `README.md`)
- Student → Saved plot images: views plots
- Student → Offline datasets: uses in experiments
- Student → Customer dataset: uses in experiment
