# mgoldenitz/ontario-er-wait-time-scorecard architecture

> Architecture diagram of the GitHub repository mgoldenitz/ontario-er-wait-time-scorecard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mgoldenitz/ontario-er-wait-time-scorecard
- Repository: https://github.com/mgoldenitz/ontario-er-wait-time-scorecard

## Overview

This repository delivers a five-page Power BI scorecard for comparing Trillium Health Partners emergency-department waits with Ontario benchmarks and other hospitals. The main workflow is to load monthly trend exports and provincial rankings, model measures and targets, then explore the report’s scorecard, trends, rankings, and patient-mix views. A Python script independently rebuilds the tables and analyzes correlations and regression. Power BI internals are documented in the README rather than shown in source excerpts, so those links are based on that documentation.

Main entry points: [`er_analysis.py`](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py) (Analysis script), [`ER_Wait_Time_Scorecard.pbix`](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix) (Data model), [`data/trends`](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/tree/main/data/trends) (Monthly trend exports), [`data/hospital_rankings_2026-07.xlsx`](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/data/hospital_rankings_2026-07.xlsx) (Hospital rankings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_report["Power BI report"]
  node_pbix["Power BI scorecard"]
  node_dax["DAX measures"]
  node_scorecard["Scorecard page"]
  node_trends["Trends page"]
  node_ranking["Province ranking"]
  node_mix["Volume and mix"]
  node_methods["Methods and caveats"]
end

subgraph group_data["Inputs and model"]
  node_query["Power Query"]
  node_model[("Data model")]
  node_trendfiles[("Monthly trend exports")]
  node_rankfile[("Hospital rankings")]
end

subgraph group_analysis["Python analysis"]
  node_analysis["Analysis script<br/>[er_analysis.py]"]
  node_trendload["Trend table rebuild<br/>[er_analysis.py]"]
  node_rankload["Ranking table rebuild<br/>[er_analysis.py]"]
  node_scorestats["Scorecard statistics<br/>[er_analysis.py]"]
  node_mixstats["Patient mix and correlations<br/>[er_analysis.py]"]
  node_regression["Adjusted regression<br/>[er_analysis.py]"]
end

subgraph group_outputs["Published views"]
  node_regchart["Regression chart"]
  node_pdf["Static report"]
end

node_analyst(("Report user"))

node_analyst -->|"opens report"| node_pbix
node_trendfiles -->|"loads exports"| node_query
node_rankfile -->|"loads workbook"| node_query
node_query -->|"shapes tables"| node_model
node_model -->|"feeds measures"| node_dax
node_dax -->|"supplies metrics"| node_scorecard
node_dax -->|"supplies metrics"| node_trends
node_model -->|"supplies rankings"| node_ranking
node_model -->|"supplies volumes"| node_mix
node_analyst -->|"selects site"| node_scorecard
node_analyst -->|"selects measure"| node_trends
node_analyst -->|"compares hospitals"| node_ranking
node_analyst -->|"explores mix"| node_mix
node_analyst -->|"reviews caveats"| node_methods
node_analyst -->|"runs script"| node_analysis
node_analysis -->|"calls loader"| node_trendload
node_analysis -->|"calls loader"| node_rankload
node_trendfiles -->|"reads CSVs"| node_trendload
node_rankfile -->|"reads workbook"| node_rankload
node_analysis -->|"computes metrics"| node_scorestats
node_trendload -->|"provides trends"| node_scorestats
node_rankload -->|"provides rankings"| node_scorestats
node_analysis -->|"computes analysis"| node_mixstats
node_trendload -->|"provides trends"| node_mixstats
node_analysis -->|"fits models"| node_regression
node_trendload -->|"provides trends"| node_regression
node_regression -->|"writes figure"| node_regchart
node_analyst -->|"views report"| node_pdf

click node_pbix "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix"
click node_query "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix"
click node_model "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix"
click node_dax "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix"
click node_scorecard "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix"
click node_trends "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix"
click node_ranking "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix"
click node_mix "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix"
click node_methods "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix"
click node_trendfiles "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/tree/main/data/trends"
click node_rankfile "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/data/hospital_rankings_2026-07.xlsx"
click node_analysis "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py"
click node_trendload "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py"
click node_rankload "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py"
click node_scorestats "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py"
click node_mixstats "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py"
click node_regression "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py"
click node_pdf "https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/Goldenitz_ER_Wait_Time_Scorecard.pdf"

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_pbix,node_dax,node_scorecard,node_trends,node_ranking,node_mix,node_methods,node_analyst toneBlue
class node_query,node_model,node_trendfiles,node_rankfile toneAmber
class node_analysis,node_trendload,node_rankload,node_scorestats,node_mixstats,node_regression toneMint
class node_regchart,node_pdf toneRose
```

## Components

### Power BI report

- [Power BI scorecard](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix): `ER_Wait_Time_Scorecard.pbix`
- [DAX measures](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix): `ER_Wait_Time_Scorecard.pbix`
- [Scorecard page](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix): `ER_Wait_Time_Scorecard.pbix`
- [Trends page](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix): `ER_Wait_Time_Scorecard.pbix`
- [Province ranking](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix): `ER_Wait_Time_Scorecard.pbix`
- [Volume and mix](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix): `ER_Wait_Time_Scorecard.pbix`
- [Methods and caveats](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix): `ER_Wait_Time_Scorecard.pbix`

### Inputs and model

- [Power Query](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix): `ER_Wait_Time_Scorecard.pbix`
- [Data model](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/ER_Wait_Time_Scorecard.pbix): `ER_Wait_Time_Scorecard.pbix`
- [Monthly trend exports](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/tree/main/data/trends): `data/trends`
- [Hospital rankings](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/data/hospital_rankings_2026-07.xlsx): `data/hospital_rankings_2026-07.xlsx`

### Python analysis

- [Analysis script](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py): `er_analysis.py`
- [Trend table rebuild](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py): `er_analysis.py`
- [Ranking table rebuild](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py): `er_analysis.py`
- [Scorecard statistics](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py): `er_analysis.py`
- [Patient mix and correlations](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py): `er_analysis.py`
- [Adjusted regression](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/er_analysis.py): `er_analysis.py`

### Published views

- **Regression chart**
- [Static report](https://github.com/mgoldenitz/ontario-er-wait-time-scorecard/blob/main/Goldenitz_ER_Wait_Time_Scorecard.pdf): `Goldenitz_ER_Wait_Time_Scorecard.pdf`

### Other components

- **Report user**

## Connections

- Report user → Power BI scorecard: opens report (evidence: `README.md`)
- Monthly trend exports → Power Query: loads exports (evidence: `README.md`)
- Hospital rankings → Power Query: loads workbook (evidence: `README.md`)
- Power Query → Data model: shapes tables (evidence: `README.md`)
- Data model → DAX measures: feeds measures (evidence: `README.md`)
- DAX measures → Scorecard page: supplies metrics (evidence: `README.md`)
- DAX measures → Trends page: supplies metrics (evidence: `README.md`)
- Data model → Province ranking: supplies rankings (evidence: `README.md`)
- Data model → Volume and mix: supplies volumes (evidence: `README.md`)
- Report user → Scorecard page: selects site (evidence: `README.md`)
- Report user → Trends page: selects measure (evidence: `README.md`)
- Report user → Province ranking: compares hospitals (evidence: `README.md`)
- Report user → Volume and mix: explores mix (evidence: `README.md`)
- Report user → Methods and caveats: reviews caveats (evidence: `README.md`)
- Report user → Analysis script: runs script (evidence: `README.md`)
- Analysis script → Trend table rebuild: calls loader (evidence: `er_analysis.py`)
- Analysis script → Ranking table rebuild: calls loader (evidence: `er_analysis.py`)
- Monthly trend exports → Trend table rebuild: reads CSVs (evidence: `er_analysis.py`)
- Hospital rankings → Ranking table rebuild: reads workbook (evidence: `er_analysis.py`)
- Analysis script → Scorecard statistics: computes metrics (evidence: `er_analysis.py`)
- Trend table rebuild → Scorecard statistics: provides trends (evidence: `er_analysis.py`)
- Ranking table rebuild → Scorecard statistics: provides rankings (evidence: `er_analysis.py`)
- Analysis script → Patient mix and correlations: computes analysis (evidence: `er_analysis.py`)
- Trend table rebuild → Patient mix and correlations: provides trends (evidence: `er_analysis.py`)
- Analysis script → Adjusted regression: fits models (evidence: `er_analysis.py`)
- Trend table rebuild → Adjusted regression: provides trends (evidence: `er_analysis.py`)
- Adjusted regression → Regression chart: writes figure (evidence: `er_analysis.py`)
- Report user → Static report: views report (evidence: `README.md`)
