Skip to content

Commit 896dfbe

Browse files
docs(gql): validate group discovery queries and fix stale templates
- Fix self query to use memberEvents/totalCount (was deprecated upcomingEvents/count) - Fix groupByUrlname query to use events/totalCount (same migration) - Add group(id:) query template (verified working via live API) - Document that node(id:) does not exist in Meetup schema - Document ID consistency between groupSearch and groupByUrlname - Complete task-017 and task-018 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 897a49f commit 896dfbe

5 files changed

Lines changed: 142 additions & 67 deletions

app/meetup_queries.gql

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ query {
1111
}
1212
}
1313

14-
# join first party events then filter group info
14+
# first-party events (techlahoma member events)
1515
query {
1616
self {
1717
id
1818
name
1919
username
2020
memberUrl
21-
upcomingEvents {
22-
count
21+
memberEvents(first: 10) {
22+
totalCount
2323
pageInfo {
2424
endCursor
2525
}
@@ -43,7 +43,7 @@ query {
4343
}
4444
}
4545

46-
# events by query var
46+
# events by query var
4747
# {"eventId":"285533748"}
4848
query($eventId: ID) {
4949
event(id: $eventId) {
@@ -84,8 +84,8 @@ query($id: ID!) {
8484
}
8585
}
8686

87-
# search for non pro network group by urlname
88-
{"urlname":"pythonistas"}
87+
# group by urlname (third-party / unaffiliated groups)
88+
# {"urlname":"pythonistas"}
8989
query($urlname: String!) {
9090
groupByUrlname(urlname: $urlname) {
9191
id
@@ -94,8 +94,8 @@ query($urlname: String!) {
9494
urlname
9595
city
9696
link
97-
upcomingEvents(input: { first: 3 }) {
98-
count
97+
events(first: 3) {
98+
totalCount
9999
pageInfo {
100100
endCursor
101101
}
@@ -119,8 +119,45 @@ query($urlname: String!) {
119119
}
120120
}
121121

122-
# query OKC area for programming groups' IDs
122+
# group by ID (validated: IDs match between groupByUrlname and groupSearch)
123+
# {"id":"35460866"}
124+
query($id: ID!) {
125+
group(id: $id) {
126+
id
127+
description
128+
name
129+
urlname
130+
city
131+
link
132+
events(first: 3) {
133+
totalCount
134+
pageInfo {
135+
endCursor
136+
}
137+
edges {
138+
node {
139+
id
140+
title
141+
description
142+
dateTime
143+
eventUrl
144+
group {
145+
id
146+
name
147+
urlname
148+
link
149+
city
150+
}
151+
}
152+
}
153+
}
154+
}
155+
}
156+
157+
# keyword search for programming groups in OKC area
123158
# topicCategoryId 546 = Technology (from topicCategories query)
159+
# IDs returned here match groupByUrlname IDs (verified for pythonistas, okcwebdevs, okccoffeeandcode)
160+
# node(id:) does NOT exist in Meetup's schema; use group(id:) or groupByUrlname(urlname:) instead
124161
{"query": "programming", "topicCategoryId": "546"}
125162
query ($query: String!, $topicCategoryId: ID) {
126163
groupSearch(
@@ -145,4 +182,3 @@ query ($query: String!, $topicCategoryId: ID) {
145182
}
146183
}
147184
}
148-
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
id: TASK-017
3+
title: Handle missing events and imprecise date parsing
4+
status: Done
5+
assignee: []
6+
created_date: '2026-02-27 00:54'
7+
updated_date: '2026-03-21 00:35'
8+
labels:
9+
- bug
10+
dependencies: []
11+
references:
12+
- app/meetup_query.py
13+
priority: medium
14+
ordinal: 8000
15+
---
16+
17+
## Description
18+
19+
<!-- SECTION:DESCRIPTION:BEGIN -->
20+
Two related data quality issues in meetup_query.py: (1) When a group has no upcoming events, format_response falls through to city comparison on a None/empty response instead of gracefully returning empty. (2) sort_json uses heuristics to determine the year when dates are in 'ddd M/D h:mm a' format (no year), which can produce incorrect years near year boundaries.
21+
<!-- SECTION:DESCRIPTION:END -->
22+
23+
## Acceptance Criteria
24+
<!-- AC:BEGIN -->
25+
- [x] #1 format_response returns empty DataFrame when group has no upcoming events without errors
26+
- [x] #2 sort_json derives year from the original ISO 8601 dateTime field instead of guessing
27+
- [x] #3 Tests cover empty event lists and year-boundary date parsing
28+
<!-- AC:END -->
29+
30+
## Final Summary
31+
32+
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
33+
Commit b1ffb41 fixes both issues in meetup_query.py:
34+
35+
1. **format_response** now catches `TypeError` alongside `KeyError` and uses `.get()` for safer navigation of `memberEvents`, `groupByUrlname`, and `events` fields. Null intermediate API fields return an empty DataFrame instead of crashing.
36+
37+
2. **sort_json** and **prepare_events** year-derivation logic improved: when parsing year-less `'ddd M/D h:mm a'` dates, if assigning the current year produces a date more than 6 months in the past, it bumps to the next year. This correctly handles Dec/Jan year boundaries.
38+
39+
7 new unit tests cover empty event lists, null API fields, and year-boundary date parsing for both ISO 8601 and human-readable formats.
40+
<!-- SECTION:FINAL_SUMMARY:END -->
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
id: TASK-018
3+
title: Validate GraphQL group discovery queries
4+
status: Done
5+
assignee: []
6+
created_date: '2026-02-27 00:54'
7+
updated_date: '2026-03-21 01:06'
8+
labels:
9+
- qa
10+
dependencies: []
11+
references:
12+
- app/meetup_queries.gql
13+
- app/meetup_query.py
14+
priority: low
15+
ordinal: 3000
16+
---
17+
18+
## Description
19+
20+
<!-- SECTION:DESCRIPTION:BEGIN -->
21+
meetup_queries.gql contains two unused query templates that need QA: (1) a keywordSearch query that returns node IDs for groups — need to verify these match the group IDs used elsewhere, and (2) a workflow to look up a group by ID and fall back to parsing urlname from URL if not found. These queries support the capture_groups GQL migration.
22+
<!-- SECTION:DESCRIPTION:END -->
23+
24+
## Acceptance Criteria
25+
<!-- AC:BEGIN -->
26+
- [x] #1 Confirm keywordSearch node IDs match groupByUrlname IDs for the same groups
27+
- [x] #2 Document whether group lookup by ID is possible or if urlname is the only key
28+
- [x] #3 Update or remove meetup_queries.gql templates based on findings
29+
<!-- AC:END -->
30+
31+
## Final Summary
32+
33+
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
34+
## Findings
35+
36+
### AC#1: keywordSearch IDs match groupByUrlname IDs
37+
Verified for three overlapping groups:
38+
- `pythonistas`: `35460866` (match)
39+
- `okcwebdevs`: `33258520` (match)
40+
- `okccoffeeandcode`: `24875064` (match)
41+
42+
The `groupSearch` query returns 37 results for "programming" in the OKC area (topicCategoryId 546). IDs are consistent across query types.
43+
44+
### AC#2: Group lookup by ID
45+
- `group(id: $id)` — works, returns full group data
46+
- `node(id: $id)` — does NOT exist in Meetup's GraphQL schema (ValidationError)
47+
- `groupByUrlname(urlname: $urlname)` — works (already in use)
48+
49+
Both `group(id:)` and `groupByUrlname(urlname:)` are valid lookup keys.
50+
51+
### AC#3: meetup_queries.gql updates
52+
- Fixed stale `self` query to use `memberEvents(first: 10)` with `totalCount` (was using deprecated `upcomingEvents`/`count`)
53+
- Fixed `groupByUrlname` query to use `events(first: 3)` with `totalCount` (was using deprecated `upcomingEvents`/`count`)
54+
- Added `group(id:)` query template with documentation
55+
- Added comments to `groupSearch` noting ID consistency and that `node(id:)` is not available
56+
<!-- SECTION:FINAL_SUMMARY:END -->

backlog/tasks/task-017 - Handle-missing-events-and-imprecise-date-parsing.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

backlog/tasks/task-018 - Validate-GraphQL-group-discovery-queries.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)