Skip to content

Instantly share code, notes, and snippets.

@jboursiquot
Last active September 3, 2019 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jboursiquot/bdda4c1faad9f4b22a3910cdb885b4de to your computer and use it in GitHub Desktop.
Save jboursiquot/bdda4c1faad9f4b22a3910cdb885b4de to your computer and use it in GitHub Desktop.
Baltimore Go Challenge for September 3rd, 2019 Meeting: Consume Maryland's Road Closures

Challenge: Consume Maryland's Road Closures

The state of MD exposes road closure data for you to do with whatever you'd like. Today, you'd like to fetch it and save it locally in a relational database (maybe sqlite?).

Head over to the site to explore the data.

Your mission (and success criteria):

  1. Consume the JSON endpoint for that data: https://opendata.maryland.gov/resource/nigh-m2sg.json
  2. Successfully parse each "closure" including its lat/long data, timestamps, etc.
  3. Save each closure as a record in a local relational database.
  4. Retrieve all of the data from storage to display on the console.

You may produce one (or two) command line tools to do the saving and displaying.

Learning objectives:

  • Use net/http to retrieve external data
  • Use encoding/json to unmarshal data
  • Use the appropriate interfaces to help with JSON unmarshaling
  • Use the database/sql package and a driver of your choice to store and retrieve data
  • Use the testing package to test the retrieval code locally (without actually hitting the JSON endpoint)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment