Quarto is an open-source publishing system for websites, dashboards, reports, presentations, and more. This repository contains country analytics reports created with Quarto and Python.
🎥 Check out the corresponding YouTube video: Watch here.
📄 Sample Reports:
- Fork the repo using the button in the top-right corner of this page.
- Clone the forked repo locally using:
git clone https://github.com/<YOUR USERNAME>/<YOUR REPO>.git
Tip: You can also click on the green Code button to get your specific URL
First, activate a virtual environment (optional, but recommended). Then install dependencies:
cd country-analytics # Replace this with your name for the repo
pip install -r requirements.txt
- Download Quarto extensions for your preferred code editor using this link.
- The
quarto-cli
is installed via pip, so no extra downloads should be necessary.
-
The report template is found in
country_report.qmd
-
To generate a new report, run:
quarto render country_report.qmd
This generates a PDF in the ./outputs/
directory.
-
You can change the output directory by modifying the
_quarto.yml
file. -
To see additional render options, use:
quarto render -h
The script create_all_reports.py
automates the generation of reports for multiple countries. It also uses the colorthief library to extract colors from country flags.
-
United Nations: Population, gender ratio, median age, and life expectancy we leverage the World Populations Prospects Dataset from the United Nations.
-
World Bank: Age distribution data from the World Bank World Development Indicators Database. There are many additional data fields that could be incorporated into a report from this data source, but to keep the file size appropriate for a Github repository, only the age distribution indicators were kept. To easily download a more complete version of the dataset, check out this Kaggle Dataset.
Note: this Kaggle source file may be ';' delimited. If you want to load it into Pandas, you'll likely need to do a
pd.read_csv('worldbank-country-profile.csv', delimiter=';')
-
Country Flags Repository: Find flag images from @csmoore's repository
Here are some ideas to extend and personalize your reports:
-
Add More Data: Integrate additional fields from the full UN or World Bank datasets.
-
Use More Colors: Pull multiple colors from a country’s flag using
colorthief
'sget_palette()
function. -
Make Interactive Reports: Render to HTML and use Plotly for interactive visualizations.
Publish your Quarto Reports by using Posit Connect Cloud
Special thanks to David Keyes and the R for the Rest of Us team for the typst templates and Quarto insights. Check out David's Posit Conf Talk!
Share your work!
Tag me @KeithGalli on LinkedIn or social media and use #QuartoCountry to show me your reports!