-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into merge_netflix_streamlining_function_calls
- Loading branch information
Showing
19 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
data | ||
out | ||
.env | ||
.pytest_cache | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
# Noisebridge Python Project | ||
# What is MediaBridge? | ||
|
||
https://www.noisebridge.net/wiki/Python_Project_Meetup | ||
MediaBridge is a project being developed at the [Noisebridge](https://github.com/noisebridge) hackerspace in San Francisco, CA, USA. See also the [Noisebridge hompage](https://www.noisebridge.net/wiki/Noisebridge) and the [wiki entry for this project](https://www.noisebridge.net/wiki/Python_Project_Meetup). | ||
|
||
MediaBridge is in a _very_ early stage of the development. It's intended functionality is to provide recommendations that _bridge_ media types. So for example, you might say you're interested in the film _Saw_ and MediaBrige might recommend the video game _Silent Hill_ or a Stephen King book. For now, we are working on simply returning recommendations for movies, based on the [Netflix Prize dataset](https://www.kaggle.com/datasets/netflix-inc/netflix-prize-data). | ||
|
||
Currently, we are only accepting contributions from members of the project who meet in person at Noisebridge. | ||
|
||
## Testing | ||
|
||
To run unit tests, | ||
|
||
1. Ensure `pipenv` is installed | ||
2. Run `pipenv run pytest` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from wiki_to_netflix import format_sparql_query, wiki_query, process_data | ||
from wiki_to_netflix_test_data import EXPECTED_SPARQL_QUERY | ||
|
||
def test_format_sparql_query(): | ||
QUERY = format_sparql_query("The Room", 2003) | ||
assert QUERY == EXPECTED_SPARQL_QUERY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
EXPECTED_SPARQL_QUERY =''' | ||
SELECT * WHERE { | ||
SERVICE wikibase:mwapi { | ||
bd:serviceParam wikibase:api "EntitySearch" ; | ||
wikibase:endpoint "www.wikidata.org" ; | ||
mwapi:search "The Room" ; | ||
mwapi:language "en" . | ||
?item wikibase:apiOutputItem mwapi:item . | ||
} | ||
?item wdt:P31/wdt:P279* wd:Q11424 . | ||
{ | ||
# Get US release date | ||
?item p:P577 ?releaseDateStatement . | ||
?releaseDateStatement ps:P577 ?releaseDate . | ||
?releaseDateStatement pq:P291 wd:Q30 . | ||
} | ||
UNION | ||
{ | ||
# Get unspecified release date | ||
?item p:P577 ?releaseDateStatement . | ||
?releaseDateStatement ps:P577 ?releaseDate . | ||
FILTER NOT EXISTS { ?releaseDateStatement pq:P291 ?country } | ||
} | ||
FILTER (YEAR(?releaseDate) = 2003) . | ||
?item rdfs:label ?itemLabel . | ||
FILTER (lang(?itemLabel) = "en") . | ||
OPTIONAL { | ||
?item wdt:P136 ?genre . | ||
?genre rdfs:label ?genreLabel . | ||
FILTER (lang(?genreLabel) = "en") . | ||
} | ||
OPTIONAL {?item wdt:P57 ?director. | ||
?director rdfs:label ?directorLabel. | ||
FILTER (lang(?directorLabel) = "en")} | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } | ||
} | ||
''' |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from mediabridge.data_processing import wiki_to_netflix | ||
|
||
q = wiki_to_netflix.format_sparql_query('The Room', 2003) | ||
print(q) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
python_files = *_test.py |