[!NOTE] TL;DR This pipeline converts the raw JSON dataset obtained from the scrapper into a smaller MessagePack file that will be used as the main database in the web app. The
run.pyfile can be executed from the root directory of the project with the commandpython Preprocessing/run.py. The same file also contains the main configuration settings for the pipeline, such as which fields to drop or which predicates to use for filtering the games.
The preprocessing scripts turn the raw JSON dataset into a more memory efficient file, that will be used for the rest of the project. The pipeline is intentionally simple and is driven from a single entry point: run.py.
The only requirement to run the pipeline is to have Python 3 installed, along with the msgpack-python library. You can install the library using pip:
pip install msgpack-pythonor with conda:
conda install msgpack-pythonload.pyreads the raw JSON file and converts each game into aGameobject.filter.pykeeps only the games that satisfy every predicate ingame_validation_predicates. This is usefull to remove very small games with very few reviews, which are not useful for our purposes.reformat.pyremoves the fields listed infields_to_dropand converts the dataset into a compact raw structure.convert.pywrites the final dataset to a.msgpackfile.
Edit the Config block in run.py. That is the only place you should normally change the pipeline behavior.
The main settings are:
original_dataset_path: path to the input JSON dataset.output_dataset_path: path where the generated MessagePack file will be saved.fields_to_drop: fields removed before export to reduce file size.game_validation_predicates: checks used to filter out games that should not be kept.verbose: enables short progress messages during each step.
fields_to_dropcontrols which parts of each game are removed before export. This is where you trim large or unnecessary text fields.game_validation_predicatescontrols dataset filtering. Add or remove predicates depending on which games should be included.original_dataset_pathandoutput_dataset_pathlet you adapt the pipeline if your data lives somewhere else or if you want a different output name.
After the pipeline finishes, you get a compact MessagePack file containing the cleaned dataset. This format is faster to load and smaller than the original JSON. The pipeline is set by default to directly export the file to the steaminghot/public/data directory, so that it can be easily loaded by the web app.