read me clarifications

This commit is contained in:
Zach H 2016-07-22 01:30:34 -04:00
parent 175e62d4d4
commit e0d6577b3e

View file

@ -2,28 +2,42 @@
[![Join the chat at https://gitter.im/mtgjson/mtgsqlive](https://badges.gitter.im/mtgjson/mtgsqlive.svg)](https://gitter.im/mtgjson/mtgsqlive)
The goal of this project is to create a SQLite database with all Magic: The Gathering card data that is supported by Gatherer and [MTGJSON](https://mtgjson.com).
### Goals
The goals of this project include creating a downloadable SQLite database file containing all cards from the game Magic: The Gathering. We are looking for a way to stop being dependent on Gatherer for card data due to their delayed update times and egregious errors that slip by quality control, which we can correct in real time.
We don't like being dependent on Gatherer for card data, as their update time is always delayed and there are sometimes obvious and egregious mistakes that we can correct in real time.
The database starts as a copy of the MTGJSON source of AllSets-x.json, then we manually go in to correct any errors, as MTGJSON is a direct parse of Gatherer. When spoiler season comes around, we can manually update this (with a tool to be developed later) so we will always have a database that's up to date. Projects can pull in our complete database for their projects in order to have a full Magic: the Gathering card database!
### How We Did It
For the database we have hosted on GitHub, we began with downloading and parsing card data from [MTGJSON](https://mtgjson.com), a highly reputable source for Magic: The Gathering card and set information, through their `AllSets-x.json` file.
Once we have completed this import, a repo manager can go in and manually edit imperfections in the data, as sometimes MTGJSON's data is directly based on Gatherer, which in itself usually has a few mistakes.
When "spoiler season" (a few times a year when Wizards of the Coast spoils new cards from an upcoming set) begins, a repo manager can manually update the database (with a tool to be developed later). With the past card data already in the database and spoiled cards input manually, this database will always be up to date, far ahead of the update schedule of Gatherer and MTGJSON.
Projects can pull in our complete database for their projects in order to have a full Magic: the Gathering card database at all times. There is a special table, `lastUpdated`, which contains all of the times that the database was updated, either manually or via an import from MTGJSON (once the set officially is released on Gatherer).
### How to Operate
To turn your JSON file into a SQLite file:
If you would like to use our pre-compiled database for your project, simply download the database and read the `lastUpdated` table to know when the database was last updated. If you would rather create your own database, we have included the tools to do such.
To turn your AllSets JSON file into a SQLite database, run the following command:
`./json_to_sql.py create_new_db db_location json_file_location`
Where:
* create_new_db is 0 (no) or 1 (yes)
* db_location is location where the database is OR where you want to store the newly created database
* json_file_location is the location of the JSON file you want to import to your database
* `create_new_db` is "0" (do not create a new database) or "1" (create a new database)
* `db_location` is location where the database is stored OR where you want to store the newly created database
* `json_file_location` is the location of the JSON file you want to import to your database
To turn your SQLite file into a JSON file:
If your project is already dependent on a JSON format, such as if you pull in the data from MTGJSON and parse it internally, you can create a JSON file from our database with our conversion tool!
To turn a SQLite database file into a JSON file, run the following command:
`./sql_to_json.py db_location output_file_location sets_or_cards`
Where:
* db_location is the location where the database is
* output_file_location is where you want to store the newly created JSON file
* sets_or_cards is "sets" (AllSets-x.json will be generated) or "cards" (AllCards-x.json will be generated)
* `db_location` is the location where the database is stored
* `output_file_location` is where you want to store the newly created JSON output file
* `sets_or_cards` is "sets" ("AllSets-x.json" will be generated) or "cards" ("AllCards-x.json" will be generated)
You can test to make sure your initial JSON is the same as your output JSON via `testing_mac.sh`
### Confirmation Testing
If you would like to make sure the input file is the same as the output file, making sure no data is lost in conversion, you can run the `testing_mac.sh` command. *NOTE:* this program will only work on unix-style machines.