|
18 | 18 | for item in data: |
19 | 19 | if isinstance(item, dict): |
20 | 20 | workgroup = item.get("workgroup", "Unknown Workgroup") |
21 | | - # increment count |
22 | 21 | workgroup_counts[workgroup] += 1 |
23 | | - # build meeting info string |
24 | | - date = item.get("date", "Unknown Date") |
25 | | - title = item.get("title") or item.get("summary") or "" |
| 22 | + |
| 23 | + # pull date from nested meetingInfo.date |
| 24 | + meeting_info_obj = item.get("meetingInfo", {}) |
| 25 | + date = meeting_info_obj.get("date", "Unknown Date") |
| 26 | + |
| 27 | + # also capture typeOfMeeting or summary/title |
| 28 | + meeting_type = meeting_info_obj.get("typeOfMeeting", "") |
| 29 | + title = item.get("title") or item.get("summary") or meeting_type or "" |
| 30 | + |
26 | 31 | meeting_info = f"{date} - {title}".strip(" -") |
27 | 32 | workgroup_meetings[workgroup].append(meeting_info) |
28 | 33 | elif isinstance(data, dict): |
29 | 34 | workgroup = data.get("workgroup", "Unknown Workgroup") |
30 | 35 | workgroup_counts[workgroup] += 1 |
31 | | - date = data.get("date", "Unknown Date") |
32 | | - title = data.get("title") or data.get("summary") or "" |
33 | | - meeting_info = f"{date} - {title}".strip(" -") |
34 | | - workgroup_meetings[workgroup].append(meeting_info) |
35 | | - |
36 | | -# --- Build summary text --- |
37 | | -summary_lines = ["Workgroup Counts and Meetings Summary:\n"] |
38 | | - |
39 | | -for workgroup, count in workgroup_counts.items(): |
40 | | - summary_lines.append(f"\n{workgroup}: {count} meetings") |
41 | | - for i, meeting in enumerate(workgroup_meetings[workgroup], start=1): |
42 | | - summary_lines.append(f" {i}. {meeting}") |
43 | | - |
44 | | -summary_text = "\n".join(summary_lines) |
45 | | - |
46 | | -# --- Save to text file --- |
47 | | -with open("workgroup_meetings_summary.txt", "w", encoding="utf-8") as f: |
48 | | - f.write(summary_text) |
| 36 | + meeting_info_obj = data.get("meetingInfo", {}) |
| 37 | + date = meeting_info_ob |
49 | 38 |
|
50 | | -print("Summary saved to workgroup_meetings_summary.txt") |
51 | 39 |
|
0 commit comments