Add bounded query-page opportunities to GSC analytics and normalization#430
Open
Add bounded query-page opportunities to GSC analytics and normalization#430
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
QUERY_PAGE_OPPORTUNITIES_ROW_LIMIT = 2500andQUERY_PAGE_OPPORTUNITIES_MAX_WINDOW_DAYS = 90and use them for the GSC['query','page']request to bound rows and date window inbackend/services/gsc_service.py._get_query_page_opportunity_windowto derive a bounded start/end date for the query+page request and includedquery_page_data.requested_windowmetadata in the returned analytics payload.query_page_opportunitiesprocessing inbackend/services/analytics/handlers/gsc_handler.pyto transform query+page rows into a prioritized list (fields:query,page,clicks,impressions,ctr,position) sorted by opportunity and capped (top 100) for downstream consumption, and included this field in both success and error/partial responses.backend/api/content_planning/services/content_strategy/autofill/normalizers/analytics_normalizer.pyto pass throughquery_page_opportunitiesinto the normalized analytics structure.Testing
python -m compileall backend/services/gsc_service.py backend/services/analytics/handlers/gsc_handler.py backend/api/content_planning/services/content_strategy/autofill/normalizers/analytics_normalizer.py, which completed successfully.Codex Task