web: add DZDP concentration view to geolocation explorer#559
Open
nikw9944 wants to merge 12 commits into
Open
Conversation
c16258d to
f0c1137
Compare
|
🔗 Preview: https://pr-559.data.malbeclabs.com |
350a34f to
179d5f9
Compare
29968b0 to
e0673bf
Compare
87ea79c to
65459d4
Compare
e0673bf to
f35361c
Compare
f35361c to
291f341
Compare
Add view switcher (QA Explorer / DZDP Concentration / DZDP Validators) with URL query param sync and full DZDP concentration view including hero stat cards, anchor point map, country bar chart, ASN concentration list, how-it-works strip, and CTA banner.
Use fetchWithRetry for consistency with other API functions, and memoize setView callback in the view switcher.
The types and fetch function are already provided by the #549 branch.
The geo concentration and validators handlers silently returned empty responses when DZDP tables were unavailable (ClickHouse error code 60). This made it impossible to diagnose why PR preview environments showed empty data. Add slog.Warn logging and also handle error codes 81 (UNKNOWN_DATABASE) and 497 (NOT_ENOUGH_PRIVILEGES) which occur when the ClickHouse user lacks grants on the dzdp database.
291f341 to
2cb8896
Compare
ben-dz
reviewed
May 8, 2026
ben-dz
left a comment
Contributor
There was a problem hiding this comment.
Scrolling seems to be broken in the preview. The data at the bottom cuts off wherever the browser window ends. Perhaps make the cotent layout and map size dynamic based on the size of the window, then have the tables scroll?
ben-dz
reviewed
May 8, 2026
ben-dz
left a comment
Contributor
There was a problem hiding this comment.
"No Metro coordinate data available" flashes up when the page is loading- perhaps a different "Loading Metro Coordinate data" makes more sense during load?
Contributor
Contributor
- Make map height dynamic using clamp(250px, 40vh, 500px) instead of fixed 400px so content doesn't cut off at browser window edge - Add min-h-0 to content container for proper flex overflow scrolling - Add max-height with overflow scroll to ASN list - Show "Loading metro coordinate data" spinner instead of "No metro coordinate data available" while metros query is in flight
Drop the CROSS JOIN + geoDistance + arraySort CTEs from both geo handlers. The SQL now returns enriched validators with lat/lng, and Go assigns the nearest metro using Haversine distance and deduplicates by vote_pubkey. The query itself runs in ~30ms but was timing out under contention when heavy queries (edge scoreboard, bulk metrics) saturated ClickHouse memory. Removing the CROSS JOIN and two GROUP BY CTEs reduces the ClickHouse work and memory footprint, making the query more resilient to concurrent load.
# Conflicts: # api/handlers/geo_validators.go
The DzdpConcentrationView's overflow-y-auto requires all ancestor flex-col containers to have min-h-0. Without it, the content could extend beyond the viewport instead of scrolling within the page.
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.


Summary of Changes
?view=) to the geolocation explorer pageslog.Warnlogging and handle ClickHouse error code 81 (UNKNOWN_DATABASE) in geo concentration/validators handlers for better diagnostics when DZDP tables are unavailableResolves: #550
Diff Breakdown
Mostly new frontend code — one large new component plus page-level wiring and minor API handler improvements.
Key files (click to expand)
web/src/components/dzdp-concentration-view.tsx— new concentration dashboard component with hero stats, map, charts, and explainerweb/src/components/geoloc-explorer-page.tsx— add view switcher with URL query param sync, refactor existing map into QAExplorerViewapi/handlers/geo_concentration.go— add warning log and UNKNOWN_DATABASE error handlingapi/handlers/geo_validators.go— add warning log and UNKNOWN_DATABASE error handlingTesting Verification
?view=URL param, defaults toexplorerfor unknown values