Seattle open data: Difference between revisions

From CommunityData
(update API test code and instructions)
Line 1: Line 1:
[[File:Burke_gilman.jpg|thumb|right|250px|Who's riding on the Burke Gilman trail this week?]]
[[File:Burke_gilman.jpg|thumb|right|250px|Who's riding on the Burke Gilman trail this week?]]


In this project, we will gather civic data from [https://data.seattle.gov data.seattle.gov] and use it to ask and answer important questions about the Emerald City!. We will start with a series of analyses of bike and pedestrian traffic patterns on the [https://en.wikipedia.org/wiki/Burke-Gilman_Trail]. We will learn how to collect that data from the Seattle's open data portal's API, filter and transform this data, and create timeseries graphs that show daily, weekly, and yearly traffic trends.
In this project, we will gather civic data from [https://data.seattle.gov data.seattle.gov] and use it to ask and answer important questions about the Emerald City!. We will start with a series of analyses of bike and pedestrian traffic patterns on the [https://en.wikipedia.org/wiki/Burke-Gilman_Trail Burke-Gilman Trail].  


TO FILL IN [[User:Jtmorgan|Jtmorgan]] ([[User talk:Jtmorgan|talk]]) 16:57, 20 January 2020 (EST)
We will learn how to collect that data from the Seattle's open data portal's API, filter and transform this data, and create timeseries graphs that show daily, weekly, and yearly traffic trends.


== Goals ==
== Goals ==
Line 11: Line 11:
In this session, we will focus on...
In this session, we will focus on...


* Familiarizing ourselves with a new API
* Learn how to pose useful research questions that can be asked and answered with civic data
* Learn how to pose useful research questions that can be asked and answered with civic data
* Learn how to filter, bucket, and format data for building timeseries graphs in a spreadsheet program
* Learn how to filter, bucket, and format data for building timeseries graphs in a spreadsheet program
* Familiarizing ourselves with a new API
* Practice reading and extending other people's code
* Practice reading and extending other people's code


Line 26: Line 26:
;Test an API call to data.seattle.gov
;Test an API call to data.seattle.gov


Open the Jupyter notebook FOO
#Open the Jupyter notebook <tt>SODA_API_demo.ipynb</tt>
 
#Run the first code cell in the notebook
Run the first X cells in the notebook in order
 
The output of cell FIXME should be
example output
 
;Test downloading a CSV file and opening it in a notebook
 
Open FIXMELINK in your browser
 
CLICK on DOWNLOADBUTTON FIXME
 
SAVE FIXME.csv to the FIXME directory with your notebooks
 
OPEN the Juypyter notebook FOO
 
Run the first X cells of the notebook in order


The output of the cell FIXME should be
The output of cell should look like:
  example output
   
"https://data.seattle.gov/resource/76t5-zqzr.json?$where=(PermitNum='6531736-PH')"
[{'applieddate': '2016-10-07',
  'contractorcompanyname': 'M A MORTENSON COMPANY',
  'description': 'Construct institutional building (University of Washington, '
                'Computer Science and Engineering Dept.), occupy per plan.',
  'estprojectcost': '23886804',
  'expiresdate': '2020-04-03',
  'housingunitsadded': '0',
  'housingunitsremoved': '0',
  'issueddate': '2017-04-03',
  'latitude': '47.65300378',
  'link': {'url': 'https://cosaccela.seattle.gov/portal/customize/LinkToRecord.aspx?altId=6531736-PH'},
  'location1': {'human_address': '{"address": "3800 EAST STEVENS WAY NE", '
                                '"city": "SEATTLE", "state": "WA", "zip": '
                                '"98195"}',
                'latitude': '47.65300378',
                'longitude': '-122.30500427'},
  'longitude': '-122.30500427',
  'originaladdress1': '3800 EAST STEVENS WAY NE',
  'originalcity': 'SEATTLE',
  'originalstate': 'WA',
  'originalzip': '98195',
  'permitclass': 'Institutional',
  'permitclassmapped': 'Non-Residential',
  'permitnum': '6531736-PH',
  'permittype': 'Building',
  'permittypedesc': 'New',
  'statuscurrent': 'Completed'}]


== Socrata API tutorial ==
== Socrata API tutorial ==

Revision as of 19:28, 14 February 2020

Who's riding on the Burke Gilman trail this week?

In this project, we will gather civic data from data.seattle.gov and use it to ask and answer important questions about the Emerald City!. We will start with a series of analyses of bike and pedestrian traffic patterns on the Burke-Gilman Trail.

We will learn how to collect that data from the Seattle's open data portal's API, filter and transform this data, and create timeseries graphs that show daily, weekly, and yearly traffic trends.

Goals

In this session, we will focus on...

  • Learn how to pose useful research questions that can be asked and answered with civic data
  • Learn how to filter, bucket, and format data for building timeseries graphs in a spreadsheet program
  • Familiarizing ourselves with a new API
  • Practice reading and extending other people's code

Setup

If you are confused by these steps, go back and refresh your memory with the Day 0 setup and tutorial.

Download the Seattle open data project

  1. Click the following link and save the file to your computer: https://github.com/jtmorgan/cdsw-2020/archive/master.zip
  2. Unzip cdsw-2020-master.zip folder and place the folder in your CDSW working directory (or just your desktop)

Test the Seattle open data API

Test an API call to data.seattle.gov
  1. Open the Jupyter notebook SODA_API_demo.ipynb
  2. Run the first code cell in the notebook

The output of cell should look like:

"https://data.seattle.gov/resource/76t5-zqzr.json?$where=(PermitNum='6531736-PH')"

[{'applieddate': '2016-10-07',

 'contractorcompanyname': 'M A MORTENSON COMPANY',
 'description': 'Construct institutional building (University of Washington, '
                'Computer Science and Engineering Dept.), occupy per plan.',
 'estprojectcost': '23886804',
 'expiresdate': '2020-04-03',
 'housingunitsadded': '0',
 'housingunitsremoved': '0',
 'issueddate': '2017-04-03',
 'latitude': '47.65300378',
 'link': {'url': 'https://cosaccela.seattle.gov/portal/customize/LinkToRecord.aspx?altId=6531736-PH'},
 'location1': {'human_address': '{"address": "3800 EAST STEVENS WAY NE", '
                                '"city": "SEATTLE", "state": "WA", "zip": '
                                '"98195"}',
               'latitude': '47.65300378',
               'longitude': '-122.30500427'},
 'longitude': '-122.30500427',
 'originaladdress1': '3800 EAST STEVENS WAY NE',
 'originalcity': 'SEATTLE',
 'originalstate': 'WA',
 'originalzip': '98195',
 'permitclass': 'Institutional',
 'permitclassmapped': 'Non-Residential',
 'permitnum': '6531736-PH',
 'permittype': 'Building',
 'permittypedesc': 'New',
 'statuscurrent': 'Completed'}]

Socrata API tutorial

Datasets to explore

External links