Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DAT-2798]; Add script to produce decentralized network deployment csv #2552

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions deployment/produce_decentralized_network_csv.py
Original file line number Diff line number Diff line change
@@ -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)
Loading