nicpopovic commited on
Commit
e707bc9
·
1 Parent(s): df4583e

initial upload

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
convert.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # script used to convert original json
2
+ import json
3
+ from pathlib import Path
4
+
5
+ def map_answer_to_index(answer_letter):
6
+ """Convert answer letter to numerical index (0-based)"""
7
+ return {'a': 0, 'b': 1, 'c': 2, 'd': 3}[answer_letter.lower()]
8
+
9
+ def find_correct_answer(question):
10
+ """Correct answer is always A / 0"""
11
+ return 0
12
+
13
+ def transform_question(question):
14
+ """Transform a single question from original format to target format"""
15
+
16
+ # Base question structure
17
+ transformed = {
18
+ "language": "de",
19
+ "country": "Germany",
20
+ "file_name": "fragenkatalog3b.json",
21
+ "source": "https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Amateurfunk/Fragenkatalog/PruefungsfragenZIP.html - Prüfungsfragen zum Erwerb von Amateurfunkprüfungsbescheinigungen, Bundesnetzagentur, 3. Auflage, März 2024, (www.bundesnetzagentur.de/amateurfunk), Datenlizenz Deutschland – Namensnennung – Version 2.0 (www.govdata.de/dl-de/by-2-0)",
22
+ "license": "DL-DE->BY-2.0",
23
+ "level": f"Official Exam (Class {question['class']})",
24
+ "category_en": "Amateur Radio",
25
+ "category_original_lang": "Amateurfunk",
26
+ "original_question_num": question["number"],
27
+ "question": question["question"].strip(),
28
+ "parallel_question_id": None,
29
+ "image_png": None,
30
+ "image_information": None,
31
+ "image_type": None
32
+ }
33
+
34
+ # Handle options based on question type
35
+ if any(key.startswith('picture_') for key in question.keys()):
36
+ # Question with images
37
+ if 'picture_a' in question:
38
+ # Multiple choice with image options
39
+ transformed["options"] = [
40
+ question['picture_a'] + ".png",
41
+ question['picture_b'] + ".png",
42
+ question['picture_c'] + ".png",
43
+ question['picture_d'] + ".png"
44
+ ]
45
+ else:
46
+ # Text options with question image
47
+ transformed["options"] = [
48
+ question['answer_a'].strip(),
49
+ question['answer_b'].strip(),
50
+ question['answer_c'].strip(),
51
+ question['answer_d'].strip()
52
+ ]
53
+ if 'picture_question' in question:
54
+ transformed["image_png"] = question["picture_question"] + ".png"
55
+ transformed["image_information"] = "essential"
56
+ transformed["image_type"] = "diagram"
57
+ else:
58
+ # Regular text-only question
59
+ transformed["options"] = [
60
+ question['answer_a'].strip(),
61
+ question['answer_b'].strip(),
62
+ question['answer_c'].strip(),
63
+ question['answer_d'].strip()
64
+ ]
65
+
66
+ # Set the correct answer
67
+ transformed["answer"] = find_correct_answer(question)
68
+
69
+ return transformed
70
+
71
+ def convert_questions(input_file):
72
+ """Convert all questions from input file to new format"""
73
+ with open(input_file, 'r', encoding='utf-8') as f:
74
+ data = json.load(f)
75
+
76
+ transformed_questions = []
77
+
78
+ def process_section(section):
79
+ if 'questions' in section:
80
+ for q in section['questions']:
81
+ transformed_questions.append(transform_question(q))
82
+ if 'sections' in section:
83
+ for subsection in section['sections']:
84
+ process_section(subsection)
85
+
86
+ process_section(data)
87
+
88
+ return transformed_questions
89
+
90
+ def main():
91
+ input_file = Path('fragenkatalog3b.json')
92
+ output_file = input_file.with_stem(input_file.stem + '_transformed')
93
+
94
+ transformed = convert_questions(input_file)
95
+
96
+ with open(output_file, 'w', encoding='utf-8') as f:
97
+ json.dump(transformed, f, ensure_ascii=False, indent=2)
98
+
99
+ if __name__ == "__main__":
100
+ main()
fragenkatalog3b_transformed.json ADDED
The diff for this file is too large to render. See raw diff
 
images/AB108_q.png ADDED

