-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_pipeline.py
31 lines (26 loc) · 1.04 KB
/
run_pipeline.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
import subprocess
import os
def run_script(script_path):
"""Executes a given Python script using subprocess."""
try:
subprocess.run(['python3', script_path], check=True)
print(f"Successfully executed {script_path}")
except subprocess.CalledProcessError as e:
print(f"Failed to execute {script_path}: {e}")
def main():
run_script('src/pdf_extractor.py') # Step 1: Extract PDFs to CSVs
run_script('src/csv_cleaner.py') # Step 2: Clean extracted CSVs
converter_scripts = [ # Step 3: Convert cleaned CSVs to JSONs using converter scripts
'converter_type_a.py',
'converter_type_b.py',
'converter_type_c.py',
'converter_type_d.py',
'converter_type_e.py',
'converter_type_f.py'
]
for script_name in converter_scripts:
script_path = os.path.join('src/json_converters', script_name)
run_script(script_path)
print("All PDFs have been successfully exported to JSONs at /exported-jsons/.")
if __name__ == "__main__":
main()