-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdescriptivestats.py
45 lines (34 loc) · 1.28 KB
/
descriptivestats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import json
# Load the JSON data
with open('Evaluation/Preprocessing/pre-annotated.json') as f:
data = json.load(f)
# print(data['study_subjects']["research_software"])
# Extract statistics
study_subjects = data['study_subjects']["research_software"]
total_subjects = 0
for subject in study_subjects:
total_subjects = int(subject['id'])
print(f'Total subjects: {total_subjects}')
# Extract plan types
plan_types = []
for subject in study_subjects:
for plan in subject['plans']:
plan_types.append(plan['type'])
print(f'Plan types: {plan_types}')
# Extract readme instructions
readme_instructions = []
for subject in study_subjects:
readme_instructions.append(subject['readme_instructions'])
# print(f'Readme instructions: {readme_instructions}')
plan_types_and_steps = {}
for subject in study_subjects:
plan_types_and_steps[subject['id']] = {}
for plan in subject['plans']:
plan_types_and_steps[subject['id']][plan['type']] = len(plan['steps'])
# Print the plan types and number of steps per type
for id, plan_types in plan_types_and_steps.items():
print(f'For id {id}:')
print('| Plan Type | Number of Steps |')
print('|-----------|-----------------|')
for plan_type, num_steps in plan_types.items():
print(f'| {plan_type} | {num_steps} |')