Files are found in the current directory, under the names setup.ipynb and analysis.ipynb.
Resources in the form of JSON are found in the resources folder.
The UK Food Standards Agency evaluates various establishments across the United Kingdom, and gives them a food hygiene rating. You've been contracted by the editors of a food magazine, Eat Safe, Love, to evaluate some of the ratings data in order to help their journalists and food critics decide where to focus future articles.
In this first portion, we upload the JSON data to the Mongo database and then query from the database to determine if the upload was successful.
We want to upload the JSON data entry for a new restaurant to the database:
{
"BusinessName":"Penang Flavours",
"BusinessType":"Restaurant/Cafe/Canteen",
"BusinessTypeID":"",
"AddressLine1":"Penang Flavours",
"AddressLine2":"146A Plumstead Rd",
"AddressLine3":"London",
"AddressLine4":"",
"PostCode":"SE18 7DY",
"Phone":"",
"LocalAuthorityCode":"511",
"LocalAuthorityName":"Greenwich",
"LocalAuthorityWebSite":"http://www.royalgreenwich.gov.uk",
"LocalAuthorityEmailAddress":"health@royalgreenwich.gov.uk",
"scores":{
"Hygiene":"",
"Structural":"",
"ConfidenceInManagement":""
},
"SchemeType":"FHRS",
"geocode":{
"longitude":"0.08384000",
"latitude":"51.49014200"
},
"RightToReply":"",
"Distance":4623.9723280747176,
"NewRatingPending":True
}
We have certain questions we want to answer:
-
Which establishments have a hygiene score of 20?
-
Which establishments in London have a
RatingValue
greater than or equal to 4? -
What are the top 5 establishments with a
RatingValue
of 5, sorted by lowest hygiene score, nearest to the new restuarant added, "Penang Flavours"? -
How many establishments in each Local Authority area have a hygiene score of 0? Sort the results from highest to lowest, and print out the top ten local authority areas.