Git LFS Details

  • SHA256: e3a919e230d8f20f69ca2f9d8526e747102dee4790e04a0e8b2bcca628f7c5bc
  • Pointer size: 130 Bytes
  • Size of remote file: 14.7 kB
images/AB109_q.png ADDED

Git LFS Details

  • SHA256: 4b62bde0b41b069be29bec292556f9589c34f8caa93f6b3afc0b0b1179236b5a
  • Pointer size: 130 Bytes
  • Size of remote file: 16.6 kB
images/AB209_q.png ADDED

Git LFS Details

  • SHA256: e1e6b5a533ed6a3cb62eb810da47637bc6c4bdd3b942a21ce56c0736935cc623
  • Pointer size: 129 Bytes
  • Size of remote file: 7.61 kB
images/AB302_q.png ADDED

Git LFS Details

  • SHA256: e827bcfc64e41fefc675d4d58ad8d92feacb9c6eca25511608f3476f15c4a573
  • Pointer size: 130 Bytes
  • Size of remote file: 20.8 kB
images/AB303_q.png ADDED

Git LFS Details

  • SHA256: 299a0e36cd142b78dcd3ad1108bfbc8e91c129fb211164b63578799c8643347e
  • Pointer size: 130 Bytes
  • Size of remote file: 27.9 kB
images/AB403_q.png ADDED

Git LFS Details

  • SHA256: 3e439a714e1a374d814798856c957e98e624bd72010bf085524d97603a5d1fe9
  • Pointer size: 130 Bytes
  • Size of remote file: 39.6 kB
images/AB404_a.png ADDED

Git LFS Details

  • SHA256: df6dfaee3ad022d532a322e24fbe34cbd3cd28926c2f598d2a12410180856fa6
  • Pointer size: 130 Bytes
  • Size of remote file: 10.2 kB
images/AB404_b.png ADDED

Git LFS Details

  • SHA256: 9713e55e183ab5b564a8e5b7d90cb7b2f2f2cf0103d6a47ac4d7d29dd1eafb70
  • Pointer size: 130 Bytes
  • Size of remote file: 10.4 kB
images/AB404_c.png ADDED

Git LFS Details

  • SHA256: b82d749dc72502a67481f329795e7bb022c9bd72354df6997e454e3adbe83984
  • Pointer size: 130 Bytes
  • Size of remote file: 10.7 kB
images/AB404_d.png ADDED

Git LFS Details

  • SHA256: 37efab5ffeb8ff35c997da9efbcbc1e4c8be3f037bf92741da0ff9ae7d470e58
  • Pointer size: 130 Bytes
  • Size of remote file: 10.4 kB
images/AB404_q.png ADDED

Git LFS Details

  • SHA256: 8d8241260bdac92071d69a34a3f0a41a9bd59516c968ef683f3c8f2f419557a6
  • Pointer size: 130 Bytes
  • Size of remote file: 18 kB
images/AB405_a.png ADDED

Git LFS Details

  • SHA256: 9713e55e183ab5b564a8e5b7d90cb7b2f2f2cf0103d6a47ac4d7d29dd1eafb70
  • Pointer size: 130 Bytes
  • Size of remote file: 10.4 kB
images/AB405_b.png ADDED

Git LFS Details

  • SHA256: df6dfaee3ad022d532a322e24fbe34cbd3cd28926c2f598d2a12410180856fa6
  • Pointer size: 130 Bytes
  • Size of remote file: 10.2 kB
images/AB405_c.png ADDED

Git LFS Details

  • SHA256: b82d749dc72502a67481f329795e7bb022c9bd72354df6997e454e3adbe83984
  • Pointer size: 130 Bytes
  • Size of remote file: 10.7 kB
images/AB405_d.png ADDED

Git LFS Details

  • SHA256: 37efab5ffeb8ff35c997da9efbcbc1e4c8be3f037bf92741da0ff9ae7d470e58
  • Pointer size: 130 Bytes
  • Size of remote file: 10.4 kB
images/AB405_q.png ADDED

Git LFS Details

  • SHA256: ae9391094f756c93e6ce0f89e0e99fd7586875f382d609676daef5bf381b6d49
  • Pointer size: 130 Bytes
  • Size of remote file: 22.1 kB
