This tool ingests JSON packet files and QBJ game files into a SQLite database. The buzzpoints app uses this SQLite database to build a web app that visualizes the data in a convenient form.
JSON packet files can be generated via these packet parsers:
QBJ files are generated by MODAQ.
- Clone this repository via SSH, HTTPS, or downloading as a zip.
- Install
Node.jsandnpmon your system if they're not already installed.Node.jsversion22.12.0is the recommended version.better-sqlite3has some issues withNode.jsversion24.*that you might run into.
- Open a bash shell (e.g. Terminal), go to the root directory, and run
npm install.- This command will install all the necessary libraries.
Tip
The following directions go over creating the file structure from scratch. To jump ahead of many of these steps, unzip the data.zip file in the root of this repository.
This will create a data/ folder with demo /question_sets/ and /tournaments/ subfolders that you can modify to fit your needs.
Once you modify the demo and add your question set JSONs and tournament QBJs, you can skip to building the database.
-
Create a directory called
datain the root directory of the project. -
Inside
data, create folders calledquestion_setsandtournaments. -
In
question_sets, add folders for each of the question sets you'd like to add to the database.-
In each question set folder, add an
index.jsonfile in the following style:{ "name": "2023 Chicago Open", "difficulty": "Open", "metadataStyle": 1, "format": "powers", "bonuses": true } -
Acceptable values for
metadataStyleare listed below.1is default (and probably what you need).metadataStyleis required if you'd like thequestionstable to populate with category and author data.- You can modify the code in
metadata-utils.jsif you need a custom format.
-
Acceptable values for
formatare listed below.powersis default. -
If the set doesn't have bonuses, set
bonusestofalse. -
If the set's metadata lists authors second instead of first (i.e., in the order
<Category, Author>or<Category, XY>), setauthorFirsttofalse.
-
-
In each subfolder of
question sets, add a folder callededitions. Each subfolder ineditionscorresponds to a version of the question set. Eacheditionssubfolder should have anindex.jsonfile with propertiesnameanddate.-
For instance, if 2023 Chicago Open has an edition that was played on August 05, 2023, create a subfolder in
editionscalled2023-08-051:{ "name": "08/05/2023", "date": "2023-08-05" }
-
-
In each subfolder of
editions, add apacket_filessubfolder containing the MODAQ packet json files for that version of the question set.- It's recommended that your packets be named like
Packet-01.jsonorPacket-A.json. (Ideally, something simple that can be easily parsed, using hyphens and/or underscores to separate slugs.)
- It's recommended that your packets be named like
-
In your
data/tournamentsfolder, add folders for each of the tournaments that you'd like to add to the database. In each tournament folder, add anindex.jsonfile in the following format:{ "name": "2023 Chicago Open", "set": "2023 Chicago Open", "edition": "08/05/2023", "location": "Northwestern University", "level": "Open", "start_date": "2023-08-05", "end_date": "2023-08-05", "rounds_to_exclude_from_individual_stats": [ 16, 17 ] }- The
editionfield should match thenamefield of theindex.jsonof the corresponding question set edition.
- The
-
In each tournament folder, add a folder called
game_filesand insert the tournament's QBJ files there.- Each QBJ filename should start with the string
Round_, then the round number, then an underscore, e.g.Round_1_Team_One_Team_Two.qbj. - The QBJs don't have to be stored all together; you can store them in separate subfolders under the
game_filesfolder (e.g., by round, where QBJs for round 1 are stored ingame_files/round_1/).
- Each QBJ filename should start with the string
-
Your
datasubfolder should now be structured like this:. |-- question_sets | |-- 2023_Chicago_Open | | |-- editions | | |-- 2023-08-05 | | |-- packet_files | | `-- Packet_1.json | | `-- Packet_2.json | | `-- ... | | `-- index.json | | `-- index.json |-- tournaments | |-- 2023_Chicago_Open | | `-- game_files | | `-- Round_1_X_Team_One_Team_Two.qbj | | `-- Round_2_X_Team_Three_Team_Four.qbj | | `-- ... | | `-- index.json
- Return to the bash shell and run
npm run initDB.- This command will build the database and store it as
database.db.
- This command will build the database and store it as
- Copy
database.dbto thedatafolder of your local deployment of thebuzzpointsapp. - Follow the directions in that repository to host the buzzpoints app locally and/or online.
| Format | Number | Examples |
|---|---|---|
"default" |
1 | <XY, Category> or <XY, Category - Subcategory> or <AuthorName, Category> or <AuthorName, Category - Subcategory> |
"noAuthor" |
2 | <Category> |
"authorAndCategory" |
3 | <XY, Category> or <XY - Category> or <AuthorName, Category> or <AuthorName - Category> |
"nsc" |
4 | <AuthorName, Category - Subcategory - Subsubcategory> ... <Editor: EditorName> |
"nasat" |
5 | <AuthorName , Category> |
"qbReader" |
6 | <Category - Subcategory - Subsubcategory> |
"none" |
7 | None |
| Format | Number | Powers | Superpowers | Negs |
|---|---|---|---|---|
"acf" |
1 | ❌ | ❌ | ✅ (-5) |
"powers" |
2 | ✅ (15) | ❌ | ✅ (-5) |
"superpowers" |
3 | ✅ (15) | ✅ (20) | ✅ (-5) |
"pace" |
4 | ✅ (20) | ❌ | ❌ |
This tool was created by Jordan Brownstein. Ani Perumalla contributed some features after its initial development.
Thanks to Anderson Wang and Geoffrey Wu for their feedback on the tool, and to Geoffrey for letting us steal subcat-to-cat.json from his packet parser.
Footnotes
-
The
namefield doesn't have to correspond to a certain date, you can call it whatever you want as long as theeditionof any corresponding tournament matches it. ↩