Skip to content

Commit 4b2658e

Browse files
committed
Create Workgroup Analysis script
1 parent 5140e6e commit 4b2658e

File tree

2 files changed

+110
-0
lines changed

2 files changed

+110
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import json
2+
import requests
3+
from datetime import datetime
4+
from collections import Counter
5+
6+
def load_json_remote(url):
7+
"""Load JSON data from a remote URL."""
8+
response = requests.get(url)
9+
response.raise_for_status()
10+
return response.json()
11+
12+
def find_workgroups(obj, workgroup_keys=("workgroup", "workgroups")):
13+
"""
14+
Recursively search for all workgroup names in a JSON object.
15+
Returns a list of strings (workgroup names).
16+
"""
17+
found = []
18+
19+
if isinstance(obj, dict):
20+
for key, value in obj.items():
21+
# Match case-insensitively
22+
if key.lower() in workgroup_keys:
23+
if isinstance(value, str):
24+
found.append(value.strip())
25+
elif isinstance(value, list):
26+
for v in value:
27+
if isinstance(v, str):
28+
found.append(v.strip())
29+
else:
30+
found.extend(find_workgroups(value, workgroup_keys))
31+
32+
elif isinstance(obj, list):
33+
for item in obj:
34+
found.extend(find_workgroups(item, workgroup_keys))
35+
36+
return found
37+
38+
def write_markdown_report(workgroup_counts, output_file):
39+
"""Write results to a Markdown file."""
40+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
41+
with open(output_file, "w", encoding="utf-8") as f:
42+
f.write(f"# Workgroup Analysis Report\n")
43+
f.write(f"**Generated on:** {timestamp}\n\n")
44+
45+
total_unique = len(workgroup_counts)
46+
total_mentions = sum(workgroup_counts.values())
47+
48+
f.write("## Summary\n")
49+
f.write(f"- Total Unique Workgroups: {total_unique}\n")
50+
f.write(f"- Total Mentions: {total_mentions}\n\n")
51+
52+
f.write("## Workgroup Counts\n")
53+
f.write("| Rank | Workgroup | Mentions |\n|------|------------|-----------|\n")
54+
55+
for i, (wg, count) in enumerate(workgroup_counts.most_common(), 1):
56+
f.write(f"| {i} | {wg} | {count} |\n")
57+
58+
print(f"✅ Markdown report saved to: {output_file}")
59+
60+
def main():
61+
url = "https://raw.githubusercontent.com/SingularityNET-Archive/SingularityNET-Archive/refs/heads/main/Data/Snet-Ambassador-Program/Meeting-Summaries/2025/meeting-summaries-array.json"
62+
output_file = "workgroup_analysis_report.md"
63+
64+
print("📡 Fetching data from remote source...")
65+
data = load_json_remote(url)
66+
print(f"✅ Downloaded {len(data)} top-level records.")
67+
68+
print("🔍 Searching for workgroup mentions...")
69+
all_workgroups = find_workgroups(data)
70+
71+
if not all_workgroups:
72+
print("⚠️ No workgroups found in the JSON.")
73+
return
74+
75+
workgroup_counts = Counter(all_workgroups)
76+
77+
print(f"📊 Found {len(workgroup_counts)} unique workgroups.")
78+
for wg, count in workgroup_counts.most_common(10):
79+
print(f"- {wg}: {count}")
80+
81+
write_markdown_report(workgroup_counts, output_file)
82+
83+
if __name__ == "__main__":
84+
main()

workgroup_analysis_report.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Workgroup Analysis Report
2+
**Generated on:** 2025-10-13 13:00:57
3+
4+
## Summary
5+
- Total Unique Workgroups: 16
6+
- Total Mentions: 114
7+
8+
## Workgroup Counts
9+
| Rank | Workgroup | Mentions |
10+
|------|------------|-----------|
11+
| 1 | Governance Workgroup | 47 |
12+
| 2 | Marketing Guild | 10 |
13+
| 3 | Archives Workgroup | 9 |
14+
| 4 | AI Sandbox/Think-tank | 9 |
15+
| 5 | Education Workgroup | 8 |
16+
| 6 | AI Ethics WG | 8 |
17+
| 7 | WG Sync Call | 5 |
18+
| 8 | Knowledge Base Workgroup | 5 |
19+
| 9 | Writers Workgroup | 2 |
20+
| 10 | Research and Development Guild | 2 |
21+
| 11 | Onboarding Workgroup | 2 |
22+
| 12 | African Guild | 2 |
23+
| 13 | Gamers Guild | 2 |
24+
| 14 | Video Workgroup | 1 |
25+
| 15 | Treasury Automation WG | 1 |
26+
| 16 | Strategy Guild | 1 |

0 commit comments

Comments
 (0)