Package: imdb-rating-classifier
IMDB rating classifierTable of ContentsOverviewRequirementsInstallationUsageTestingCI/CDTODOLicenseAuthorThis is a simple IMDB rating classifier application that panalizes reviews in accordance with some pre-defined ruleset.OverviewThe application scrapes data fromIMDBand adjusts the rating system according to some specific validation rules (review penalization).The data is scraped from the IMDB charts API using theBeautifulSouplibrary.The data structure of the parsed and normalized payload is as follows (example):{"rank":"1","title":"The Shawshank Redemption","year":"1994","rating":"9.2","votes":"2,223,000","url":"/title/tt0111161/","oscars_won":0,"penalized":false}We would then, extract the following fields, into a dataframe:-rank(int)-title(str)-year(int)-rating(float)-votes(int)-url(str)-oscars_won(int)-penalized(bool)Using dataclasses, we can then, preprocess the data against some schema definition.The rules are as follows:schema={"rank":{"type":"int","min":1,"max":250,"required":True,},"title":{"type":"str","required":True,},"year":{"type":"int","min":1900,"max":2023,"required":True,},"rating":{"type":"float","min":0.0,"max":10.0,"required":True,},"votes":{"type":"int","min":0,"required":True,},"url":{"type":"str","required":True,},"oscars_won":{"type":"int","min":0,"required":True,},"penalized":{"type":"bool","required":True,},}RequirementsPython>=3.8>=3.10BeautifulSoup4requestspytesttoxclickpre-commitflake8blackisortand more...InstallationFor development purposes:Clone the repositoryfoo@bar:~$gitclonegit@github.com/marouenes/imdb-rating-classifier.gitCreate a virtual environmentfoo@bar:~/imdb-rating-classifier$virtualenv.venvActivate the virtual environmentfoo@bar:~/imdb-rating-classifier$source.venv/bin/activateInstall the dev dependenciesfoo@bar:~/imdb-rating-classifier$pipinstall-rrequirements-dev.txtInstall the pre-commit hooksfoo@bar:~/imdb-rating-classifier$pre-commitinstallFor usage:Install the dependencies and build the wheelfoo@bar:~/imdb-rating-classifier$pipinstall-e.The application is publicly available and published onPyPIand can be installed using pip:foo@bar:~$pipinstallimdb-rating-classifierUsageDisplay the help message and the available commandsfoo@bar:~$imdb-rating-classifiergenerate--helpUsage: imdb-rating-classifier generate [OPTIONS]Generate the output dataset containing both the original and adjustedratings.An extra JSON file will be generated alongside the csv fileOptions:--output FILE               The path to the output file.--number-of-movies INTEGER  The number of movies to scrape.-h, --help                  Show this message and exit.Run the application with the default number of movies (20) and the default output file (data.csv)imdb-rating-classifiergenerateRun the application with a specific number of moviesimdb-rating-classifiergenerate--number-of-movies100Run the application with a specific number of movies and a specific output fileimdb-rating-classifiergenerate--number-of-movies100--outputsome_name.csvTestingRun tests and pre-commit hooksfoo@bar:~/imdb-rating-classifier$toxCI/CDThe application is automatically packaged and distributed to PyPI, It is also automatically
tested using tox as an environment orchestrator and GitHub Actions.TODOAdd more testsAdd more validation rulesAdd more documentationAdd more features!Publish the package on PyPIAdd oscar awards or nominations for the moviesAdd a version switch for the cliLicenseMIT LicenseAuthorMarouane Skandaji