Skip to content

Commit 4b64d07

Browse files
committed
Summary of WG Counts from JSON
1 parent 1f5af06 commit 4b64d07

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed

Import-JSON.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
11
import requests
22
import json
3+
from collections import Counter
34

4-
url = "https://raw.githubusercontent.com/SingularityNET-Archive/SingularityNET-Archive/refs/heads/main/Data/Snet-Ambassador-Program/Meeting-Summaries/2025/meeting-summaries-array.json" # replace with your remote JSON URL
5+
# URL to the JSON file
6+
url = "https://raw.githubusercontent.com/SingularityNET-Archive/SingularityNET-Archive/refs/heads/main/Data/Snet-Ambassador-Program/Meeting-Summaries/2025/meeting-summaries-array.json"
57

8+
# Fetch JSON data from URL
69
response = requests.get(url)
710
data = response.json()
811

9-
# Handle if JSON is a list
12+
# --- Count workgroup values ---
13+
workgroup_counts = Counter()
14+
15+
# If top-level JSON is a list:
1016
if isinstance(data, list):
11-
data = data[0]
17+
for item in data:
18+
if isinstance(item, dict):
19+
workgroup = item.get("workgroup", "Unknown Workgroup")
20+
workgroup_counts[workgroup] += 1
21+
# If top-level JSON is a dict:
22+
elif isinstance(data, dict):
23+
workgroup = data.get("workgroup", "Unknown Workgroup")
24+
workgroup_counts[workgroup] += 1
25+
26+
# --- Save summary to a text file ---
27+
summary_lines = ["Workgroup Counts Summary:\n"]
28+
for workgroup, count in workgroup_counts.items():
29+
summary_lines.append(f"{workgroup}: {count}")
30+
31+
summary_text = "\n".join(summary_lines)
1232

13-
workgroup = data.get("workgroup", "Unknown Workgroup")
14-
print(workgroup)
33+
with open("workgroup_summary.txt", "w", encoding="utf-8") as f:
34+
f.write(summary_text)
1535

36+
print("Summary saved to workgroup_summary.txt")

workgroup_summary.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Workgroup Counts Summary:
2+
3+
Archives Workgroup: 9
4+
Governance Workgroup: 47
5+
Education Workgroup: 8
6+
AI Sandbox/Think-tank: 9
7+
Video Workgroup: 1
8+
Marketing Guild: 10
9+
AI Ethics WG: 8
10+
WG Sync Call: 5
11+
Knowledge Base Workgroup: 5
12+
Writers Workgroup: 2
13+
Research and Development Guild: 2
14+
Onboarding Workgroup: 2
15+
African Guild: 2
16+
Treasury Automation WG: 1
17+
Gamers Guild: 2
18+
Strategy Guild: 1

0 commit comments

Comments
 (0)