From c056b19bf93ab068ae732eff679bef1bece58cdb Mon Sep 17 00:00:00 2001 From: bartvdbraak Date: Sun, 2 Feb 2020 21:48:53 +0100 Subject: [PATCH] Query csv updated to also convert to JSON --- src/data/chaeldar_results.json | 194 ++++++++++++++++++++++ src/data/duradel_results.json | 158 ++++++++++++++++++ src/data/konar quo maten_results.json | 158 ++++++++++++++++++ src/data/krystilia_results.json | 110 +++++++++++++ src/data/mazchna_results.json | 122 ++++++++++++++ src/data/nieve_results.json | 166 +++++++++++++++++++ src/data/query_csv.py | 33 +++- src/data/turael_results.json | 98 +++++++++++ src/data/vannaka_results.json | 226 ++++++++++++++++++++++++++ 9 files changed, 1260 insertions(+), 5 deletions(-) create mode 100644 src/data/chaeldar_results.json create mode 100644 src/data/duradel_results.json create mode 100644 src/data/konar quo maten_results.json create mode 100644 src/data/krystilia_results.json create mode 100644 src/data/mazchna_results.json create mode 100644 src/data/nieve_results.json create mode 100644 src/data/turael_results.json create mode 100644 src/data/vannaka_results.json diff --git a/src/data/chaeldar_results.json b/src/data/chaeldar_results.json new file mode 100644 index 0000000..9d0e023 --- /dev/null +++ b/src/data/chaeldar_results.json @@ -0,0 +1,194 @@ +{ + "0": { + "id": "0", + "task_weight": "8" + }, + "1": { + "id": "1", + "task_weight": "12" + }, + "4": { + "id": "4", + "task_weight": "9" + }, + "6": { + "id": "6", + "task_weight": "5" + }, + "7": { + "id": "7", + "task_weight": "7" + }, + "11": { + "id": "11", + "task_weight": "10" + }, + "13": { + "id": "13", + "task_weight": "8" + }, + "14": { + "id": "14", + "task_weight": "8" + }, + "16": { + "id": "16", + "task_weight": "7" + }, + "17": { + "id": "17", + "task_weight": "11" + }, + "20": { + "id": "20", + "task_weight": "5" + }, + "21": { + "id": "21", + "task_weight": "10" + }, + "22": { + "id": "22", + "task_weight": "12" + }, + "23": { + "id": "23", + "task_weight": "6" + }, + "25": { + "id": "25", + "task_weight": "6" + }, + "29": { + "id": "29", + "task_weight": "11" + }, + "34": { + "id": "34", + "task_weight": "9" + }, + "37": { + "id": "37", + "task_weight": "8" + }, + "39": { + "id": "39", + "task_weight": "7" + }, + "40": { + "id": "40", + "task_weight": "12" + }, + "42": { + "id": "42", + "task_weight": "7" + }, + "43": { + "id": "43", + "task_weight": "11" + }, + "47": { + "id": "47", + "task_weight": "9" + }, + "49": { + "id": "49", + "task_weight": "6" + }, + "50": { + "id": "50", + "task_weight": "9" + }, + "57": { + "id": "57", + "task_weight": "7" + }, + "58": { + "id": "58", + "task_weight": "12" + }, + "59": { + "id": "59", + "task_weight": "10" + }, + "60": { + "id": "60", + "task_weight": "10" + }, + "61": { + "id": "61", + "task_weight": "11" + }, + "63": { + "id": "63", + "task_weight": "12" + }, + "65": { + "id": "65", + "task_weight": "9" + }, + "66": { + "id": "66", + "task_weight": "8" + }, + "67": { + "id": "67", + "task_weight": "5" + }, + "73": { + "id": "73", + "task_weight": "6" + }, + "74": { + "id": "74", + "task_weight": "6" + }, + "77": { + "id": "77", + "task_weight": "7" + }, + "78": { + "id": "78", + "task_weight": "12" + }, + "81": { + "id": "81", + "task_weight": "6" + }, + "85": { + "id": "85", + "task_weight": "5" + }, + "91": { + "id": "91", + "task_weight": "8" + }, + "92": { + "id": "92", + "task_weight": "7" + }, + "96": { + "id": "96", + "task_weight": "12" + }, + "100": { + "id": "100", + "task_weight": "11" + }, + "101": { + "id": "101", + "task_weight": "10" + }, + "102": { + "id": "102", + "task_weight": "8" + }, + "104": { + "id": "104", + "task_weight": "6" + }, + "108": { + "id": "108", + "task_weight": "6" + } +} \ No newline at end of file diff --git a/src/data/duradel_results.json b/src/data/duradel_results.json new file mode 100644 index 0000000..fc69d08 --- /dev/null +++ b/src/data/duradel_results.json @@ -0,0 +1,158 @@ +{ + "0": { + "id": "0", + "task_weight": "7" + }, + "1": { + "id": "1", + "task_weight": "12" + }, + "2": { + "id": "2", + "task_weight": "2" + }, + "3": { + "id": "3", + "task_weight": "5" + }, + "4": { + "id": "4", + "task_weight": "8" + }, + "11": { + "id": "11", + "task_weight": "8" + }, + "12": { + "id": "12", + "task_weight": "9" + }, + "13": { + "id": "13", + "task_weight": "8" + }, + "14": { + "id": "14", + "task_weight": "4" + }, + "15": { + "id": "15", + "task_weight": "12" + }, + "21": { + "id": "21", + "task_weight": "4" + }, + "22": { + "id": "22", + "task_weight": "9" + }, + "29": { + "id": "29", + "task_weight": "9" + }, + "30": { + "id": "30", + "task_weight": "11" + }, + "33": { + "id": "33", + "task_weight": "8" + }, + "34": { + "id": "34", + "task_weight": "5" + }, + "37": { + "id": "37", + "task_weight": "4" + }, + "40": { + "id": "40", + "task_weight": "7" + }, + "42": { + "id": "42", + "task_weight": "5" + }, + "43": { + "id": "43", + "task_weight": "8" + }, + "47": { + "id": "47", + "task_weight": "9" + }, + "50": { + "id": "50", + "task_weight": "10" + }, + "58": { + "id": "58", + "task_weight": "5" + }, + "61": { + "id": "61", + "task_weight": "9" + }, + "63": { + "id": "63", + "task_weight": "4" + }, + "66": { + "id": "66", + "task_weight": "10" + }, + "72": { + "id": "72", + "task_weight": "9" + }, + "78": { + "id": "78", + "task_weight": "9" + }, + "83": { + "id": "83", + "task_weight": "8" + }, + "87": { + "id": "87", + "task_weight": "2" + }, + "92": { + "id": "92", + "task_weight": "7" + }, + "94": { + "id": "94", + "task_weight": "9" + }, + "96": { + "id": "96", + "task_weight": "7" + }, + "97": { + "id": "97", + "task_weight": "7" + }, + "98": { + "id": "98", + "task_weight": "8" + }, + "100": { + "id": "100", + "task_weight": "6" + }, + "102": { + "id": "102", + "task_weight": "10" + }, + "105": { + "id": "105", + "task_weight": "2" + }, + "108": { + "id": "108", + "task_weight": "8" + } +} \ No newline at end of file diff --git a/src/data/konar quo maten_results.json b/src/data/konar quo maten_results.json new file mode 100644 index 0000000..a883189 --- /dev/null +++ b/src/data/konar quo maten_results.json @@ -0,0 +1,158 @@ +{ + "0": { + "id": "0", + "task_weight": "6" + }, + "1": { + "id": "1", + "task_weight": "9" + }, + "2": { + "id": "2", + "task_weight": "5" + }, + "3": { + "id": "3", + "task_weight": "5" + }, + "4": { + "id": "4", + "task_weight": "6" + }, + "11": { + "id": "11", + "task_weight": "9" + }, + "12": { + "id": "12", + "task_weight": "6" + }, + "13": { + "id": "13", + "task_weight": "9" + }, + "14": { + "id": "14", + "task_weight": "4" + }, + "15": { + "id": "15", + "task_weight": "8" + }, + "16": { + "id": "16", + "task_weight": "2" + }, + "17": { + "id": "17", + "task_weight": "5" + }, + "22": { + "id": "22", + "task_weight": "9" + }, + "29": { + "id": "29", + "task_weight": "8" + }, + "30": { + "id": "30", + "task_weight": "5" + }, + "33": { + "id": "33", + "task_weight": "10" + }, + "34": { + "id": "34", + "task_weight": "6" + }, + "40": { + "id": "40", + "task_weight": "9" + }, + "42": { + "id": "42", + "task_weight": "5" + }, + "43": { + "id": "43", + "task_weight": "6" + }, + "47": { + "id": "47", + "task_weight": "7" + }, + "50": { + "id": "50", + "task_weight": "8" + }, + "53": { + "id": "53", + "task_weight": "10" + }, + "58": { + "id": "58", + "task_weight": "5" + }, + "59": { + "id": "59", + "task_weight": "6" + }, + "61": { + "id": "61", + "task_weight": "9" + }, + "63": { + "id": "63", + "task_weight": "3" + }, + "66": { + "id": "66", + "task_weight": "8" + }, + "72": { + "id": "72", + "task_weight": "5" + }, + "78": { + "id": "78", + "task_weight": "7" + }, + "83": { + "id": "83", + "task_weight": "5" + }, + "87": { + "id": "87", + "task_weight": "5" + }, + "92": { + "id": "92", + "task_weight": "5" + }, + "94": { + "id": "94", + "task_weight": "7" + }, + "97": { + "id": "97", + "task_weight": "5" + }, + "100": { + "id": "100", + "task_weight": "6" + }, + "101": { + "id": "101", + "task_weight": "3" + }, + "105": { + "id": "105", + "task_weight": "2" + }, + "108": { + "id": "108", + "task_weight": "10" + } +} \ No newline at end of file diff --git a/src/data/krystilia_results.json b/src/data/krystilia_results.json new file mode 100644 index 0000000..0504f81 --- /dev/null +++ b/src/data/krystilia_results.json @@ -0,0 +1,110 @@ +{ + "3": { + "id": "3", + "task_weight": "6" + }, + "4": { + "id": "4", + "task_weight": "7" + }, + "5": { + "id": "5", + "task_weight": "4" + }, + "9": { + "id": "9", + "task_weight": "6" + }, + "11": { + "id": "11", + "task_weight": "7" + }, + "12": { + "id": "12", + "task_weight": "4" + }, + "24": { + "id": "24", + "task_weight": "5" + }, + "31": { + "id": "31", + "task_weight": "4" + }, + "36": { + "id": "36", + "task_weight": "6" + }, + "38": { + "id": "38", + "task_weight": "5" + }, + "40": { + "id": "40", + "task_weight": "7" + }, + "47": { + "id": "47", + "task_weight": "8" + }, + "48": { + "id": "48", + "task_weight": "4" + }, + "50": { + "id": "50", + "task_weight": "7" + }, + "54": { + "id": "54", + "task_weight": "6" + }, + "55": { + "id": "55", + "task_weight": "7" + }, + "64": { + "id": "64", + "task_weight": "3" + }, + "65": { + "id": "65", + "task_weight": "6" + }, + "68": { + "id": "68", + "task_weight": "7" + }, + "69": { + "id": "69", + "task_weight": "6" + }, + "84": { + "id": "84", + "task_weight": "5" + }, + "86": { + "id": "86", + "task_weight": "5" + }, + "88": { + "id": "88", + "task_weight": "6" + }, + "93": { + "id": "93", + "task_weight": "5" + }, + "95": { + "id": "95", + "task_weight": "6" + }, + "96": { + "id": "96", + "task_weight": "6" + }, + "15": { + "id": "15", + "task_weight": "8" + } +} \ No newline at end of file diff --git a/src/data/mazchna_results.json b/src/data/mazchna_results.json new file mode 100644 index 0000000..1c30f5c --- /dev/null +++ b/src/data/mazchna_results.json @@ -0,0 +1,122 @@ +{ + "6": { + "id": "6", + "task_weight": "8" + }, + "8": { + "id": "8", + "task_weight": "7" + }, + "9": { + "id": "9", + "task_weight": "6" + }, + "18": { + "id": "18", + "task_weight": "8" + }, + "19": { + "id": "19", + "task_weight": "8" + }, + "20": { + "id": "20", + "task_weight": "8" + }, + "23": { + "id": "23", + "task_weight": "8" + }, + "25": { + "id": "25", + "task_weight": "8" + }, + "27": { + "id": "27", + "task_weight": "8" + }, + "67": { + "id": "67", + "task_weight": "8" + }, + "32": { + "id": "32", + "task_weight": "7" + }, + "36": { + "id": "36", + "task_weight": "6" + }, + "41": { + "id": "41", + "task_weight": "7" + }, + "44": { + "id": "44", + "task_weight": "7" + }, + "45": { + "id": "45", + "task_weight": "7" + }, + "51": { + "id": "51", + "task_weight": "7" + }, + "52": { + "id": "52", + "task_weight": "7" + }, + "55": { + "id": "55", + "task_weight": "7" + }, + "61": { + "id": "61", + "task_weight": "6" + }, + "62": { + "id": "62", + "task_weight": "6" + }, + "73": { + "id": "73", + "task_weight": "8" + }, + "81": { + "id": "81", + "task_weight": "8" + }, + "85": { + "id": "85", + "task_weight": "8" + }, + "88": { + "id": "88", + "task_weight": "7" + }, + "90": { + "id": "90", + "task_weight": "8" + }, + "93": { + "id": "93", + "task_weight": "7" + }, + "103": { + "id": "103", + "task_weight": "6" + }, + "104": { + "id": "104", + "task_weight": "7" + }, + "107": { + "id": "107", + "task_weight": "7" + }, + "109": { + "id": "109", + "task_weight": "7" + } +} \ No newline at end of file diff --git a/src/data/nieve_results.json b/src/data/nieve_results.json new file mode 100644 index 0000000..91c7a12 --- /dev/null +++ b/src/data/nieve_results.json @@ -0,0 +1,166 @@ +{ + "0": { + "id": "0", + "task_weight": "6" + }, + "1": { + "id": "1", + "task_weight": "9" + }, + "2": { + "id": "2", + "task_weight": "2" + }, + "3": { + "id": "3", + "task_weight": "5" + }, + "4": { + "id": "4", + "task_weight": "6" + }, + "11": { + "id": "11", + "task_weight": "9" + }, + "12": { + "id": "12", + "task_weight": "6" + }, + "13": { + "id": "13", + "task_weight": "9" + }, + "14": { + "id": "14", + "task_weight": "4" + }, + "15": { + "id": "15", + "task_weight": "8" + }, + "16": { + "id": "16", + "task_weight": "3" + }, + "21": { + "id": "21", + "task_weight": "5" + }, + "22": { + "id": "22", + "task_weight": "6" + }, + "29": { + "id": "29", + "task_weight": "8" + }, + "30": { + "id": "30", + "task_weight": "5" + }, + "33": { + "id": "33", + "task_weight": "7" + }, + "34": { + "id": "34", + "task_weight": "6" + }, + "37": { + "id": "37", + "task_weight": "4" + }, + "40": { + "id": "40", + "task_weight": "9" + }, + "42": { + "id": "42", + "task_weight": "5" + }, + "43": { + "id": "43", + "task_weight": "6" + }, + "47": { + "id": "47", + "task_weight": "7" + }, + "50": { + "id": "50", + "task_weight": "8" + }, + "58": { + "id": "58", + "task_weight": "5" + }, + "61": { + "id": "61", + "task_weight": "9" + }, + "63": { + "id": "63", + "task_weight": "3" + }, + "66": { + "id": "66", + "task_weight": "8" + }, + "70": { + "id": "70", + "task_weight": "4" + }, + "72": { + "id": "72", + "task_weight": "5" + }, + "78": { + "id": "78", + "task_weight": "7" + }, + "83": { + "id": "83", + "task_weight": "5" + }, + "87": { + "id": "87", + "task_weight": "2" + }, + "92": { + "id": "92", + "task_weight": "5" + }, + "94": { + "id": "94", + "task_weight": "7" + }, + "96": { + "id": "96", + "task_weight": "6" + }, + "97": { + "id": "97", + "task_weight": "5" + }, + "98": { + "id": "98", + "task_weight": "8" + }, + "100": { + "id": "100", + "task_weight": "6" + }, + "101": { + "id": "101", + "task_weight": "3" + }, + "102": { + "id": "102", + "task_weight": "10" + }, + "108": { + "id": "108", + "task_weight": "7" + } +} \ No newline at end of file diff --git a/src/data/query_csv.py b/src/data/query_csv.py index d3847ee..d892b94 100644 --- a/src/data/query_csv.py +++ b/src/data/query_csv.py @@ -1,19 +1,28 @@ import csv import json +MASTERS_JSON = 'masters.json' +MASTERS_KEY = 'masters' +MONSTERS_CSV = 'monsters.csv' +RESULT_SUFFIX = '_results' + + def loop_over_masters(): - master = open('masters.json') - data = json.load(master)["masters"] + master = open(MASTERS_JSON) + data = json.load(master)[MASTERS_KEY] master.close() for (key, value) in data.items(): - write_results(str(value['name'].lower())) + file_name = str(value['name'].lower()) + write_results(file_name) + generate_json(file_name) + def write_results(current_master): - with open('monsters.csv', 'r') as monsters: + with open(MONSTERS_CSV, 'r') as monsters: master_indices = dict((r[1], i) for i, r in enumerate(csv.reader(monsters))) with open(current_master + '.csv', 'r') as master: - with open(current_master + '_results.csv', 'w') as results: + with open(current_master + RESULT_SUFFIX + '.csv', 'w') as results: reader = csv.reader(master) writer = csv.writer(results) @@ -34,5 +43,19 @@ def write_results(current_master): writer.writerow([index - 1] + [row[2]] ) +def generate_json(file_name): + data = {} + + with open(file_name + RESULT_SUFFIX + '.csv', 'r') as csv_file: + csv_reader = csv.DictReader(csv_file) + for rows in csv_reader: + id = rows['id'] + data[id] = rows + + with open(file_name + RESULT_SUFFIX + '.json', 'w') as json_file: + json_file.write(json.dumps(data, indent=4)) + + if __name__ == "__main__": loop_over_masters() + diff --git a/src/data/turael_results.json b/src/data/turael_results.json new file mode 100644 index 0000000..1850d96 --- /dev/null +++ b/src/data/turael_results.json @@ -0,0 +1,98 @@ +{ + "6": { + "id": "6", + "task_weight": "8" + }, + "8": { + "id": "8", + "task_weight": "7" + }, + "10": { + "id": "10", + "task_weight": "6" + }, + "9": { + "id": "9", + "task_weight": "7" + }, + "19": { + "id": "19", + "task_weight": "8" + }, + "20": { + "id": "20", + "task_weight": "8" + }, + "23": { + "id": "23", + "task_weight": "8" + }, + "26": { + "id": "26", + "task_weight": "8" + }, + "27": { + "id": "27", + "task_weight": "8" + }, + "32": { + "id": "32", + "task_weight": "7" + }, + "35": { + "id": "35", + "task_weight": "7" + }, + "44": { + "id": "44", + "task_weight": "7" + }, + "46": { + "id": "46", + "task_weight": "7" + }, + "56": { + "id": "56", + "task_weight": "8" + }, + "61": { + "id": "61", + "task_weight": "6" + }, + "67": { + "id": "67", + "task_weight": "8" + }, + "71": { + "id": "71", + "task_weight": "7" + }, + "75": { + "id": "75", + "task_weight": "6" + }, + "82": { + "id": "82", + "task_weight": "7" + }, + "88": { + "id": "88", + "task_weight": "7" + }, + "93": { + "id": "93", + "task_weight": "7" + }, + "95": { + "id": "95", + "task_weight": "6" + }, + "107": { + "id": "107", + "task_weight": "7" + }, + "109": { + "id": "109", + "task_weight": "7" + } +} \ No newline at end of file diff --git a/src/data/vannaka_results.json b/src/data/vannaka_results.json new file mode 100644 index 0000000..7e00573 --- /dev/null +++ b/src/data/vannaka_results.json @@ -0,0 +1,226 @@ +{ + "0": { + "id": "0", + "task_weight": "8" + }, + "1": { + "id": "1", + "task_weight": "5" + }, + "3": { + "id": "3", + "task_weight": "7" + }, + "6": { + "id": "6", + "task_weight": "6" + }, + "7": { + "id": "7", + "task_weight": "8" + }, + "13": { + "id": "13", + "task_weight": "8" + }, + "14": { + "id": "14", + "task_weight": "7" + }, + "16": { + "id": "16", + "task_weight": "7" + }, + "17": { + "id": "17", + "task_weight": "7" + }, + "19": { + "id": "19", + "task_weight": "7" + }, + "20": { + "id": "20", + "task_weight": "7" + }, + "23": { + "id": "23", + "task_weight": "7" + }, + "25": { + "id": "25", + "task_weight": "8" + }, + "27": { + "id": "27", + "task_weight": "6" + }, + "28": { + "id": "28", + "task_weight": "6" + }, + "29": { + "id": "29", + "task_weight": "7" + }, + "67": { + "id": "67", + "task_weight": "7" + }, + "34": { + "id": "34", + "task_weight": "8" + }, + "36": { + "id": "36", + "task_weight": "6" + }, + "37": { + "id": "37", + "task_weight": "7" + }, + "39": { + "id": "39", + "task_weight": "7" + }, + "40": { + "id": "40", + "task_weight": "7" + }, + "43": { + "id": "43", + "task_weight": "5" + }, + "45": { + "id": "45", + "task_weight": "7" + }, + "48": { + "id": "48", + "task_weight": "6" + }, + "49": { + "id": "49", + "task_weight": "8" + }, + "50": { + "id": "50", + "task_weight": "7" + }, + "51": { + "id": "51", + "task_weight": "7" + }, + "52": { + "id": "52", + "task_weight": "7" + }, + "54": { + "id": "54", + "task_weight": "7" + }, + "55": { + "id": "55", + "task_weight": "7" + }, + "57": { + "id": "57", + "task_weight": "8" + }, + "59": { + "id": "59", + "task_weight": "8" + }, + "60": { + "id": "60", + "task_weight": "8" + }, + "61": { + "id": "61", + "task_weight": "7" + }, + "62": { + "id": "62", + "task_weight": "6" + }, + "63": { + "id": "63", + "task_weight": "7" + }, + "65": { + "id": "65", + "task_weight": "7" + }, + "73": { + "id": "73", + "task_weight": "7" + }, + "74": { + "id": "74", + "task_weight": "7" + }, + "76": { + "id": "76", + "task_weight": "7" + }, + "78": { + "id": "78", + "task_weight": "5" + }, + "79": { + "id": "79", + "task_weight": "7" + }, + "80": { + "id": "80", + "task_weight": "8" + }, + "81": { + "id": "81", + "task_weight": "8" + }, + "85": { + "id": "85", + "task_weight": "7" + }, + "90": { + "id": "90", + "task_weight": "8" + }, + "89": { + "id": "89", + "task_weight": "6" + }, + "91": { + "id": "91", + "task_weight": "8" + }, + "96": { + "id": "96", + "task_weight": "8" + }, + "99": { + "id": "99", + "task_weight": "6" + }, + "100": { + "id": "100", + "task_weight": "7" + }, + "101": { + "id": "101", + "task_weight": "8" + }, + "103": { + "id": "103", + "task_weight": "7" + }, + "104": { + "id": "104", + "task_weight": "6" + }, + "106": { + "id": "106", + "task_weight": "7" + } +} \ No newline at end of file