File size: 5,777 Bytes
af2a473
 
bdd3379
 
af2a473
d928dd3
1fab81e
d928dd3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bdd3379
d928dd3
 
 
 
 
 
 
 
 
 
 
 
 
 
62d03ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fce9678
 
6c3ce28
fce9678
 
24c5567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8b6fb2
24c5567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fce9678
 
d928dd3
 
62d03ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
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=<your 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.