One Thing Leads to Another

Tyler Field
Aug 23, 2017 · 4 min read

Sometimes I pose questions just to figure out if I can answer them.

It seemed to me lately that a lot of gas stations around San Francisco were closing. I had nothing to support this observation, so I set out to find evidence.

I wasn’t able to easily find a list of all the gas stations in the city, although granted I didn’t search that thoroughly. I suppose I could have made a list by scraping Yelp or Google Maps.

I ended up using DataSF, specifically the list of registered businesses that pay taxes to the city. The full dataset lists several properties of each business, including NAICS code and business license codes.

While NAICS codes are specific enough that (in theory) one could search for “447110 — Gasoline stations with convenience stores”, the NAICS codes listed on the portal are too general to search for specific business types; there are only 19 unique NAICS codes in the dataset, describing the industry category: “4200–4299: Wholesale Trade”, “4400–4599: Retail Trade”, “8100–8399: Certain Services”, etc.

Businesses requiring a special license — like for instance “D13 Motor Fuel Dispensing Facilities” — would likely not pay for such a license unless their business revolved around motor fuel dispensing, so searching for this license code is a good way to identify gas stations.

The registered businesses dataset also includes a field for “Business End Date” and “Location End Date”.

With this knowledge in hand, I was able to use the tools hosted within the DataSF portal to answer my original question: how many gas stations within the city have closed within the past five years?

Two, in fact.

So it turns out either:

  • not that many gas stations in SF closed in the past five years
  • not all gas stations have permits for either “motor fuel dispensing facilities” or “self-service motor fuel dispensing facilities”
  • the dataset isn’t complete

While it seems unlikely that the last case is true, searching for “D15 MOVIE / ASSEMBLY THEATRE” fails to turn up listings for the AMC Metreon/Van Ness/Kabuki, Castro Theater, or Century Centre. These movie theaters are instead licensed as “D04 PLACES OF PUBLIC ASSEMBLY & OPEN-AIR ASSEMBLY”. It appears there is some leeway with licensing in the city.

There are obviously limitations and to using proxy indicators. The records in this set were gathered for a different purpose, from the description on DataSF:

This dataset includes the locations of businesses that pay taxes to the City and County of San Francisco. Each registered business may have multiple locations and each location is a single row. The Treasurer & Tax Collector’s Office collects this data through business registration applications, account update/closure forms, and taxpayer filings. The data is collected to help enforce the Business and Tax Regulations Code including, but not limited to: Article 6, Article 12, Article 12-A, and Article 12-A-1. http://sftreasurer.org/registration


Regardless of my question being answered or not, I realized there was something really interesting about searching for businesses by their license codes. The built-in tools for investigating data within DataSF can be limited, however. I decided to build a tool that allows easy querying and reports some basic statistics and visualizations:

https://thfield.github.io/sf-businesses/

You can query by business license code and see a map, along with a count of businesses by supervisor district.

Some interesting license codes:

H73: DEEMED APPROVED OFF-SALE ALCOHOL USE
H72: MEDICAL CANNABIS DISPENSARY
H31: TOBACCO SALES W/O BOA SURCHARGE
H86 & H87: BARS/TAVERNS W/O FOOD PREP & BARS/TAVERNS W/FOOD PREP
H46 & H48: AUTO LAUNDRY MECH/PAY-TO-OPERATE WASHING/DYEING & WASH LAUNDRY

The tool I built is hosted at Github pages: https://thfield.github.io/sf-businesses/

)
Tyler Field

Written by

thinker, tinkerer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade