This generates the HTML for the monthly analytics found at https://open.canada.ca/en/content/open-government-analytics
-
Download this repo https://github.com/open-data/monthly-analytics-generator/archive/master.zip and unzip it. OR clone the repository:
git clone https://github.com/open-data/monthly-analytics-generator.git
-
Download the up-to-date analytics found at https://open.canada.ca/data/en/dataset/2916fad5-ebcc-4c86-b0f3-4f619b29f412. Place these CSV files you've just downloaded into the same folder as the unzipped repo.
You will need:
- Number of Visits, Downloads
- Datasets Released by Month
- Top 100 Downloaded Datasets (for the month prior)
- Datasets by Department or Agency
- Percentages of Site Visits by Province and Territory
- Percentages of Site Visits by Country
This can be done automatically by running the
get_resources.sh
script. -
run
pip install pyyaml
(required once, note: pip2) -
run
pip install python-dateutil
(required once, note: pip2) -
run
python2 create_html_analytics.py
-
Copy all HTML from the final two
.txt
files generated and paste this in the Drupalsource
section of the editing admin on https://open.canada.ca/en/content/open-government-analytics. Each file contains one language, so paste the HTML from the file ending inen
on the English page, and the HTML from the file ending infr
on the French page. -
Submit these as drafts first to ensure everything looks correct. Once confirmed, save the pages as newly published content.