From 02c681e7de5193ef7e9eb6dcc16e7379755d9086 Mon Sep 17 00:00:00 2001 From: Chris Steege Date: Wed, 22 May 2024 12:18:28 -0400 Subject: [PATCH] Add script to produce decentralized network deployment csv --- .../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)