Data storage: Reading and writing to the file system, bronchi physician JSON
Getting data from a file or a database requires a solid understanding of arrays and loops. If you’re still unclear about arrays and loops, now is the time to review! Watch Chapter 4, “Working with Multiple Values in Arrays and Loops” in PHP for Web Designers on Lynda.com.
Some places to find data
Census
NYC Open Data
World Health Organization (WHO)
Any spreadsheet exported as a .csv file
See the Community Gardens example on github. Review the notes and videos from Week 3 if needed.
Homework
Reading & Writing
Art and the API, Jer Thorpe.
Check out some of the projects on Google’s DevArt that use APIs.
Write a brief response and brainstorm interesting, wacky, innovative ideas for projects using APIs — not something you’d make in this class (necessarily) but big ideas. For more info about APIs, see the “Tech prep” section below.
Production
Create an application that stores data in the file system in JSON or CSV format and retrieves that data for display on the front end. You may continue with your application from the past weeks or move forward with a new idea.
Due next week (2/25). Blog write-ups due 8pm Feb 24.
Tech prep for next week
APIs
- What is an API? video on Lynda.com (2m 43sec)
- Notes on JSON, XML, and APIs
- Using APIs
- About the Sunlight Foundation API: http://training.sunlightfoundation.com/module/unlocking-api/
PHP Object-Oriented Programming
PHP has an entire system of Object-Oriented programming, using classes and objects, similar to what you’ve seen in Processing. We’re not going to go deep into OOP in PHP in this class, but in order to parse JSON, which will be doing with APIs, you’ll need to be familiar at least with what an object looks like in PHP. For an overview of objects in PHP see this tutorial. Read at least through the section “Defining Class Methods”.