File size: 6,172 Bytes
6ad3446
 
 
 
 
 
 
 
 
 
 
 
 
 
b4e6eee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ad3446
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271748e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271a09d
271748e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ad3446
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
---
license: apache-2.0
language:
- en
tags:
- movies
---

## sample_mflix.embedded_movies

This data set contains details on movies with genres of Western, Action, or Fantasy. Each document contains a single movie, and information such as its title, release year, and cast.

In addition, documents in this collection include a plot_embedding field that contains embeddings created using OpenAI's text-embedding-ada-002 embedding model that you can use with the Atlas Search vector search feature.

## Overview

This dataset offers a comprehensive collection of data on various movies. It includes details such as plot summaries, genres, runtime, ratings, cast, and more. This dataset is ideal for movie recommendation systems, film analysis, and educational purposes in film studies.

## Dataset Structure

Each record in the dataset represents a movie and includes the following fields:

- `_id`: A unique identifier for the movie.
- `plot`: A brief summary of the movie's plot.
- `genres`: A list of genres associated with the movie.
- `runtime`: The runtime of the movie in minutes.
- `rated`: The MPAA rating of the movie.
- `cast`: A list of main actors in the movie.
- `num_mflix_comments`: The number of comments on the movie in the mflix platform.
- `poster`: A URL to the movie's poster image.
- `title`: The title of the movie.
- `lastupdated`: The last date and time when the movie information was updated.
- `languages`: The languages available in the movie.
- `directors`: A list of directors of the movie.
- `writers`: A list of writers of the movie.
- `awards`: Information about awards won and nominations.
- `imdb`: IMDb rating, votes, and ID.
- `countries`: A list of countries where the movie was produced.
- `type`: The type of record, in this case, `movie`.
- `tomatoes`: Ratings and reviews from Rotten Tomatoes.
- `plot_embedding`: An array of numerical values representing the plot embedding.

## Field Details

### Awards Object

- `wins`: The number of awards won.
- `nominations`: The number of awards the movie was nominated for.
- `text`: A text summary of the awards and nominations.

### IMDb Object

- `rating`: The IMDb rating.
- `votes`: The number of votes on IMDb.
- `id`: The IMDb ID of the movie.

### Tomatoes Object

- Contains viewer and critic ratings, reviews count, DVD release date, and production details.

### Plot Embedding

- An array representing a numerical embedding of the movie's plot. Useful for machine learning applications, like content-based filtering in recommendation systems.

## Usage

The dataset is suited for a range of applications, including:

- Analyzing trends in film genres and ratings over time.
- Building movie recommendation engines using plot embeddings and genres.
- Studying the correlation between cast/directors and movie success.
- Educational purposes in film studies and data analysis courses.

## Notes

- The data is provided as-is and intended for informational and educational purposes.
- Users should verify the accuracy of the information for any critical use-cases.


### Sample Document
```
{
  "_id": {
    "$oid": "573a1396f29313caabce582d"
  },
  "plot": "A young swordsman comes to Paris and faces villains, romance, adventure and intrigue with three Musketeer friends.",
  "genres": ["Action", "Adventure", "Comedy"],
  "runtime": {
    "$numberInt": "106"
  },
  "rated": "PG",
  "cast": ["Oliver Reed", "Raquel Welch", "Richard Chamberlain", "Michael York"],
  "num_mflix_comments": {
    "$numberInt": "0"
  },
  "poster": "https://m.media-amazon.com/images/M/MV5BODQwNmI0MDctYzA5Yy00NmJkLWIxNGMtYzgyMDBjMTU0N2IyXkEyXkFqcGdeQXVyMjI4MjA5MzA@._V1_SY1000_SX677_AL_.jpg",
  "title": "The Three Musketeers",
  "lastupdated": "2015-09-16 06:21:07.210000000",
  "languages": ["English"],
  "directors": ["Richard Lester"],
  "writers": ["George MacDonald Fraser (screenplay)", "Alexandre Dumas père (novel)"],
  "awards": {
    "wins": {
      "$numberInt": "4"
    },
    "nominations": {
      "$numberInt": "7"
    },
    "text": "Won 1 Golden Globe. Another 3 wins & 7 nominations."
  },
  "imdb": {
    "rating": {
      "$numberDouble": "7.3"
    },
    "votes": {
      "$numberInt": "11502"
    },
    "id": {
      "$numberInt": "72281"
    }
  },
  "countries": ["Spain", "USA", "Panama", "UK"],
  "type": "movie",
  "tomatoes": {
    "viewer": {
      "rating": {
        "$numberDouble": "3.5"
      },
      "numReviews": {
        "$numberInt": "9600"
      },
      "meter": {
        "$numberInt": "78"
      }
    },
    "dvd": {
      "$date": {
        "$numberLong": "982022400000"
      }
    },
    "critic": {
      "rating": {
        "$numberDouble": "7.1"
      },
      "numReviews": {
        "$numberInt": "11"
      },
      "meter": {
        "$numberInt": "82"
      }
    },
    "lastUpdated": {
      "$date": {
        "$numberLong": "1441307415000"
      }
    },
    "rotten": {
      "$numberInt": "2"
    },
    "production": "Live Home Video",
    "fresh": {
      "$numberInt": "9"
    }
  },
  "plot_embedding": [
    -0.004237316,
    -0.022958077,
    -0.005921211,
    -0.020323543,
    0.010051459
  ]
}
```

## 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 = 'sample_mflix'
collection_name = 'embedded_movies'

embedded_movies_collection = client[db_name][collection_name]

dataset = load_dataset("MongoDB/embedded_movies")

insert_data = []

for movie in dataset['train']:
    doc_movie = json_util.loads(json_util.dumps(movie))
    insert_data.append(doc_movie)

    if len(insert_data) == 1000:
        embedded_movies_collection.insert_many(insert_data)
        print("1000 records ingested")
        insert_data = []

if len(insert_data) > 0:
    embedded_movies_collection.insert_many(insert_data)
    insert_data = []

print("Data Ingested")
```