images/AB406_a.png ADDED

Git LFS Details

  • SHA256: 8d8241260bdac92071d69a34a3f0a41a9bd59516c968ef683f3c8f2f419557a6
  • Pointer size: 130 Bytes
  • Size of remote file: 18 kB
images/AB406_b.png ADDED

Git LFS Details

  • SHA256: ae9391094f756c93e6ce0f89e0e99fd7586875f382d609676daef5bf381b6d49
  • Pointer size: 130 Bytes
  • Size of remote file: 22.1 kB
images/AB406_c.png ADDED

Git LFS Details

  • SHA256: 730a595e0ed526933ebc1467001e2df03da2d1d21f429c6d4432afdc73da0e66
  • Pointer size: 130 Bytes
  • Size of remote file: 18.7 kB
images/AB406_d.png ADDED

Git LFS Details

  • SHA256: 9cd168cbcfa56f07d4c75de57fc4150da958093087c9c292594e503698476f29
  • Pointer size: 130 Bytes
  • Size of remote file: 18.4 kB
images/AB406_q.png ADDED

Git LFS Details

  • SHA256: 68acf284bab22270cb34308531330c0d0f2f0ebd475c15e360d0c6f85ed22bcb
  • Pointer size: 129 Bytes
  • Size of remote file: 9.9 kB
images/AB407_a.png ADDED

Git LFS Details

  • SHA256: ae9391094f756c93e6ce0f89e0e99fd7586875f382d609676daef5bf381b6d49
  • Pointer size: 130 Bytes
  • Size of remote file: 22.1 kB
images/AB407_b.png ADDED

Git LFS Details

  • SHA256: 8d8241260bdac92071d69a34a3f0a41a9bd59516c968ef683f3c8f2f419557a6
  • Pointer size: 130 Bytes
  • Size of remote file: 18 kB
images/AB407_c.png ADDED

Git LFS Details

  • SHA256: a504047015be134edde4dd5c19b78b3f7355977b28ae7de818a67598dc65c6f6
  • Pointer size: 130 Bytes
  • Size of remote file: 25 kB
images/AB407_d.png ADDED

Git LFS Details

  • SHA256: bd52dbf59fb3bc572274d604ee7fda30c89a330f31e42d734b971744d9268756
  • Pointer size: 130 Bytes
  • Size of remote file: 15 kB
images/AB407_q.png ADDED

Git LFS Details

  • SHA256: e050070fb4e1aaa8f1d3840b0337c66074daba70a5016ae5e2ba4ffb05149b77
  • Pointer size: 130 Bytes
  • Size of remote file: 10.1 kB
images/AB503_q.png ADDED

Git LFS Details

  • SHA256: e81fad745dfc6265df0c371560a15958183852863abaa4720dd4a2f0975f7834
  • Pointer size: 129 Bytes
  • Size of remote file: 8.02 kB
images/AB601_a.png ADDED

Git LFS Details

  • SHA256: b4aef81b392348f598a1a6d628bb481aa42b7b62a33de22cea3f24d2aa33abd9
  • Pointer size: 129 Bytes
  • Size of remote file: 3.04 kB
images/AB601_b.png ADDED

Git LFS Details

  • SHA256: 2a2fee5ebadee574a70fbe86cfa4cc382aa64c0559d5d6c2f76d026910921d7a
  • Pointer size: 129 Bytes
  • Size of remote file: 3.04 kB
images/AB601_c.png ADDED

Git LFS Details

  • SHA256: c36a81e6aa32e0137be39dac075f0968eb1e1d08af5022e90186647939064abd
  • Pointer size: 129 Bytes
  • Size of remote file: 3.02 kB
images/AB601_d.png ADDED

Git LFS Details

  • SHA256: 8e3062a9ba9a66ff4222701b5720586c6a46bc7f418350dfa0aa54635345c9d1
  • Pointer size: 129 Bytes
  • Size of remote file: 3.04 kB
images/AC211_q.png ADDED

Git LFS Details

  • SHA256: 8877f1e59245fe54f80418573daa7ef3d165339a75fb21f1ddd8d1b63ae642b1
  • Pointer size: 130 Bytes
  • Size of remote file: 24 kB
images/AC303_q.png ADDED

