PP434 - Coding Challenges

Data Science
Portfolio tasks

Candidate number: 64689

This portfolio documents my work on coding challenges completed during the PP434 course, Automated Data Visualization for Policymaking, taught by Richard Davies at the School of Public Policy at the London School of Economics and Political Science.

CC1 - HOSTING

Display charts in your own site.

Setting up a personal website using GitHub and embedding existing charts into the live webpage.

CC2 - BUILDING

Create your own visualisations

Creating charts using the Economics Observatory Data Hub and embedding them into the website.

CC3 - DEBATE

Use a visualisation in policy commentary

Producing charts linked to a policy topic and adding short written commentary alongside the visual evidence.

The United Kingdom has one of the highest rates of youth unemployment among OECD countries, despite efforts to address this problem.

Source: Own elaboration using data from the OECD Youth Unemployment Rate

The gap has widened in the latest year between the male and female NEET rate at age 16-24. Since the pandemic male rates have been higher than females, changing the trend which historically saw higher rates for females.

Source: Own elaboration using data from the Labor Force Survey 2024, GovUK

CC4 - REPLICATION

Re-create, then improve, someone else's chart.

Replicating an existing chart from a public source and producing an improved version.

CC5 - ACCESING DATA

Accesing data using an API

Collecting data through a live API and web scraping, cleaning the data, and visualising it on the website.

This chart uses data from the World Bank API.

The base URL is:
https://api.worldbank.org/v2/country/{countries}/indicator/{indicator}

To get the data, the API call specifies:

  • A list of countries: ind; mex; arg; usa; aus
  • The indicator code: NY.GDP.TOTL.RT.ZS (Total natural resources rents as a % of GDP)
  • The output format: format=json
  • Observations per page: per_page=1000

Full API request:
https://api.worldbank.org/v2/country/ind;mex;arg;usa;aus/indicator/NY.GDP.TOTL.RT.ZS?format=json&per_page=1000

Source: Own elaboration using data from the World Bank, Total Natural Resources Rents (% of GDP)

Accesing data vía scraping

I scraped a Wikipedia table containing education index data by country from 1990 to 2019, cleaned the dataset, selected relevant countries, and reshaped the data into tidy (long-form) format.

CC6. LOOPS

Build a dashboard

Using JavaScript loops and Vega-Lite to automatically generate a small dashboard of related macroeconomic indicators.

CC7. MAPS

Base maps and choropleths

Creating coordinate maps and choropleths for Scotland and Wales using geographic data.

This choropleth map links business data from StatsWales to official ONS Local Authority District boundaries using LAD geographic identifiers, ensuring consistency between statistical and spatial units.

Source: Own elaboration using data from Stats Wales, Business demography by area and year

Coordinate map showing drug-related deaths by council area in Scotland, using binned colors and sizes to highlight regional disparities and mortality intensity.

Source: Own elaboration using data from the National Records of Scotland, Drug-related deaths in Scotland, 2024

CC8 - BIG DATA

Extracting a story from millions of prices

Working with large price datasets, reducing and aggregating the data, and visualising selected trends.

CC9 - INTERACTIVE CHARTS

Two interactive visualisations

Building charts with interactive elements such as sliders or selection tools to explore the data.

CC10 - Advanced Analysis

Advanced Analysis and Machine Learning

Applying advanced analytical methods and machine learning techniques and visualising the results.

Gen AI Disclosure

I used Claude and Gemini as a coding assistant for data cleaning in Python, creating charts in VegaLite, and for website style design.