Skip to content

lchski/oic-data

Repository files navigation

Canadian federal Order in Council data

Orders in Council are a key part of Canada’s legal text. They’re a type of delegated legislation, adding additional detail or exercising a specific power from statute or prerogative.

The Orders in Council (OIC) database is great—but it has no export. This makes it difficult to study OICs at scale.

This project mirrors OICs, and their attachments, once a day.

The database’s disclaimer extra applies to this dataset:

The Orders in Council available through this website are not to be considered to be official versions, and are provided only for information purposes. If you wish to obtain an official version, please contact the Orders in Council Division.

How it works

  • scripts/scrape-order-tables.js uses a headless browser to submit the search form (with no criteria), downloading new results to order-tables/
    • creates one JSON file per OIC, containing the HTML of the OIC summary table as a property (html)
    • updates attachment-ids.json with any new attachments from the new results
  • scripts/scrape-attachments.js downloads new attachments to attachments/
    • ditto JSON approach from the OICs
  • .github/workflows/update-oics.yaml runs these scripts once a day via GitHub Actions, automatically updating this repository.

The data

As of July 2022, there are about 62,000 OICs (60.3 MB) and 32,000 attachments (131.1 MB).

Quirks

  • The database seems to shift the comma associated with the “Dept” column depending on the display order—so files in order-tables get overwritten with a new htmlHash, despite only a comma having changed. This occurs with maximum four OICs per scrape (because five are displayed on each search result page, and the scraper stops if it recognizes all five).
  • The tool doesn’t really handle changes to past OICs. But my (very strong) hunch is that they don’t change. You could adjust this tool to monitor all results regularly, using htmlHash to detect a change, but, well, see the comma issue above.

Where to go from here

Import the data directly and use it as you see fit. Or, use the complementary lchski/oic-analysis project (written in R) to extract meaningful information from these raw data, enabling analysis. Feel free to credit / link to this repository if you can, and make sure to mention that the information is originally from the Order in Council Division’s Orders in Council database.

About

Mirror of the OIC database.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published