from db import load_data, load_config from graph import Graph import os DATA_DIR="/data" CONFIG_FILE="/config.yaml" FORMAT="pdf" def main(): # Get all YAML files in the data directory yaml_files = [f for f in os.listdir(DATA_DIR) if f.endswith(('.yaml', '.yml'))] config = load_config(CONFIG_FILE) for yaml_file in yaml_files: print(f"Processing {yaml_file}...") data = load_data(os.path.join(DATA_DIR, yaml_file)) graph = Graph() graph.set_config(config) graph.process_blocks(data) graph.build_dot() # Use the base name of the YAML file (without extension) as the output name base_name = os.path.splitext(yaml_file)[0] dot_file = os.path.join(DATA_DIR, f"{base_name}.gv") out_file = os.path.join(DATA_DIR, f"{base_name}.{FORMAT}") graph.make_dot(FORMAT, dot_file, out_file) if __name__ == "__main__": main()