Skip to content

Commit 77e3cb6

Browse files
authored
Merge pull request #218 from BuildCanada/add-methodology
Add methodology to Ontario, Toronto, Vancouver Spends. Also add credits.
2 parents 98d2eb0 + 7f5ac66 commit 77e3cb6

File tree

7 files changed

+62
-3
lines changed

7 files changed

+62
-3
lines changed

data/alberta/summary.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,5 +226,6 @@
226226
"percentageFormatted": "6.1%"
227227
}
228228
],
229+
"credits": "Built by [Sathvik](https://www.linkedin.com/in/sathvik-divili/)",
229230
"generatedAt": "2025-08-04T00:00:00.000Z"
230231
}

data/british-columbia/summary.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,5 +286,6 @@
286286
"percentageFormatted": "0.0%",
287287
"totalSpendingFormatted": "$0.0B"
288288
}
289-
]
289+
],
290+
"credits": "Built by [Sahib](https://www.linkedin.com/in/sahib-k-b9a047156/)"
290291
}

data/ontario/summary.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,7 @@
274274
"percentageFormatted": "0.0%"
275275
}
276276
],
277+
"methodology": "Top-level figures are taken from the [Annual Report](https://www.ontario.ca/page/public-accounts-2023-24-annual-report), which is independetly audited by a third-party. Granular spending data is based off of [Ministry Statements and Schedules](https://www.ontario.ca/page/public-accounts-ontario-2023-24#section-3).\n\nIn cases where the Ministry's total expenses did not sum up to the audited totals, an \"Unreported\" line-item was added ([see here](https://docs.google.com/spreadsheets/d/13IXbEx_Lu9FxYSOZkM9BHzHDICauj3TyRXfiGQHHnTU/edit?gid=1120240224#gid=1120240224)).",
278+
"credits": "Built by [Jesse](https://www.linkedin.com/in/jesseleecan/)",
277279
"generatedAt": "2025-06-23T08:00:06.275Z"
278280
}

data/toronto/summary.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,7 @@
8989
"percentageFormatted": "1.4%"
9090
}
9191
],
92+
"methodology": "This diagram is based off of the City's Statement of Operations, which can be interpreted as what the City brought in (revenues) and spent (expenses) during the year.\n\nThese are sourced from the [Consolidated Financial Statements](https://www.toronto.ca/wp-content/uploads/2025/07/97e1-2024-Consolidated-Financial-Statements-07-29-2025.pdf), which is audited by an independent third-party, and [Revenues and Expenses Datasheet](https://open.toronto.ca/dataset/revenues-and-expenses/). The former offered more granular data on the revenue side, while the latter offered more granular data on the expense side.\n\nIn cases where there were discrepancies between the audited totals and the sums of the granular data, the audited totals was used as the source of truth, and an \"Unreported\" line-item was added to ensure totals matched.",
93+
"credits": "Built by [Ajay](https://www.linkedin.com/in/ajay-matharoo/), [Jonathan](https://www.linkedin.com/in/jonathan-talmi-1a099852/), and [Je Ho](https://www.linkedin.com/in/je-ho-cho-194115198/)",
9294
"generatedAt": "2025-10-21T22:57:13Z"
9395
}

data/vancouver/summary.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,7 @@
8888
"percentage": 2.164089,
8989
"percentageFormatted": "2.16%"
9090
}
91-
]
91+
],
92+
"methodology": "This diagram is based off of the City's Statement of Operations, which can be interpreted as what the City brought in (revenues) and spent (expenses) during the year.\n\nData is sourced from Vancouver's [Annual Financial Report](https://vancouver.ca/files/cov/2024-annual-financial-report.pdf). Taxes collected by the City on behalf of other authorities have been included in the diagram (see Note 15(g) in the Report). Expenses for tangible capital assets have been included as well (see Note 13 in the Report). Full worksheet [here](https://docs.google.com/spreadsheets/d/1_ZBTlhPj9aCwj5lxCkX3EKZxm4DNQPun).",
93+
"credits": "Built by [Boris](https://www.linkedin.com/in/boris-tsao-asa-8499b91b/)"
9294
}

src/app/[lang]/(main)/[jurisdiction]/page.tsx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,32 @@ export default async function ProvinceIndex({
393393
/>
394394
</Section>
395395
)}
396+
{jurisdiction.methodology && (
397+
<Section>
398+
<H2>
399+
<Trans>Methodology</Trans>
400+
</H2>
401+
{jurisdiction.methodology.split("\n\n").map((paragraph, index) => (
402+
<P key={index}>
403+
{paragraph.match(/\*\*([^*]+)\*\*/) ||
404+
paragraph.match(/\[([^\]]+)\]\(([^)]+)\)/) ? (
405+
<span
406+
dangerouslySetInnerHTML={{
407+
__html: paragraph
408+
.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>")
409+
.replace(
410+
/\[([^\]]+)\]\(([^)]+)\)/g,
411+
'<a href="$2" class="text-blue-500 underline hover:text-blue-600" target="_blank" rel="noopener noreferrer">$1</a>',
412+
),
413+
}}
414+
/>
415+
) : (
416+
<Trans>{paragraph}</Trans>
417+
)}
418+
</P>
419+
))}
420+
</Section>
421+
)}
396422
<Section>
397423
<H2>
398424
<Trans>Sources</Trans>
@@ -409,6 +435,30 @@ export default async function ProvinceIndex({
409435
</Trans>
410436
</P>
411437
</Section>
438+
{jurisdiction.credits && (
439+
<Section className="text-center text-sm">
440+
<hr className="my-8"></hr>
441+
{jurisdiction.credits.split("\n\n").map((paragraph, index) => (
442+
<P key={index}>
443+
{paragraph.match(/\*\*([^*]+)\*\*/) ||
444+
paragraph.match(/\[([^\]]+)\]\(([^)]+)\)/) ? (
445+
<span
446+
dangerouslySetInnerHTML={{
447+
__html: paragraph
448+
.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>")
449+
.replace(
450+
/\[([^\]]+)\]\(([^)]+)\)/g,
451+
'<a href="$2" class="text-blue-500 underline hover:text-blue-600" target="_blank" rel="noopener noreferrer">$1</a>',
452+
),
453+
}}
454+
/>
455+
) : (
456+
<Trans>{paragraph}</Trans>
457+
)}
458+
</P>
459+
))}
460+
</Section>
461+
)}
412462
</PageContent>
413463
</Page>
414464
);

src/lib/jurisdictions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ export type Jurisdiction = {
1313
totalProvincialSpending: number;
1414
total: number;
1515
source: string;
16-
// Optional list of ministries from summary.json; used for fallback counts
1716
ministries?: unknown[];
1817
debtInterest: number;
1918
netDebt: number;
2019
totalDebt: number;
20+
methodology?: string;
21+
credits?: string;
2122
};
2223

2324
type Category = {

0 commit comments

Comments
 (0)