Where to Find a Clean Restaurant in San Francisco

Xiaoyu Yang
Posted on Feb 9, 2018


The Department of Public Health in San Francisco conducts unannounced inspections of restaurants at least once a year. It checks food handling, food temperature, personal hygiene, and vermin control and gives restaurants inspection scores. Unlike New York City, where the higher the letter, the worse the score, in San Francisco, the higher inspection score means indicates  more sanitary conditions. My purpose of developing this shiny app is to help the users find clean restaurants in San Francisco.

The inspection data used was obtained from Kaggle.com. The dataset contains the name, address, zip code, phone number and inspection score of each inspected restaurant in San Francisco.


1. Find clean restaurants by inspection score and emoji

On the first map, I categorized the restaurants by their inspection score and added them to the map. To show the restaurant score at a glance, I opted for emojis. My first idea was to plot restaurants using different colors to represent different categories of inspection score. However, I changed my mind after noticing that users may have their own preconceptions about what colors means. I saw a map online  that  used blue and red to represent clean and unclean. When I first looked at that map, I thought blue markers represented the clean restaurants and red markers represented unclean restaurants. When I realized that the author intended it the other way around, I thought that in order to avoid possible confusion, I would use graphic icons to represent restaurant rankings rather than colors.

The restaurant with an inspection score between 100 and 90 is thumbs-up, meaning that that is a very clean restaurant. When you zoom in on the map, you will see the name, address, score and phone number, in case you plan to make a reservation. I used a smiley face to represent restaurants with score between 89 and 80, which means that this place is clean enough to eat in. For restaurants with score 79 to 70, I used fearful face, meaning that you should probably not go there. For restaurants with score below 70, I used vomiting face, which is pretty intuitive and self-explanatory representation of why you should never go to those restaurants.

2. Find clean restaurants by zip code

On the second map, I grouped the restaurants by their zip code. Knowing what restaurants are available to you is one consideration when moving to a new neighborhood. When you use my app, simply select the zip code; it will show you how many restaurants have thumbs-up, smiley face, fearful face, and vomiting face. In fact, you can get the exact number of restaurants in each category from the info boxes.

3. Top five most and least sanitary foodie streets in San Francisco

On the third map, I plotted the top five most sanitary foodie streets and the five least sanitary foodie streets in San Francisco. To do this, I grouped the restaurants by their street name and took the median of restaurants’ inspection scores for each street. Using this map, it is very easy to find the most sanitary foodie streets and the least sanitary foodie streets. If you were to hang out with your friends in San Francisco on a Friday night, you wouldn’t want to go to a street that is full of unclean restaurants, right?

This is my app, if you would like to find a nice, clean restaurant in San Francisco, please use this app.

See my Shiny App here.

About Author

Xiaoyu Yang

Xiaoyu Yang

Xiaoyu received his Ph.D. in Pharmaceutical Sciences from North Dakota State University. For his research, he designed and conducted a variety of experiments to improve current treatments for pancreatic cancer. He developed his interest in math and statistics...
View all posts by Xiaoyu Yang >

Related Articles

Leave a Comment

Your email address will not be published. Required fields are marked *

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags