↞ My work

The imperative of local, fresh food: visualizing farmer’s markets

I created a web-based app for searching for farmers markets using the USDA National Farmers Market Directory API, bolstering the data with Google’s Places API.

View the code on GitHub

View the app

Context: Independent experiment

Time: 2 weeks

Team: Individual

Tools: Javascript (D3.js, Google Places API, USDA farmers markets API), R, Adobe Illustrator

Eating as a political act

As evidenced by the uptick in farmer’s markets over the last 20 years, people are increasingly contemplative and politically motivated when choosing the food they eat. Michael Pollan describes, in The Omnivore’s Dilemma, the “comsumer who understands–or remembers–that, in Wendell Berry’s memorable phrase, ‘eating is an agricultural act.’ He might have added that it’s a political act as well” [1].

Pollan writes  “…shopping locally underwrites a whole set of other values as well. That’s because farms produce a lot more than food; they also produce a kind of landscape and a kind of community” [1].

The challenge

How does one actually re-imagine their food acquisition and consumption?

These ideals are compelling in theory. However, executing them is a harder task to accomplish. When I first moved to the D.C. area, I was somewhat overwhelmed by the decision fatigue of selecting a local source of food. Should I elect to subscribe to a CSA? Should I consistently attend a farmer’s market? What are all of my options?

At the core was a frustration with finding which farmers markets were actually in my area. Over the course of several seasons, I spent an unreasonable amount of time searching the internet for farmers markets. I encountered several local government websites with listings either outdated, without indication of how far away these markets even were. I couldn’t find a tool to help me locate farmers markets with ease.

At the time, I hadn’t realized the USDA actually released an API for their database of farmer’s markets in 2013, which is accompanied by a tool to search the database (the USDA farmers market directory):

However, the interface leaves a bit to be desired in terms of usability:

  • You can only search by zip code
  • You must open a new web page to view the results displayed on a map
  • I found several farmers were no longer operating
  • You can’t sort results by distance
  • Your searched location is not visible on the map

My goal was to create a tool to access this API, using Google’s Places API to bolster the data with distance, opening hours, and other relevant information.

The data

USDA API

The USDA API provides one endpoint for getting a list of farmers markets (without details) within an unspecified radius of a location (zip code or latitude, longitude) and another for providing details of a farmers market (including opening times and months, address, and products sold).

However, I noticed several problems with the data:

  • The opening times and months of the farmers markets were not formatted consistently. For example, some dates were formatted “MM/DD/YYYY” and others “June to July.” Sometimes time information would be included, but was mixed in with the date information, creating an issue for parsing open hours and months.
  • Some of the data was outdated; some farmer markets with outdated listings were still in operation, and others were actually closed for good.
  •  The API does not provide the website for any listing, despite providing a listing on their website.
  • Some farmers markets were duplicated in the database with slightly different names

Google Places

There were challenges combining Google Places data with the USDA data:

  • Farmer’s markets were occasionally named differently across data sets, necessitating code for determining if two places were referring to the same farmer’s market.
  • The Google Places API has a strict upper limit for the amount of free queries; thus

I was surprised to notice Google (and even Yelp) didn’t have a record of plenty of operating farmers markets that the USDA did have a record of, despite the questionable veracity and out of date nature of the USDA data.

Soilmate

Soilmate is a resource for finding local vendors. To be listed, you must sign up and maintain a profile. I attempted to locate API endpoints to add markets possibly not listed in the USDA database, however couldn’t find an API!

Final result

Sources

  1. Pollan, M. (2006). The omnivore’s dilemma: A natural history of four meals (pp. 258-259). Penguin.