Skip to content

Instantly share code, notes, and snippets.

@mheadd
Last active November 12, 2015 20:19
Show Gist options
  • Save mheadd/41d958963e1e72f7fe19 to your computer and use it in GitHub Desktop.
Save mheadd/41d958963e1e72f7fe19 to your computer and use it in GitHub Desktop.
Chunked Transfer Encoding Example
var mysql = require('mysql');
var express = require('express');
var query_base = 'SELECT * from inspections WHERE FACILITY LIKE \'';
var connection = mysql.createConnection({
host: process.argv[2],
user: process.argv[3],
password: process.argv[4] || '',
database: 'Onondaga_County_Restaurant_Inspections'
});
connection.connect();
var app = express();
app.listen(4000);
app.get('/:name', function(req, res){
connection.query(query_base + req.params.name + '%\'', function(err, rows, fields) {
if (err) {
res.status(500).json({ error: err.message });
}
else {
res.set('Content-type: application/json');
res.send(rows);
}
});
});
app.get('/chunked/:name', function(req, res){
connection.query(query_base + req.params.name + '%\'')
.on('error', function(err) {
res.status(500).json({ error: err.message });
})
.on('fields', function(fields) {
res.set({'Content-type': 'application/json', 'Transfer-encoding': 'chunked'});
res.write('[');
})
.on('result', function(row) {
res.write(JSON.stringify(row) + ',');
})
.on('end', function() {
res.end('{"success": true}]');
});
});
DROP DATABASE IF EXISTS Onondaga_County_Restaurant_Inspections;
CREATE DATABASE Onondaga_County_Restaurant_Inspections;
USE Onondaga_County_Restaurant_Inspections;
DROP TABLE IF EXISTS inspections;
CREATE TABLE `inspections` (
FACILITY VARCHAR(36) NOT NULL,
ADDRESS VARCHAR(44) NOT NULL,
LAST_INSPECTED DATE NOT NULL,
VIOLATIONS VARCHAR(2015) NOT NULL,
TOTAL_NUM_CRITICAL_VIOLATIONS INTEGER NOT NULL,
TOTAL_NUM_CRIT_NOT_CORRECTED INTEGER NOT NULL,
TOTAL_NUM_NONCRITICAL_VIOLATIONS INTEGER NOT NULL,
DESCRIPTION VARCHAR(67) NOT NULL,
LOCAL_HEALTH_DEPARTMENT VARCHAR(15) NOT NULL,
COUNTY VARCHAR(8) NOT NULL,
FACILITY_ADDRESS VARCHAR(34) NOT NULL,
CITY VARCHAR(17) NOT NULL,
ZIP_CODE INTEGER NOT NULL,
NYSDOH_GAZETTEER_1980 INTEGER NOT NULL,
MUNICIPALITY VARCHAR(15) NOT NULL,
OPERATION_NAME VARCHAR(50) NOT NULL,
PERMIT_EXPIRATION_DATE DATE,
PERMITTED_DBA VARCHAR(32),
PERMITTED_CORP_NAME VARCHAR(50),
PERM_OPERATOR_LAST_NAME VARCHAR(30),
PERM_OPERATOR_FIRST_NAME VARCHAR(15),
NYS_HEALTH_OPERATION_ID INTEGER NOT NULL,
INSPECTION_TYPE VARCHAR(13) NOT NULL,
INSPECTOR_ID VARCHAR(32),
INSPECTION_COMMENTS VARCHAR(1308),
FOOD_SERVICE_FACILITY_STATE VARCHAR(2) NOT NULL,
Location1 VARCHAR(23) NOT NULL
);
LOAD DATA INFILE '/path/to/Onondaga_County_Restaurant_Inspections_clean.csv' INTO TABLE inspections
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(FACILITY,ADDRESS,LAST_INSPECTED,VIOLATIONS,TOTAL_NUM_CRITICAL_VIOLATIONS,TOTAL_NUM_CRIT_NOT_CORRECTED,TOTAL_NUM_NONCRITICAL_VIOLATIONS,DESCRIPTION,LOCAL_HEALTH_DEPARTMENT,COUNTY,FACILITY_ADDRESS,CITY,ZIP_CODE,NYSDOH_GAZETTEER_1980,MUNICIPALITY,OPERATION_NAME,PERMIT_EXPIRATION_DATE,PERMITTED_DBA,PERMITTED_CORP_NAME,PERM_OPERATOR_LAST_NAME,PERM_OPERATOR_FIRST_NAME,NYS_HEALTH_OPERATION_ID,INSPECTION_TYPE,INSPECTOR_ID,INSPECTION_COMMENTS,FOOD_SERVICE_FACILITY_STATE,Location1);
FACILITY ADDRESS LAST_INSPECTED VIOLATIONS TOTAL_NUM_CRITICAL_VIOLATIONS TOTAL_NUM_CRIT_NOT_CORRECTED TOTAL_NUM_NONCRITICAL_VIOLATIONS DESCRIPTION LOCAL_HEALTH_DEPARTMENT COUNTY FACILITY_ADDRESS CITY ZIP_CODE NYSDOH_GAZETTEER_1980 MUNICIPALITY OPERATION_NAME PERMIT_EXPIRATION_DATE PERMITTED_DBA PERMITTED_CORP_NAME PERM_OPERATOR_LAST_NAME PERM_OPERATOR_FIRST_NAME NYS_HEALTH_OPERATION_ID INSPECTION_TYPE INSPECTOR_ID INSPECTION_COMMENTS FOOD_SERVICE_FACILITY_STATE Location1
Abbotts Frozen Custard 4282 Fay ROAD, Syracuse 04/08/2015 No violations found. 0 0 0 Food Service Establishment - Ice Cream Store Onondaga County ONONDAGA 4282 Fay ROAD Syracuse 13219 336100 ONONDAGA Abbotts Frozen Custard 01/31/2016 Dixon & Knowles, LLC Dixon Douglas 535612 Inspection Conditions satisfactory to operate at this time. NY (43.027484, -76.217622)
Abbott's Village Tavern 6 EAST Main STREET, Marcellus 05/01/2015 Item 8D- Single service items reused, improperly stored, dispensed, not used when required; Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; 0 0 2 Food Service Establishment - Restaurant Onondaga County ONONDAGA 6 EAST Main STREET Marcellus 13108 336000 MARCELLUS Abbott's Village Tavern 01/31/2016 Abbott's Village Tavern, LLC Abbott Matthew 800917 Inspection NY (42.98241, -76.339477)
Abdullah Muslim Islamic Center 127 WEST Brighton AVENUE, Syracuse 10/27/2014 Item 4A- Critical Violation [RED] Toxic chemicals are improperly labeled, stored or used so that contamination of food can occur.; 1 0 0 Food Service Establishment - Food Service Establishment Onondaga County ONONDAGA 127 WEST Brighton AVENUE Syracuse 13205 330100 SYRACUSE Abdullah Muslim Islamic Center Abdullah Muslim Islamic Center 718444 Inspection NY (43.020464, -76.144507)
Acropolis Pizza 167-169 Marshall STREET, Syracuse 05/20/2015 Item 8A- Food not protected during storage, preparation, display, transportation and service, from potential sources of contamination (e.g., food uncovered, mislabeled, stored on floor, missing or inadequate sneeze guards, food containers double stacked); Item 11D- Non food contact surfaces of equipment not clean; Item 14B- Effective measures not used to control entrance (rodent-, insect-proof contruction). Harborage areas available for rodents, insects and other vermin; 0 0 4 Food Service Establishment - Restaurant Onondaga County ONONDAGA 167-169 Marshall STREET Syracuse 13210 330100 SYRACUSE Acropolis Pizza 01/31/2016 AEK 4 Ever, LTD Mavrikidis Panagiotis 292623 Re-Inspection Reinspection notes the majority of violations from the April 22, 2015 inspection have been corrected. Keep an eye on the potentially hazardous food items in the prep top portion of the sandwich cooler, noted between 45 - 47 F. Recommend abate. • NY (43.041645, -76.13517)
AFC Sushi @ LeMoyne College 1419 Salt Springs ROAD, Syracuse 10/30/2014 Item 8D- Single service items reused, improperly stored, dispensed, not used when required; 0 0 1 Food Service Establishment - Restaurant Onondaga County ONONDAGA 1419 Salt Springs ROAD Syracuse 13214 335300 DEWITT AFC Sushi @ LeMoyne College 01/31/2016 Advanced Fresh Concepts Franchise Corporation 814498 Inspection NY (43.04735, -76.088424)
AG Richardson VFW Post 153 50 Salina STREET, Baldwinsville 10/27/2015 No violations found. 0 0 0 Food Service Establishment - Food Service Establishment Onondaga County ONONDAGA 50 Salina STREET Baldwinsville 13027 335800 LYSANDER AG Richardson VFW Post 153 01/31/2016 AG Richardson VFW Post 153 292693 Inspection 2nd inspection today finds conditions satisfactory. Downstairs bar has been remodelled and all new plumbing and new bar, new walk in cooler, etc. Conditions are satisfactory to reopen the bar. All food prep surfaces will be cleaned and sanitized prior to first use. Bar had a fire last August of 2014. NY (43.156691, -76.321259)
Aherin's Pub at Split Rock 3855 Split Rock ROAD, Camillus 04/03/2015 Item 11A- Manual facilities inadequate, technique incorrect; mechanical facilities not operated in accordance with manufacturer's instructions; Item 11D- Non food contact surfaces of equipment not clean; Item 11D- Non food contact surfaces of equipment not clean; Item 15A- Floors, walls, ceilings, not smooth, properly constructed, in disrepair, dirty surfaces; Item 15A- Floors, walls, ceilings, not smooth, properly constructed, in disrepair, dirty surfaces; 0 0 5 Food Service Establishment - Restaurant Onondaga County ONONDAGA 3855 Split Rock ROAD Camillus 13031 336100 ONONDAGA Aherin's Pub at Split Rock 01/31/2016 Aherin Susan 535618 Inspection NY (43.021135, -76.246203)
Ale N'Angus Pub 238 Harrison STREET, Syracuse 08/27/2014 Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; Item 11D- Non food contact surfaces of equipment not clean; 0 0 2 Food Service Establishment - Restaurant Onondaga County ONONDAGA 238 Harrison STREET Syracuse 13202 330100 SYRACUSE Ale N'Angus Pub 01/31/2016 Beach 944 Enterprises, LLC 547688 Inspection NY (43.044229, -76.149754)
Allen Road Elementary School 803 ALLEN ROAD, NORTH SYRACUSE 10/16/2015 No violations found. 0 0 0 Institutional Food Service - School K-12 Food Service Onondaga County ONONDAGA 803 ALLEN ROAD NORTH SYRACUSE 13212 335200 CLAY Allen Road Elementary School 08/31/2016 North Syracuse Central School District Swift Wendy 466819 Inspection NY (43.131925, -76.156366)
Allison's Ice Cream 7382 Thompson ROAD, North Syracuse 05/04/2015 Item 8E- Accurate thermometers not available or used to evaluate refrigerated or heated storage temperatures; Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; Item 11D- Non food contact surfaces of equipment not clean; 0 0 5 Food Service Establishment - Ice Cream Store Onondaga County ONONDAGA 7382 Thompson ROAD North Syracuse 13212 335100 CICERO Allison's Ice Cream 01/31/2016 AZI Entertainment, Inc. 700755 Inspection NY (43.127914, -76.099432)
All Night Egg Plant 5781 Bridge STREET, East Syracuse 10/23/2015 No violations found. 0 0 0 Food Service Establishment - Restaurant Onondaga County ONONDAGA 5781 Bridge STREET East Syracuse 13057 335300 DEWITT All Night Egg Plant 01/31/2016 All Night Egg Plant, Inc. 293664 Re-Inspection Reinspection notes the violation from the August 25, 2015 inspection has been corrected. Approximately one half of a flat of raw whole shell eggs noted at cookline at 60 degrees F for less than two hours - will be served immediately. Recommend abate. NY (43.051221, -76.070498)
All Saints Elementary School of Tipp 112 SOUTH WILBUR STREET, SYRACUSE 04/15/2015 Item 12E- Handwashing facilities inaccessible, improperly located, dirty, in disrepair, improper fixtures, soap, and single service towels or hand drying devices missing; 0 0 1 Institutional Food Service - School K-12 Food Service Onondaga County ONONDAGA 112 SOUTH WILBUR STREET SYRACUSE 13204 330100 SYRACUSE All Saints Elementary School of Tipp 588718 Inspection NY (43.048431, -76.179982)
All Sanits Church 112 Lancaster PLACE, Syracuse 10/19/2015 Item 4A- Critical Violation [RED] Toxic chemicals are improperly labeled, stored or used so that contamination of food can occur.; 1 0 0 Food Service Establishment - Food Service Establishment Onondaga County ONONDAGA 112 Lancaster PLACE Syracuse 13210 330100 SYRACUSE All Sanits Church 01/31/2017 All Sanits Parish 800972 Inspection Establishment has probe/metal-stem type food thermometer onsite. (Church offices have moved to alternate location. Mailing address has changed.) NY (43.027466, -76.122266)
Almus Oliver Tower 300 Burt STREET, Syracuse 03/19/2015 Item 2E- Critical Violation [RED] Accurate thermometers not available or used to evaluate potentially hazardous food temperatures during cooking, cooling, reheating and holding.; Item 12D- Toilet facilities inadequate, inconvenient, dirty, in disrepair, toilet paper missing, not self-closing doors, missing hand wash signs; 1 0 1 SOFA Food Service - SOFA Prep Site-State Office for the Aging Onondaga County ONONDAGA 300 Burt STREET Syracuse 13202 330100 SYRACUSE Almus Oliver Tower 01/31/2017 Syracuse Housing Authority Brown Loretta 564663 Inspection Reinspection only to pick up spare thermometer and assess functionality of new thermometer at facility. NY (43.038169, -76.147263)
Almus Oliver Tower 300 Burt STREET, Syracuse 03/19/2015 No violations found. 0 0 0 SOFA Food Service - SOFA Prep Site-State Office for the Aging Onondaga County ONONDAGA 300 Burt STREET Syracuse 13202 330100 SYRACUSE Almus Oliver Tower 01/31/2017 Syracuse Housing Authority Brown Loretta 564663 Re-Inspection Reinspection to retrieve spare thermometer and check calibration on new thermometer at facility. Calibration is within acceptable limits +/- 2 degrees. NY (43.038169, -76.147263)
Alpine (The) 401 Butternut STREET, Syracuse 10/09/2014 Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; Item 11D- Non food contact surfaces of equipment not clean; Item 12D- Toilet facilities inadequate, inconvenient, dirty, in disrepair, toilet paper missing, not self-closing doors, missing hand wash signs; Item 15B- Lighting and ventilation inadequate, fixtures not shielded, dirty ventilation hoods, ductwork, filters, exhaust fans; 0 0 5 Food Service Establishment - Tavern Onondaga County ONONDAGA 401 Butternut STREET Syracuse 13208 330100 SYRACUSE Alpine (The) 01/31/2016 J. A. Rogar, Inc. 294754 Inspection NY (43.058675, -76.149898)
Al's Village Diner 508 WEST Manlius STREET, East Syracuse 10/20/2015 Item 5C- Critical Violation [RED] Potentially hazardous foods are not stored under refrigeration except during necessary preparation or approved precooling procedures (room temperature storage).; Item 11D- Non food contact surfaces of equipment not clean; Item 15A- Floors, walls, ceilings, not smooth, properly constructed, in disrepair, dirty surfaces; 1 0 7 Food Service Establishment - Restaurant Onondaga County ONONDAGA 508 WEST Manlius STREET East Syracuse 13057 335300 DEWITT Al's Village Diner 01/31/2016 Central N.Y. Bakery and Deli, Inc. Burns, Sr. Al 555480 Inspection NY (43.06501, -76.077868)
Al's Wine & Whiskey Lounge 321 SOUTH Clinton STREET, Syracuse 10/14/2014 Item 1H- Critical Violation [RED] Food from unapproved source, spoiled, adulterated on premises.; Item 8E- Accurate thermometers not available or used to evaluate refrigerated or heated storage temperatures; Item 10B- Non-food contact surfaces and equipment are improperly designed, constructed, installed, maintained (equipment not readily accessible for cleaning, surface not smooth finish); Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; Item 11D- Non food contact surfaces of equipment not clean; Item 12E- Handwashing facilities inaccessible, improperly located, dirty, in disrepair, improper fixtures, soap, and single service towels or hand drying devices missing; Item 15A- Floors, walls, ceilings, not smooth, properly constructed, in disrepair, dirty surfaces; Item 15B- Lighting and ventilation inadequate, fixtures not shielded, dirty ventilation hoods, ductwork, filters, exhaust fans; 1 0 10 Food Service Establishment - Tavern Onondaga County ONONDAGA 321 SOUTH Clinton STREET Syracuse 13202 330100 SYRACUSE Al's Wine & Whiskey Lounge 01/31/2016 Smokin Whiskey, LLC 556889 Inspection NY (43.0485, -76.153485)
Alto Cinco 524-526 Westcott STREET, Syracuse 10/28/2015 Item 5B- Critical Violation [RED] Potentially hazardous foods are not cooled by an approved method where the food temperature can be reduced from 120oF to 70oF or less within two hours and 70oF to 45oF within four hours.; Item 8A- Food not protected during storage, preparation, display, transportation and service, from potential sources of contamination (e.g., food uncovered, mislabeled, stored on floor, missing or inadequate sneeze guards, food containers double stacked); Item 10B- Non-food contact surfaces and equipment are improperly designed, constructed, installed, maintained (equipment not readily accessible for cleaning, surface not smooth finish); Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; Item 11D- Non food contact surfaces of equipment not clean; Item 12E- Handwashing facilities inaccessible, improperly located, dirty, in disrepair, improper fixtures, soap, and single service towels or hand drying devices missing; Item 15A- Floors, walls, ceilings, not smooth, properly constructed, in disrepair, dirty surfaces; Item 15B- Lighting and ventilation inadequate, fixtures not shielded, dirty ventilation hoods, ductwork, filters, exhaust fans; 1 0 9 Food Service Establishment - Restaurant Onondaga County ONONDAGA 524-526 Westcott STREET Syracuse 13210 330100 SYRACUSE Alto Cinco 01/31/2016 Alto Cinco, Inc. 293707 Inspection NY (43.040993, -76.119369)
Alvord House 5 EAST Main STREET, Marcellus 05/01/2015 Item 8A- Food not protected during storage, preparation, display, transportation and service, from potential sources of contamination (e.g., food uncovered, mislabeled, stored on floor, missing or inadequate sneeze guards, food containers double stacked); Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; Item 11D- Non food contact surfaces of equipment not clean; Item 15A- Floors, walls, ceilings, not smooth, properly constructed, in disrepair, dirty surfaces; 0 0 5 Food Service Establishment - Restaurant Onondaga County ONONDAGA 5 EAST Main STREET Marcellus 13108 336000 MARCELLUS Alvord House 01/31/2016 The Alvord House, Inc. 292694 Inspection NY (42.982519, -76.339483)
Amber Inn 2424 Otisco Valley ROAD, Marietta 06/19/2015 Item 8A- Food not protected during storage, preparation, display, transportation and service, from potential sources of contamination (e.g., food uncovered, mislabeled, stored on floor, missing or inadequate sneeze guards, food containers double stacked); Item 8E- Accurate thermometers not available or used to evaluate refrigerated or heated storage temperatures; Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; Item 15A- Floors, walls, ceilings, not smooth, properly constructed, in disrepair, dirty surfaces; Item 15A- Floors, walls, ceilings, not smooth, properly constructed, in disrepair, dirty surfaces; 0 0 5 Food Service Establishment - Restaurant Onondaga County ONONDAGA 2424 Otisco Valley ROAD Marietta 13110 336200 OTISCO Amber Inn 01/31/2016 Amber Inn, Inc. 293057 Inspection NY (42.888239, -76.296778)
America Diner 214 Oswego STREET, Liverpool 11/04/2014 Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; Item 11D- Non food contact surfaces of equipment not clean; Item 15A- Floors, walls, ceilings, not smooth, properly constructed, in disrepair, dirty surfaces; 0 0 3 Food Service Establishment - Restaurant Onondaga County ONONDAGA 214 Oswego STREET Liverpool 13088 336400 SALINA American Diner 01/31/2016 American Diner NY, Inc. Tassone Michael 539218 Inspection NY (43.101048, -76.200585)
American Legion Post #113 8529 Smokey Hollow ROAD, Baldwinsville 03/27/2015 Item 8A- Food not protected during storage, preparation, display, transportation and service, from potential sources of contamination (e.g., food uncovered, mislabeled, stored on floor, missing or inadequate sneeze guards, food containers double stacked); Item 11D- Non food contact surfaces of equipment not clean; 0 0 2 Food Service Establishment - Restaurant Onondaga County ONONDAGA 8529 Smokey Hollow ROAD Baldwinsville 13027 335800 LYSANDER American Legion Post #113 01/31/2016 American Legion Post #113 292695 Inspection NY (43.18376, -76.340903)
American Legion Post # 1361 1951 WEST Fayette STREET, Syracuse 10/13/2015 Item 11B- Wiping cloths dirty, not stored properly in sanitizing solutions; Item 11C- Food contact surfaces not washed, rinsed and sanitized after each use and following any time of operations when contamination may have occurred; Item 15B- Lighting and ventilation inadequate, fixtures not shielded, dirty ventilation hoods, ductwork, filters, exhaust fans; 0 0 4 Food Service Establishment - Food Service Establishment Onondaga County ONONDAGA 1951 WEST Fayette STREET Syracuse 13204 330100 SYRACUSE American Legion Post # 1361 01/31/2016 American Legion Post # 1361 292589 Inspection NY (43.054691, -76.186122)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment