uchicago-cs / chigame

BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Create Category and Mechanic Fixtures #235

Closed frowenz closed 11 months ago

frowenz commented 11 months ago

The goal of this issue is convert the information on these pages, categories and mechanics, into fixtures. This will require creating a web scraper, turning the scraped data into fixtures, and adding an image attribute to these models.

frowenz commented 11 months ago

An open question I am unsure about is: given that these will be permanent things in our data base, is using fixtures the best approach?

frowenz commented 11 months ago

Wiki Page with scraping code here

frowenz commented 11 months ago

One thing left to do maybe when Category CRUD pages appear is to refine the way the descriptions are stored. This involves implementing more intelligent parsing. Currently, a lot of BGG descriptions have bullet points which we are ignoring and occasionally have BGG specific things.

See this page and the following description as an example:

"description": "Medieval games that have themes or storylines set in Europe or Asia, between the 5th century (476, the fall of the Western Roman Empire) and the 15th century (1492, the beginnings of European overseas colonization).\n\n\nHistorical categories on BGG:\n\n\n    Ancient\n    Medieval\n    Renaissance\n    Pike and Shot\n    Age of Reason\n    Napoleonic\n    Post-Napoleonic\n    World War I\n    World War II\n    Korean War\n    Vietnam War\n    Modern Warfare\n\n\nNorth America:\n\n    American Revolutionary War\n    American Civil War\n    American Indian Wars\n    American West\n\n\n\nMicrobadge\n\n Medieval Theme fan",

This sort of advanced parsing lies outside the scope of just getting basic Category and Mechanic fixtures up.

frowenz commented 11 months ago
Screenshot 2023-11-15 at 4 55 20 PM
frowenz commented 11 months ago

python3 manage.py testserver src/chigame/games/fixtures/mechanics_categories_fixtures.json to run

willcravitz commented 11 months ago

On whether these should be fixtures given that they're permanent in the database, I think it's fine because we can always load them into the database with python3 manage.py loaddata src/chigame/games/fixtures/mechanics_categories_fixtures.json

willcravitz commented 11 months ago

Closing comments: this issue resulted in the creation of a fixture file for all of the categories and mechanics (with descriptions and images) that are listed on BoardGameGeek.

Developer contributions: @frowenz wrote the whole script to create the fixture file and made all the requested changes in PR #236 @willcravitz just confirmed that the file worked and left some minor comments

majorsylvie commented 10 months ago

Issue Score: Excellent

Comments: Great work y'all! Thank you to you both for actually discussing the updates, questions, and answers via the issue updates. Great closing comment @willcravitz @frowenz thank you for all of your work making the functional (and very useful) script for scraping the fixtures! Super cool work.