--- license: apache-2.0 language: - en --- # Whatscooking.restaurants ## Overview This dataset provides detailed information about various restaurants, including their location, cuisine, ratings, and other attributes. It is particularly useful for applications in food and beverage industry analysis, recommendation systems, and geographical studies. ## Dataset Structure Each record in the dataset represents a single restaurant and contains the following fields: - `_id`: A unique identifier for the restaurant record. - `address`: An object containing the building number, coordinates, street, and zipcode of the restaurant. - `borough`: The borough in which the restaurant is located. - `cuisine`: The type of cuisine offered by the restaurant. - `name`: The name of the restaurant. - `restaurant_id`: A unique restaurant ID. - `location`: Geolocation data of the restaurant, in `Point` format. - `stars`: The star rating of the restaurant. - `review_count`: Number of reviews the restaurant has received. - `attributes`: Various attributes of the restaurant, such as `GoodForKids`, `RestaurantsDelivery`, `NoiseLevel`, etc. - `PriceRange`: The price range of the restaurant. - `OutdoorSeating`: Indicates whether the restaurant has outdoor seating. - `HappyHour`: Indicates whether the restaurant offers a happy hour. - `TakeOut`: Indicates whether the restaurant offers takeout services. - `DogsAllowed`: Indicates whether dogs are allowed in the restaurant. - `embedding`: A list of numerical values representing the embedding of the menu and attributes. ## Field Details ### Address Object - `building`: Building number. - `coord`: Array containing longitude and latitude. - `street`: Street name. - `zipcode`: Postal code. ### Location Object - `type`: Type of the geolocation data, typically `"Point"`. - `coordinates`: Array containing longitude and latitude. ### Attributes Object - This object contains several boolean and string fields representing various features and services of the restaurant, such as `GoodForKids`, `RestaurantsDelivery`, `NoiseLevel`, etc. ### Embedding Field - Generated by OpenAI `text-embedding-3-small` with 256 elements. This field consists of an array of floating point numbers. It represents a combined embedding of the restaurant's menu and attributes, useful for similarity searches and machine learning applications. ## Usage This dataset can be utilized for various purposes, including but not limited to: - Analysis of restaurant trends in different boroughs. - Development of recommendation systems based on cuisine, attributes, and location. - Geospatial analysis of restaurant distributions. ## Notes - The dataset is provided "as is" and is intended for informational purposes only. - Users are advised to consider the implications of the embedded data and its use in their applications. ### Sample Document ``` { "_id": { "$oid": "6095a34a7c34416a90d3209e" }, "address": { "building": "17", "coord": [ -74.1350211, 40.6369042 ], "street": "Harrison Avenue", "zipcode": "10302" }, "borough": "Staten Island", "cuisine": "American", "name": "Buddy'S Wonder Bar", "restaurant_id": "40367442", "location": { "type": "Point", "coordinates": [ -74.1350211, 40.6369042 ] }, "stars": 3.5, "review_count": 62, "attributes": { "BikeParking": "True", "RestaurantsReservations": "True", "RestaurantsTableService": "True", "RestaurantsAttire": "'casual'", "Alcohol": "'beer_and_wine'", "RestaurantsGoodForGroups": "True", "GoodForKids": "True", "BusinessParking": "{'garage': False, 'street': True, 'validated': False, 'lot': True, 'valet': False}", "WiFi": "u'free'", "HasTV": "True", "RestaurantsDelivery": "True", "WheelchairAccessible": "True", "NoiseLevel": "u'average'", "GoodForMeal": "{'dessert': False, 'latenight': False, 'lunch': True, 'dinner': True, 'brunch': False, 'breakfast': False}", "Ambience": "{'romantic': False, 'intimate': False, 'classy': False, 'hipster': False, 'divey': False, 'touristy': False, 'trendy': False, 'upscale': False, 'casual': True}" }, "menu": [ "Grilled cheese sandwich", "Baked potato", "Lasagna", "Mozzarella sticks", "Mac & cheese", "Chicken fingers", "Mashed potatoes", "Chicken pot pie", "Green salad", "Meatloaf", "Tomato soup", "Onion rings" ], "PriceRange": 2, "OutdoorSeating": true, "HappyHour": null, "TakeOut": true, "DogsAllowed": true, "embedding": [ -0.11977468, -0.02157107, ... ] } ``` ## Ingest Data The small script `ingest.py` can be used to load the data into your MongoDB Atlas cluster. ``` pip install pymongo pip install datasets ## export MONGODB_ATLAS_URI= ``` The `ingest.py`: ```python import os from pymongo import MongoClient import datasets from datasets import load_dataset from bson import json_util uri = os.environ.get('MONGODB_ATLAS_URI') client = MongoClient(uri) db_name = 'whatscooking' collection_name = 'restaurants' restaurants_collection = client[db_name][collection_name] dataset = load_dataset("MongoDB/whatscooking.restaurants") insert_data = [] for restaurant in dataset['train']: doc_restaurant = json_util.loads(json_util.dumps(restaurant)) insert_data.append(doc_restaurant) if len(insert_data) == 1000: restaurants_collection.insert_many(insert_data) print("1000 records ingested") insert_data = [] if len(insert_data) > 0: restaurants_collection.insert_many(insert_data) insert_data = [] print("Data Ingested") ``` ## Contact For any queries or further information regarding this dataset, please open a disucssion.