Code Monkey home page Code Monkey logo

nyc-restaurant-inspection-records's Introduction

Screenshot of homepage

NYCFoodSafety.org

This repository contains the source for NYCFoodSafety.org, a Node.js application for finding New York City health violation citations for restaurants.

NYCFoodSafety.org provides users with a search form for finding restaurants by name and borough. An advanced search form allows users to find restaurants by ZIP code and cuisine type.

The application runs a Node.js server that queries a dataset updated daily by the city Department of Health and Mental Hygiene. The server then returns the search results to users. The live application is hosted on Heroku.

Requirements

External API Key

Getting Started

  • Register & Generate Socrata API key
  • API key referenced in token.js & module.exports = ###
  • npm install
  • npm start

Key Dependencies

Contributors

References

nyc-restaurant-inspection-records's People

Contributors

badwolfbit avatar codewritingcow avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

nyc-restaurant-inspection-records's Issues

Redesign search form

  • Make input field for restaurant name the biggest.
  • Decrease size of other input fields.
  • Add input validation. Mainly for ZIP code.

Make search form

Let user search for restaurants by parameters (i.e. business name, borough, cuisine, street address, critical/not critical violations, etc.) Related to Issue #3.

Replace Handlebars with React

As @OmenwolF suggests, we can replace Handlebars.js with React, converting the website into a single-page application. The goal is to reduce server requests for site rendering.

Improve server speed with Redis caching

When users search for a restaurant's records, the server should look for those records in the Redis cache first. If the records aren't there, only then would the server send a GET request to the external NYC Open Data API. This decreases the number of HTTP requests sent to the API.

Incorporate Socrata Open Data API

Let's use Socrata functions for querying inspection records by restaurant name or partial search term. The Socrata Open Data API is available for open-government databases maintained by NYC and other governments. Related to Issues #8 and #12

Currently, server.js returns up to 999 records that match query parameters such as borough and zipcode. server.js then filter those results by the name search term.

This process is flawed. The user might be looking for a restaurant that's not among those first 999 records.

The Socrata "like '...'" function solves this problem.

There is a specific endpoint for making queries with Socrata: https://data.cityofnewyork.us/resource/9w7m-hzhe.json

Query strings must be all uppercase. Ex. https://data.cityofnewyork.us/resource/9w7m-hzhe.json?$where=DBA like '%25SUSHI VILLAGE%25'

Searching for names with apostrophes causes error

If user searches for restaurants like Katz's, Socrata throws an error.

That's because in SoQL, string literals are created using a single quote ('). Socrata documentation says: "To escape a single quote within a string, double it."

Let's check if a name contains a single quote. If it does, then add another quote mark.

Related to issue #15.

Partial name search should return results

When users search for a restaurant by submitting only part of its name, the API should still return results. Ex. "Panda King " should return "Panda King Restaurant".

Currently, users must submit a restaurant's exact name, or they get a "no matching results" error.

Related to issue #7.

morgan middleware

morgan is set to 'dev' mode but runs on production

the issue arose during artillery.js test run and required middleware to be commented out due to a reduction of 12 RPS

Build API routes

Add routes for accessing and searching NYC's restaurant inspection database. Include calls to Yelp API. Related to issue #5.

Highlight navbar link for current page

Add active class to <li> tag in navbar to denote current page that user is on. Like this: <li class="active">

active is from the Materialize library.

Empty Results Page

Screenshot 2019-07-24 13 43 32

Results page are no longer being rendered due to a change on the OpenNYC database

Screen Shot 2019-07-24 at 1 37 08 PM

borough column is now empty

Make form for advanced search

Let users make searches with additional parameters (ZIP code, cuisine, etc.) This form would be different from the homepage's basic search form. It should be on its own page.

Should it have its own API route? Or should it still use the existing POST /search route?

See issue #23

Require users to include restaurant name in search form

Currently, users can use the search form on the homepage without including a restaurant name.

Let's require them to include a name in the search form. This is similar to the Better Business Bureau search form.

If they submit a query without a name, a modal with an error message should pop up. This is also similar to BBB's form.

See Issue #23

Unexpected search results

Currently, API returns a maximum of 999 reports per search. This can lead to unexpected results. Some examples:

  • If a user looks up "sushi" as the business name without giving additional parameters, the API returns a "no results found" error.
  • Searching for "Sushi Village" in "Queens" returns no results. But a search for "Sushi Village" in "11358" does return results.

Add neighborhood names

The NYC database does not have a restaurant's neighborhood (this would be the city/town in the mailing address.) It only has the building number, street name, ZIP code and borough.

This isn't helpful to users. Let's add neighborhood names to search results. Perhaps by using Google's geocoding API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.