Skip to content

Public website

The pool UI is a plain HTML, CSS, and JavaScript site in public/, deployed to Azure Static Web Apps. It does not have a Node server, login flow, or linked Function API. GitLab Pages hosts the documentation only.

What visitors see

FeatureBehavior
Current-week cardMatchup, selected player’s squares, winnings, and available winners
Player selectorStarts unselected on a new browser, then remembers the visitor’s choice
List viewSchedule and the selected player’s numbers, with available result rows
Board view10×10 board that fits desktop widths and scrolls on narrower screens, with sticky score digits and highlighted squares
Game selectorChooses the board week; BYE weeks are omitted from the board
WinnersHalftime/final labels and a brief celebration for selected winners
About dialogBackground and contact links

Player selection is stored under the browser key ravens-pool-player. If browser storage is blocked, selection still works for the current visit. This preference is local to that browser and does not change the summary recipient or Azure settings.

The board uses Ravens digits across the top and opponent digits down the side, matching the printed sheet. Gold outlines mark the selected player’s squares; green labels identify winners. The scroll region remains keyboard-focusable. Long board names show an ellipsis; the full name remains in each square’s accessible label and appears on hover. Winner celebrations include a short vibration pattern when the browser and device allow it. Reduced-motion preferences disable confetti, vibration, and CSS transitions.

Search, sharing, and bookmarks

The preferred public URL is https://football-pool.bobclingan.work/. public/index.html includes a search description, canonical URL, Open Graph metadata, Twitter summary card metadata, theme color, and bookmark/touch icons. The existing 400×400 cardinal PNG supplies the preview image and icons. These tags are in the initial HTML so crawlers do not need to run JavaScript.

If the public domain changes, update the canonical link, og:url, og:image, and twitter:image together. Preview image URLs must remain absolute and publicly accessible. Descriptions describe the pool generally; live scores and player selections are not embedded in metadata. Social services may cache old previews after a deployment.

References: Open Graph protocol and Google’s supported metadata.

Results URL and CORS

The current RESULTS_PATH in public/app.js is:

const RESULTS_PATH =
"https://poolweb9173.blob.core.windows.net/$web/results.json";

For another storage account, change that constant and redeploy the website. The Function’s RESULTS_STORAGE_CONNECTION_STRING must publish to the same account.

sequenceDiagram
    participant Browser as Visitor browser
    participant SWA as Azure Static Web Apps
    participant Blob as Blob service endpoint
    Browser->>SWA: Request HTML, CSS, and JavaScript
    SWA-->>Browser: Static UI
    Browser->>Blob: GET results.json with cache bypass
    Blob-->>Browser: JSON and allowed-origin response
    Browser->>Browser: Render player, list, board, and winners

Configure the Blob service CORS rule to allow the exact origins used by the website, including the Azure hostname, any custom domain, and local development origins when needed. Use GET and HEAD, with headers appropriate to the request. An origin includes scheme and port but has no path.

Examples:

https://<app>.azurestaticapps.net
https://<custom-domain>
http://localhost:8080

CORS is a browser permission check; it does not grant anonymous access to a private blob. The current public feed also needs anonymous blob-read access. Do not put a storage connection string or expiring private credential in frontend code. The *.web.core.windows.net static website endpoint does not support Storage CORS. See Azure’s Storage website documentation.

Refresh and current-week rules

fetchJson() runs during page load and adds a timestamp query parameter with cache: "no-store". The publisher also sets Cache-Control: no-store, must-revalidate.

Each load makes up to three attempts, waiting 500 ms before the second attempt and 1 second before the third. Network errors, unsuccessful HTTP responses, and invalid or incomplete JSON all trigger retries. Every attempt bypasses the cache. This applies to initial loads, manual refreshes, and background refreshes. The refresh button stays disabled until the load finishes.

If all attempts fail, an initial load shows the reload message. A failed refresh keeps the last loaded results visible and reports that they could not be refreshed. Only the final failure is sent to Sentry; recovered attempts are not reported.

The Refresh results button fetches the latest JSON without changing the selected player, view, or board game. Returning to a tab after more than five minutes also checks for a newer snapshot in the background. The one-minute interval only recalculates the featured week using data already loaded.

The effective week advances at midnight Tuesday in America/New_York, keeping each game featured through the following Monday. This also handles the configured BYE entry. Browser date formatting preserves game calendar dates rather than shifting them according to the viewer’s timezone.

Browser error reporting

The public site reports JavaScript errors to Sentry: uncaught exceptions, unhandled promise rejections, and failures while loading or rendering results. Caught results-loading errors carry the tag operation: load-results; visitors see the reload message on initial failure or a status message when a refresh fails.

index.html loads the configuration, Sentry browser SDK, and initialization script before app.js. The SDK is pinned to version 10.42.0 with an integrity hash. If the SDK is blocked or unavailable, the application can still load results.

The project’s public DSN is already configured. GitLab deployment labels events as production and uses the commit SHA as the release. Local previews use development and send errors to the same project by default. See configuration for overrides and operations for a delivery check.

Session replay and performance tracing are not enabled. Default PII collection and breadcrumbs are disabled, and the application does not attach player identities or pool data to events. This integration covers the public site; Function failures remain in Azure monitoring.

Assets and cache versions

FileRole
index.htmlSemantic page structure and dependency references
app.jsFetching and rendering logic
sentry-config.jsPublic DSN and environment; regenerated during deployment
sentry.jsInitializes browser error reporting when a DSN and SDK are available
styles.cssLayout, board, responsive rules, and reduced motion
football-ball-rugby-field.webp2400×1642 background, about 301 KiB
cardinal.pngHeader emblem

