Introduction to Simple News Apps based on CSPC Recall Data

Learning to make a news app by trying to make a better Recalls page

Class objectives

In-class

Follow the articles on how to create a Flask app with Jinja templating. Then get to the point where you can create a page that lists the title of every recall in 2016, with a clickable link to the official URL, and a photo of the recalled product.

It just has to be a one page-Flask app for now. But get a good understanding of how the data is structured.

The articles

Introduction to Jinja2 Templating (2/6)
The Jinja2 templating library provides a much saner way of programmatically generating HTML.
Using Jinja2 to format the CSPC Recalls data (3/6)
Throwing recalls data and Jinja2 into the same app.

The Consumer Product Safety Commission recalls data

The consumer-friendly recalls notice site can be found here:

http://www.cpsc.gov/en/Recalls/

recalls-homepage.jpg

The API

The homepage for the CPSC API can be found here.

The PDF manual

Here's a gist that demonstrates some code.

Other recall data

The CPSC is not the only agency that handles recalls.

NHTSA handles vehicle and vehicle part recalls: http://www.nhtsa.gov/Vehicle+Safety/Recalls+&+Defects

FDA handles recalls of food, drugs, and cosmetics: http://www.fda.gov/Safety/Recalls/

Each agency has its own API and datastore and, frustratingly enough, data schema.