# meia-yong/mapping-the-broadway-network architecture

> Architecture diagram of the GitHub repository meia-yong/mapping-the-broadway-network, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/meia-yong/mapping-the-broadway-network
- Repository: https://github.com/meia-yong/mapping-the-broadway-network

## Overview

#### Purpose and Entry Points
This repository builds a Broadway performer-collaboration network from Internet Broadway Database (IBDB) production data. The operational entry points are the scraper module at `src/ibdb_scraper.py`, staged analysis/pipeline notebooks under `notebooks/`, and a browser-based interactive visualization rooted at `visualisation/index.html` and `visualisation/src/main.js`.

#### Acquisition: IBDB Production Data
IBDB is the external source. Scraping prototypes mature into production, metadata, and cast extraction stages in `notebooks/08_production_scraper.ipynb`, `notebooks/10_production_catalogue.ipynb`, `notebooks/11_production_metadata.ipynb`, and `notebooks/12_cast_extraction.ipynb`. `src/ibdb_scraper.py` is the reusable Python boundary for HTTP/HTML scraping. Raw and intermediate source artifacts are retained in `data/raw/` and checkpoints in `data/processed/`.

#### Catalogue and Cast Data Pipeline
The pipeline creates a season/production catalogue, associates productions with opening-night casts, then cleans duplicate or malformed records. Core persisted datasets are `data/processed/season_catalogue.csv`, `data/processed/production_catalogue_unique.csv`, and `data/processed/production_cast_clean.csv`. Checkpoint files such as `data/processed/production_metadata_checkpoint.csv` support long-running or recoverable extraction rather than requiring a single transactional run.

#### Network Construction and Projection
The central transformation converts production–performer membership into a bipartite graph and projects it to a performer–performer collaboration graph: two performers are connected when appearing in a common production. This work is represented by `notebooks/13_network_construction.ipynb` and `notebooks/16_network_reconstruction.ipynb`. The resulting graph is materialized as node, edge, and cast tables: `data/processed/performer_nodes.csv`, `data/processed/performer_edges.csv`, and `data/processed/performer_edges_clean.csv`.

#### Cleaning, Metrics, and Analysis
Graph diagnostics and cleaning are distinct stages, preventing raw co-cast projection artifacts from directly reaching visual output. `notebooks/14_network_diagnostics.ipynb` and `notebooks/15_network_cleaning.ipynb` produce the cleaned collaboration network and associated degree/metric outputs, including `data/processed/performer_degree_raw.csv` and `data/processed/performer_metrics.csv`. Exploratory network analysis is continued in `notebooks/17_network_analysis.ipynb`.

#### Layout and Visualization Data Boundary
Layout computation is offline and exported as CSV coordinates, separating expensive graph-layout experimentation from client rendering. Candidate layouts live in `data/layouts/coordinates/`, notably DRL variants and standard layouts such as `data/layouts/coordinates/fruchterman_reingold.csv`. Visualization-ready edge data is additionally curated in `data/processed/performer_edges_visual.csv`. Selected layout and cleaned-edge files are copied into `visualisation/public/data/`, forming the static-data contract consumed by the frontend.

#### Interactive Visualization Runtime
`visualisation/` is a separate JavaScript/npm application, with dependencies declared in `visualisation/package.json`. Its client entry point, `visualisation/src/main.js`, loads static network data from `visualisation/public/data/` and renders it in the browser through `visualisation/index.html`. There is no indicated backend API or database runtime; Python/notebook processing produces versioned CSV artifacts, and the frontend serves/consumes those artifacts as static assets.