The background was reduced from approximately 8.2 MiB to 301 KiB. Preserve the full composition when recompressing it; avoid replacing it with a multi-megabyte source photo. The stylesheet and script references in index.html use version query strings; update the appropriate value when shipping asset changes.

The page loads [email protected] from jsDelivr and uses ESPN-hosted team logos. The Sentry SDK loads from browser.sentry-cdn.com. These external assets are separate from the Python SBOMs. A missing confetti script should leave the results usable; application logic treats it as optional.

Local preview

Terminal window
python3 -m http.server 8080 --directory public

Open http://localhost:8080. With the current absolute Blob URL, the Blob CORS rule must permit that origin. For an isolated preview, temporarily use a relative results.json and a synthetic local feed; do not commit private state or credentials as sample data. Restore the intended production URL before committing.

Run the same lint check as CI:

Terminal window
npm ci --prefix ci/biome
ci/biome/node_modules/.bin/biome lint public --max-diagnostics=none

Game Stats

The Game Stats link on the pool page opens /stats.html. Use the six view buttons to explore the season and Back to the pool to return to the board. The page uses the same results feed and remembered player as the pool page.

ViewWhat it shows
Winnings leaderboardPlayers with earned prizes or recorded wins, ranked by earned amount, then name. Includes total wins and separate halftime and final counts. Earned amounts do not indicate payment.
Your season so farA player selector, earned prizes, number of winning games, total wins, latest win date, and a history of prize periods with the newest first. The selected player is remembered when browser storage is available.
Who’s still waiting?Only players with no recorded halftime or final wins, listed alphabetically, with their games without a win. Anyone who has won is excluded. Summary counts show players without a win and completed games.
Repeat winnersPlayers with at least one win, ranked by total wins, then best streak, then name. Includes winning games and each player’s longest streak, plus season-wide maximum streak and period-win counts.
Lucky digitsA heatmap of historical halftime and final score-digit pairs from this pool season. Ravens digits run across and opponent digits run down. The page also shows the total number of recorded score pairs.
Halftime-to-final changesThe percentage and count of games where the winning board square changed, alongside the number of games with both winners. A newest-first table lists the halftime winner, final winner, and whether the square changed.

Only verified (status: ok) non-bye results count. Streaks and waits count completed games rather than calendar weeks; halftime and final prizes count as separate wins. Leaderboard amounts come from published player_winnings, without assuming payout rates. The heatmap counts recorded halftime/final score digits and describes past results, not future probabilities. Square changes compare board coordinates, so two winning squares owned by one player still count as a change. Missing winner pairs are excluded from that percentage. Empty seasons and feed failures have explicit states, with a retry button for loading failures.

The stats page is implemented in public/stats.html, public/stats.js, and public/stats.css, with shared styling from public/styles.css. It reads players, results, numbers (for bye dates), and player_winnings from the published results feed; it does not need a separate statistics endpoint. The Lucky digits view uses this season’s results, while the historical win estimates below This week’s picks use the separate NFL sample described below.

Browser coverage lives in ci/playwright/tests/stats.spec.cjs and checks all six views on desktop and mobile, remembered player selection, exclusion of previous winners from the waiting list, empty seasons, and retry after a feed failure. Run it from the repository root with Playwright browsers and system dependencies installed:

Terminal window
npm test --prefix ci/playwright -- stats.spec.cjs

Historical win estimates

Below This week’s picks, selected players see separate halftime and final estimated win percentages across all their current-week squares, with rounded “About 1 in N” frequencies. An Either prize estimate counts historical games where any owned square matches halftime or final, counting a game with both wins only once. The methodology, sample size, and source are collapsed inside How this is estimated, which visitors can expand. These use a checked-in ESPN score snapshot of 1,359 completed NFL regular-season games from 2021–2025, including overtime in final scores. The canceled 2022 BUF–CIN game is excluded. Playoffs, preseason, and the incomplete 2026 season are excluded.

For each period, each historical game contributes its score digits in both team orientations, giving each team equal weight as the reference team. The count for each unique owned digit pair is summed and divided by twice the game count. Squares are mutually exclusive within a prize period, so their frequencies can be added; halftime and final estimates are kept separate. The either-prize estimate uses paired halftime/final observations instead of adding percentages or assuming independent outcomes. The two orientations are not independent games, and the page reports the actual game count.

These are historical league-wide baseline frequencies, not Ravens-specific, opponent-specific, or live-game predictions. A zero observed rate does not imply an impossible outcome. Estimates are hidden when no player or squares are selected, or during a bye. A missing or invalid odds asset leaves the pool usable and shows an unavailable message.

Data provenance: ESPN NFL scoreboards, using calendar-year scoreboard responses from 2021 through 2026 to capture January games belonging to the 2025 season. The compact source snapshot is in scripts/data/nfl-scores-2021-2025.json; public/win-odds.json records its SHA-256, retrieval date, sample size, season range, and aggregated counts. The browser loads only the small aggregate asset and does not call ESPN.

Rebuild the aggregate offline:

Terminal window
python3 scripts/build_win_odds.py

Refresh the historical snapshot from ESPN and rebuild:

Terminal window
python3 scripts/build_win_odds.py --download

The refresh fails on incomplete quarter data, inconsistent scores, or unexpected season coverage rather than publishing a partial sample. Tests verify aggregation, overtime handling, snapshot provenance, and probability-table totals.