fix: generalize access-request service classification and stat cards in analytics template (#4922) - #4930
Open
frano-m wants to merge 3 commits into
Open
fix: generalize access-request service classification and stat cards in analytics template (#4922)#4930frano-m wants to merge 3 commits into
frano-m wants to merge 3 commits into
Conversation
…in analytics template (#4922) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the shared static analytics HTML template to make access-request service classification more robust and to render access-request “stat cards” dynamically for any number of services, improving correctness when new/unknown services appear in the data.
Changes:
- Hardened and generalized
serviceName()(case-insensitive matching; hostname bucketing for unknowns; “Other” fallback). - Made access-request stat cards data-driven (service→count reduce; alphabetical service cards plus Total; dynamic grid columns with mobile override).
- Improved optional access-requests loading and rendering isolation (best-effort fetch; array validation; defensive coercions; render wrapped to avoid impacting the rest of the report).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…#4922) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
frano-m
force-pushed
the
fran/4922-access-request-service-cards
branch
from
August 18, 2026 02:54
4ad339c to
b3f4e90
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #4922
What changed
All changes are in the shared static analytics template (
analytics/analytics_package/analytics/static_site/template/index.html), fixing items 1–4 of #4909:serviceName()generalized and hardened: matches known services case-insensitively (parity withfetch.py'scase=Falsefiltering), buckets unknown services by hostname (tolerating schemeless URLs, strippingwww.so host variants merge), and returns "Other" for missing, non-string, or unparseable URLs.grid-template-columns: repeat(N, 1fr)so any card count fills the row evenly (with a mobile override so cards still stack under 768px). Previously exactly dbGaP/DUOS/Total were hardcoded, so a third service was counted in Total but got no card.access_requests.jsonis now fetched inloadData'sPromise.allalongside the other optional files (no extra serialized round-trip), rows are validated (Array.isArray, non-object rows filtered, counts coerced withNumber(...) || 0),totalis derived from the per-service counts so the cards always sum, and the render call is isolated in its own try/catch so a bad optional payload can't blank the rest of the report.How verified
serviceName()(mixed-case, schemeless,www.variants, non-hierarchical URLs, non-strings, null/undefined) and the count/grid arithmetic.click_url, null row) — 5 cards on one even row, totals sum correctly (15+2+2+3=22, table header agrees); real anvil-explorer data — single-service behavior unchanged (no stats grid, no Service column); object-instead-of-array payload — section hidden, rest of report intact, zero JS errors./code-reviewrounds; all confirmed findings fixed. One deliberate skip: moving the DUOS/dbGaP label mapping into the Python export layer (changes the data contract; candidate follow-up ticket).🤖 Generated with Claude Code