| sdk | sdk_version | app_file |
|---|---|---|
streamlit |
1.25.0 |
Middle_School_Card_Search.py |
Composes a list of Magic cards legal in the Middle School format.
You can download the list of legal cards in the following formats:
- JSON (Oracle IDs and card names only)
- CSV (Oracle IDs and card names only)
- JSON (with additional columns)
- CSV (with additional columns)
The following versions of the list include banned cards with a banned column set to True:
- JSON (Oracle IDs and card names only)
- CSV (Oracle IDs and card names only)
- JSON (with additional columns)
- CSV (with additional columns)
The following versions include image URIs from Scryfall in addition to all the above:
Feel free to take a look at the Jupyter notebook for a quick idea of the process, but please keep in mind that it is outdated and still included only for quick reference purposes.
To actually compose the list, run the shell and python scripts in the list_scripts directory in order.
To add Scryfall image URIs to the card list, run the 9_add_image_uris.py script:
python3 list_scripts/9_add_image_uris.pyThis script:
- Reads the card data from
static/middleschool_extra_fields_with_banned.csv - Queries the Scryfall API to fetch small image URIs for each card
- Respects Scryfall's rate limiting (max 10 requests per second)
- Generates output files with an additional
image_smallcolumn containing the image URLs
For testing purposes, you can run the script with a --test flag to process only the first 20 cards:
python3 list_scripts/9_add_image_uris.py --testNote: The full script may take several minutes to complete due to API rate limiting.
To fix split card data issues (missing colors and rules text), run the 10_fix_split_cards.py script:
python3 list_scripts/10_fix_split_cards.pyThis script:
- Reads the card data from
static/middleschool_extra_fields_with_banned_images.csv - Identifies all split cards (cards with "//" in the name)
- Fixes color representation by combining colors from both halves using MTG JSON data
- Combines rules text from both halves with " // " separator
- Fixes corrupted Japanese names for split cards
- Generates corrected output files with accurate split card data
The script addresses issues where split cards like "Fire // Ice" only showed colors from the first half (red only) instead of both halves (red and blue).
Command line utilities:
Python modules:
- json
- pandas
- requests
- requests_html
This repository also hosts a web app where users can search for Middle School legal cards or check the legality of cards in a list.
The app is deployed here: alecrem-middleschool.hf.space.
To run the Streamlit app locally, install the streamlit module and run:
streamlit run Middle_School_Card_Search.pyNote: the Streamlit version is pinned to 1.25.0 because that's the latest version supported by Hugging Face.