From 69c6e985aee4fc2a74e6da6d1e8fe14ce6dcad6c Mon Sep 17 00:00:00 2001 From: Chris Steege <56660047+steegecs@users.noreply.github.com> Date: Thu, 23 May 2024 12:20:36 -0400 Subject: [PATCH] [DAT-2798]; Add script to produce decentralized network deployment csv (#2552) --- .../produce_decentralized_network_csv.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 deployment/produce_decentralized_network_csv.py diff --git a/deployment/produce_decentralized_network_csv.py b/deployment/produce_decentralized_network_csv.py new file mode 100644 index 0000000000..cdb9a0ff9c --- /dev/null +++ b/deployment/produce_decentralized_network_csv.py @@ -0,0 +1,38 @@ +import json +import pandas as pd + + +def extract_deployment_info(data): + rows = [] + for project_name, project_data in data.items(): + schema = project_data.get("schema", "N/A") + deployments = project_data.get("deployments", {}) + for deployment_name, deployment_data in deployments.items(): + if "decentralized-network" in deployment_data["services"]: + decentralized_network = deployment_data["services"]["decentralized-network"] + row = { + "deployment name": deployment_name, + "protocol type": schema, + "network": deployment_data["network"], + "status": deployment_data["status"], + "slug": decentralized_network["slug"], + "query-id": decentralized_network["query-id"] + } + rows.append(row) + return rows + +with open('deployment.json', 'r') as file: + general_data = json.load(file) + +# Extract information +rows = extract_deployment_info(general_data) + +# Create DataFrame +df_general = pd.DataFrame(rows) + +## order by protocol type and deployment name +df_general = df_general.sort_values(by=["protocol type", "deployment name"]) + +# Save to CSV +csv_file_path_general = "decentralized_network_deployments.csv" +df_general.to_csv(csv_file_path_general, index=False)