Git LFS Details

  • SHA256: e6155a7f9c3d667f7208fce6c83eb75a2ecb01187d992d8b48a1921972602a4f
  • Pointer size: 129 Bytes
  • Size of remote file: 9.93 kB
images/AC304_q.png ADDED

Git LFS Details

  • SHA256: e6155a7f9c3d667f7208fce6c83eb75a2ecb01187d992d8b48a1921972602a4f
  • Pointer size: 129 Bytes
  • Size of remote file: 9.93 kB
images/AC405_a.png ADDED

Git LFS Details

  • SHA256: 827fdc00ed36d879557a4458187d930b62e543063abafb85c845c3dbc04f78f6
  • Pointer size: 130 Bytes
  • Size of remote file: 13 kB
images/AC405_b.png ADDED

Git LFS Details

  • SHA256: 821d8f9dc7d88d0ca51b70c80a1bad8981e38efd88e9df44dd5a3a2635e5dfa6
  • Pointer size: 129 Bytes
  • Size of remote file: 9.72 kB
images/AC405_c.png ADDED

Git LFS Details

  • SHA256: ed2ce08c354a79208ecf6524fbf723cdefc5a6daa35d663751fe22fe96243fb0
  • Pointer size: 129 Bytes
  • Size of remote file: 9.75 kB
images/AC405_d.png ADDED

Git LFS Details

  • SHA256: 25e305ff6e15eea1f777d94f920dff9be0e491d5345adb1ec1002aaa6a067f47
  • Pointer size: 129 Bytes
  • Size of remote file: 9.33 kB
images/AC405_q.png ADDED

Git LFS Details

  • SHA256: 6399228c53f545ebf4dd88959d73302b2de87c7842e2a687ad8730ab6e015b6e
  • Pointer size: 130 Bytes
  • Size of remote file: 28.1 kB
images/AC406_a.png ADDED

Git LFS Details

  • SHA256: 25e305ff6e15eea1f777d94f920dff9be0e491d5345adb1ec1002aaa6a067f47
  • Pointer size: 129 Bytes
  • Size of remote file: 9.33 kB
images/AC406_b.png ADDED

Git LFS Details

  • SHA256: 821d8f9dc7d88d0ca51b70c80a1bad8981e38efd88e9df44dd5a3a2635e5dfa6
  • Pointer size: 129 Bytes
  • Size of remote file: 9.72 kB
images/AC406_c.png ADDED

Git LFS Details

  • SHA256: ed2ce08c354a79208ecf6524fbf723cdefc5a6daa35d663751fe22fe96243fb0
  • Pointer size: 129 Bytes
  • Size of remote file: 9.75 kB
images/AC406_d.png ADDED

Git LFS Details

  • SHA256: 827fdc00ed36d879557a4458187d930b62e543063abafb85c845c3dbc04f78f6
  • Pointer size: 130 Bytes
  • Size of remote file: 13 kB
images/AC406_q.png ADDED

Git LFS Details

  • SHA256: 6399228c53f545ebf4dd88959d73302b2de87c7842e2a687ad8730ab6e015b6e
  • Pointer size: 130 Bytes
  • Size of remote file: 28.1 kB
images/AC506_q.png ADDED

Git LFS Details

  • SHA256: b39f9d2c8f967474f1ea9f62c326c8a42ba55eab6b9df338059ed9dc7f97f087
  • Pointer size: 129 Bytes
  • Size of remote file: 4.79 kB
images/AC507_q.png ADDED

Git LFS Details

  • SHA256: ae03c5c28ddbe7f7f04a0b3a0aec5486053e2b8e3a62565bbed19531d9aa56bf
  • Pointer size: 130 Bytes
  • Size of remote file: 10.4 kB
images/AC508_q.png ADDED

Git LFS Details

  • SHA256: 1c87ab84fe801294654858073ca517dfc133eb052bd2061d25fe6c6f0acc2b66
  • Pointer size: 129 Bytes
  • Size of remote file: 4.48 kB
images/AC509_a.png ADDED

Git LFS Details

  • SHA256: 1c87ab84fe801294654858073ca517dfc133eb052bd2061d25fe6c6f0acc2b66
  • Pointer size: 129 Bytes
  • Size of remote file: 4.48 kB