Skip to content

Add ResolvePlaces API, tabular place_dcids, and Spanner topic expansion - #2077

Open
keyurva wants to merge 3 commits into
datacommonsorg:masterfrom
keyurva:place-dcid
Open

Add ResolvePlaces API, tabular place_dcids, and Spanner topic expansion#2077
keyurva wants to merge 3 commits into
datacommonsorg:masterfrom
keyurva:place-dcid

Conversation

@keyurva

@keyurva keyurva commented Jul 31, 2026

Copy link
Copy Markdown
Contributor
  • Added ResolvePlaces endpoint in the agent service to resolve place names to DCIDs with 1:1 row alignment (including placeholder rows for unresolved queries).
  • Updated SearchIndicators to support tabular place_dcids input, preserve input place ordering, and aggregate child topic place availability prior to topic pruning.
  • Updated SpannerDataSource vector search resolution to expand topic candidates when expand_topics: true is set.
  • Added table-driven unit tests for place resolution edge cases and place existence filtering.

Verification

Tested locally as follows:

  1. ResolvePlaces Alignment Test (valid and unresolved places):
curl -X POST http://localhost:8081/v2/agent/resolve_places \
  -H "Content-Type: application/json" \
  -d '{
    "queries": ["california", "nonexistent_place_xyz"]
  }' | jq .
  1. SearchIndicators with Tabular place_dcids & Topic Expansion:
curl -X POST http://localhost:8081/v2/agent/search_indicators \
  -H "Content-Type: application/json" \
  -d '{
    "query": "health",
    "place_dcids": ["geoId/06"],
    "per_search_limit": 5,
    "expand_topics": true,
    "include_topics": true
  }' | jq .

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new V2AgentResolvePlaces RPC endpoint to resolve place name queries to canonical DCIDs, names, and types. It also refactors the SearchIndicators endpoint to support a tabular response format and accept explicit place_dcids directly, bypassing place resolution. Additionally, common helper functions and constants are refactored into a new util.go file. The review feedback suggests using the generated protobuf getter GetMetadata() instead of accessing the Metadata field directly in search_indicators.go for safer and more idiomatic code.

Comment thread internal/agent/search_indicators.go Outdated
Comment thread internal/agent/search_indicators.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant