-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_v2.py
More file actions
84 lines (73 loc) · 4.4 KB
/
Copy pathmain_v2.py
File metadata and controls
84 lines (73 loc) · 4.4 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import os
import program_health_script_v6
import createtraining_summary_overviewcount
import api_report_config
import api_obschecklist_config
import pivotdata_v2_module
import merge_trainingdataog
import mergetrainingdata_module # Import the merge module
# Get file paths function as before
def get_file_paths(operation):
username = os.getlogin()
python_path = f'/Users/{username}/python'
input_file = input(f'Enter a file name for {operation} (.csv, .xlsx, or .json): ')
file_name_without_extension, file_extension = os.path.splitext(input_file)
input_file_path = os.path.expanduser(f'{python_path}/inputs/{input_file}')
output_dir = os.path.expanduser(f'{python_path}/outputs')
os.makedirs(output_dir, exist_ok=True)
report_output_dir = os.path.expanduser(f'{python_path}/reports')
os.makedirs(report_output_dir, exist_ok=True)
checklist_output_dir = os.path.expanduser(f'{python_path}/checklists')
os.makedirs(checklist_output_dir, exist_ok=True)
return python_path, input_file_path, file_name_without_extension, file_extension, output_dir, report_output_dir, checklist_output_dir
# New function to get dual file paths for merging Spec and TM reports
def get_dual_paths(operation):
username = os.getlogin()
python_path = f'/Users/{username}/python'
# Prompt explicitly for TM data and Spec data
input_file1 = input(f'Enter the TM data file name for {operation} (.csv or .xlsx): ')
file1_name_without_extension, file1_extension = os.path.splitext(input_file1)
input_file1_path = os.path.expanduser(f'{python_path}/inputs/{input_file1}')
input_file2 = input(f'Enter the Spec data file name for {operation} (.csv or .xlsx): ')
file2_name_without_extension, file2_extension = os.path.splitext(input_file2)
input_file2_path = os.path.expanduser(f'{python_path}/inputs/{input_file2}')
output_dir = os.path.expanduser(f'{python_path}/outputs')
os.makedirs(output_dir, exist_ok=True)
return input_file1_path, file1_extension, input_file2_path, file2_extension, output_dir
# Main function handling user choices
def main():
print("Select the scripts to run (comma-separated numbers for multiple selections):")
print("1. Program Health Script V6")
print("2. Summary Program Overview")
print("3. LMS API Report (.json required)")
print("4. LMS API Observation Checklist (.json required)")
print("5. Product Spec V2")
print("6. Merge Spec and TM reports")
choices = input("Enter your choices: ").split(',')
# For each choice, get the appropriate file path
for choice in choices:
choice = choice.strip()
if choice == '1':
_, input_file_path, file_name_without_extension, file_extension, output_dir, _, _ = get_file_paths('Program Health Script V6')
program_health_script_v6.process(input_file_path, file_name_without_extension, file_extension, output_dir)
elif choice == '2':
_, input_file_path, file_name_without_extension, file_extension, output_dir, _, _ = get_file_paths('Summary Program Health')
createtraining_summary_overviewcount.process(input_file_path, file_name_without_extension, file_extension, output_dir)
elif choice == '3':
_, input_file_path, _, file_extension, _, report_output_dir, _ = get_file_paths('LMS API Report')
api_report_config.process(input_file_path, file_extension, report_output_dir)
elif choice == '4':
_, input_file_path, _, file_extension, _, _, checklist_output_dir = get_file_paths('LMS API Observation Checklist')
api_obschecklist_config.process(input_file_path, file_extension, checklist_output_dir)
elif choice == '5':
# Handle Product Spec V2
_, input_file_path, file_name_without_extension, file_extension, output_dir, _, _ = get_file_paths('Product Spec V2')
pivotdata_v2_module.process(input_file_path, file_name_without_extension, file_extension, output_dir)
elif choice == '6':
# Using get_dual_paths to handle merging Spec and TM reports
input_file1_path, file1_extension, input_file2_path, file2_extension, output_dir = get_dual_paths('Merge Spec and TM reports')
mergetrainingdata_module.process(input_file1_path, file1_extension, input_file2_path, file2_extension, output_dir)
else:
print(f"Invalid choice: {choice}")
if __name__ == "__main__":
main()