Consumer Price Index Dashboard (JSON)

Home

Dataset Information

For this exercise, we will use data from the AlphaVantage API. Specifically we will use the "Consumer Price Index (CPI)" endpoint. CPI is "widely regarded as the barometer of inflation levels in the broader economy". Consult the API documentation to learn more.

Setup

First obtain an AlphaVantage API Key (from the API sign up form, or from an instructor), and supply it when prompted.

Part 1

Write JavaScript code to answer the questions below. Log each of the answers to the console.

  1. Fetch monthly CPI data in JSON format from the API, using the provided URL.
  2. Display the name of this dataset (i.e. "Consumer Price Index for all Urban Consumers").
  3. Display the time frequency of this dataset (i.e. "monthly").
  4. Display the number of datapoints provided. (i.e. 1347).
  5. Display the time range (earliest and latest date) of available data (i.e. "1913-01-01" to "2025-03-01").


Part 2

Write JavaScript code to answer the questions below. Display the answers on the page in the designated areas.

  1. Create a line chart of the consumer price index over time. Include a chart title and axis labels.