Main entry points: [`notebooks/08_production_scraper.ipynb`](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/notebooks/08_production_scraper.ipynb) (Scraping stages), [`data/processed/performer_metrics.csv`](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/performer_metrics.csv) (Clean network and metrics), [`data/processed/production_cast_clean.csv`](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/production_cast_clean.csv) (Clean production cast), [`visualisation/public/data/performer_edges_clean.csv`](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/visualisation/public/data/performer_edges_clean.csv) (Static data contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["IBDB acquisition"]
  node_ibdb[("IBDB<br/>external data source")]
  node_scraper["Scraper module<br/>Python scraper<br/>[ibdb_scraper.py]"]
  node_scrape_notebooks["Scraping stages<br/>notebooks"]
  node_raw_data[("Raw artifacts<br/>data directory<br/>[broadway_cast.csv]")]
end

subgraph group_pipeline["Data and network pipeline"]
  node_catalogue[("Production catalogue<br/>CSV datasets")]
  node_cast[("Clean production cast<br/>CSV dataset")]
  node_checkpoints[("Extraction checkpoints<br/>CSV checkpoints")]
  node_network_build["Network construction<br/>notebooks"]
  node_raw_network[("Raw performer network<br/>CSV datasets")]
  node_diagnostics["Diagnostics and cleaning<br/>notebooks"]
  node_clean_network[("Clean network and metrics<br/>CSV datasets")]
  node_analysis["Network analysis<br/>notebook"]
end

subgraph group_layout["Layout export"]
  node_layout_work[("Offline layout computation<br/>layout datasets")]
  node_visual_edges[("Visualization edge export<br/>CSV dataset")]
end

subgraph group_frontend["Interactive visualization"]
  node_static_contract[("Static data contract<br/>frontend assets")]
  node_client["Browser visualization<br/>JavaScript application<br/>[main.js]"]
  node_html_entry["HTML entry<br/>browser entry point<br/>[index.html]"]
  node_npm_app["Frontend dependencies<br/>npm manifest<br/>[package.json]"]
end

node_ibdb -->|"scraped by"| node_scraper
node_scraper -->|"used by"| node_scrape_notebooks
node_scrape_notebooks -->|"retains source artifacts"| node_raw_data
node_scrape_notebooks -->|"builds"| node_catalogue
node_scrape_notebooks -->|"extracts and cleans"| node_cast
node_scrape_notebooks -.->|"writes recovery state"| node_checkpoints
node_catalogue -->|"associates productions"| node_cast
node_cast -->|"membership input"| node_network_build
node_network_build -->|"projects co-cast graph"| node_raw_network
node_raw_network -->|"diagnoses and filters"| node_diagnostics
node_diagnostics -->|"writes cleaned edges and metrics"| node_clean_network
node_clean_network -->|"analyzed by"| node_analysis
node_clean_network -->|"layout input"| node_layout_work
node_clean_network -->|"curates"| node_visual_edges
node_layout_work -->|"copies selected coordinates"| node_static_contract
node_visual_edges -->|"copies edge data"| node_static_contract
node_static_contract -->|"loaded as static CSV"| node_client
node_html_entry -->|"boots"| node_client
node_npm_app -.->|"declares dependencies"| node_client

click node_scraper "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/src/ibdb_scraper.py"
click node_scrape_notebooks "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/notebooks/08_production_scraper.ipynb"
click node_raw_data "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/raw/broadway_cast.csv"
click node_catalogue "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/production_catalogue_unique.csv"
click node_cast "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/production_cast_clean.csv"
click node_checkpoints "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/production_metadata_checkpoint.csv"
click node_network_build "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/notebooks/13_network_construction.ipynb"
click node_raw_network "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/performer_edges.csv"
click node_diagnostics "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/notebooks/15_network_cleaning.ipynb"
click node_clean_network "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/performer_metrics.csv"
click node_analysis "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/notebooks/17_network_analysis.ipynb"
click node_layout_work "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/layouts/coordinates/fruchterman_reingold.csv"
click node_visual_edges "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/performer_edges_visual.csv"
click node_static_contract "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/visualisation/public/data/performer_edges_clean.csv"
click node_client "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/visualisation/src/main.js"
click node_html_entry "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/visualisation/index.html"
click node_npm_app "https://github.com/meia-yong/mapping-the-broadway-network/blob/main/visualisation/package.json"

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_ibdb,node_scraper,node_scrape_notebooks,node_raw_data toneBlue
class node_catalogue,node_cast,node_checkpoints,node_network_build,node_raw_network,node_diagnostics,node_clean_network,node_analysis toneAmber
class node_layout_work,node_visual_edges toneMint
class node_static_contract,node_client,node_html_entry,node_npm_app toneRose
```

## Components

### IBDB acquisition

- **IBDB**: external data source · Production, metadata, and cast source.
- [Scraper module](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/src/ibdb_scraper.py): Python scraper · Reusable HTTP and HTML extraction boundary. · `src/ibdb_scraper.py`
- [Scraping stages](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/notebooks/08_production_scraper.ipynb): notebooks · Production, catalogue, metadata, and cast extraction. · `notebooks/08_production_scraper.ipynb`
- [Raw artifacts](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/raw/broadway_cast.csv): data directory · `data/raw/broadway_cast.csv`

### Data and network pipeline

- [Production catalogue](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/production_catalogue_unique.csv): CSV datasets · Season and deduplicated production records. · `data/processed/production_catalogue_unique.csv`
- [Clean production cast](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/production_cast_clean.csv): CSV dataset · Production-to-performer membership data. · `data/processed/production_cast_clean.csv`
- [Extraction checkpoints](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/production_metadata_checkpoint.csv): CSV checkpoints · Recoverable state for long-running extraction. · `data/processed/production_metadata_checkpoint.csv`
- [Network construction](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/notebooks/13_network_construction.ipynb): notebooks · Builds bipartite membership and performer projection. · `notebooks/13_network_construction.ipynb`
- [Raw performer network](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/performer_edges.csv): CSV datasets · Projected nodes, edges, and raw degree output. · `data/processed/performer_edges.csv`
- [Diagnostics and cleaning](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/notebooks/15_network_cleaning.ipynb): notebooks · Removes projection artifacts and calculates graph measures. · `notebooks/15_network_cleaning.ipynb`
- [Clean network and metrics](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/performer_metrics.csv): CSV datasets · Cleaned collaboration edges and performer metrics. · `data/processed/performer_metrics.csv`
- [Network analysis](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/notebooks/17_network_analysis.ipynb): notebook · Exploratory analysis of the reconstructed network. · `notebooks/17_network_analysis.ipynb`

### Layout export

- [Offline layout computation](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/layouts/coordinates/fruchterman_reingold.csv): layout datasets · Candidate graph coordinates, including force-directed layouts. · `data/layouts/coordinates/fruchterman_reingold.csv`
- [Visualization edge export](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/data/processed/performer_edges_visual.csv): CSV dataset · Curated edges for rendering. · `data/processed/performer_edges_visual.csv`

### Interactive visualization

- [Static data contract](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/visualisation/public/data/performer_edges_clean.csv): frontend assets · Selected layouts and cleaned edges copied for the client. · `visualisation/public/data/performer_edges_clean.csv`
- [Browser visualization](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/visualisation/src/main.js): JavaScript application · Loads static network data and renders the interactive graph. · `visualisation/src/main.js`
- [HTML entry](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/visualisation/index.html): browser entry point · `visualisation/index.html`
- [Frontend dependencies](https://github.com/meia-yong/mapping-the-broadway-network/blob/main/visualisation/package.json): npm manifest · `visualisation/package.json`

## Connections

- IBDB → Scraper module: scraped by
- Scraper module → Scraping stages: used by
- Scraping stages → Raw artifacts: retains source artifacts
- Scraping stages → Production catalogue: builds
- Scraping stages → Clean production cast: extracts and cleans
- Scraping stages → Extraction checkpoints: writes recovery state
- Production catalogue → Clean production cast: associates productions
- Clean production cast → Network construction: membership input
- Network construction → Raw performer network: projects co-cast graph
- Raw performer network → Diagnostics and cleaning: diagnoses and filters
- Diagnostics and cleaning → Clean network and metrics: writes cleaned edges and metrics
- Clean network and metrics → Network analysis: analyzed by
- Clean network and metrics → Offline layout computation: layout input
- Clean network and metrics → Visualization edge export: curates
- Offline layout computation → Static data contract: copies selected coordinates
- Visualization edge export → Static data contract: copies edge data
- Static data contract → Browser visualization: loaded as static CSV
- HTML entry → Browser visualization: boots
- Frontend dependencies → Browser visualization: declares dependencies
