Skip to content

Add variant support to accuracy-viewer#67

Open
snomos wants to merge 3 commits into
mainfrom
accuracy-viewer-variants
Open

Add variant support to accuracy-viewer#67
snomos wants to merge 3 commits into
mainfrom
accuracy-viewer-variants

Conversation

@snomos
Copy link
Copy Markdown
Member

@snomos snomos commented Apr 16, 2026

This PR extends the accuracy-viewer to support multiple report variants.

Changes

Functionality

  • Auto-discover variants: Checks for report-*.json files (common patterns: NO, SE, Cans, Cyrl, Latn, FI, SV, EN)
  • Variant selector: Dropdown menu in upper right corner when multiple variants are available
  • URL parameter support: Navigate directly to variants using ?variant=TAG
  • Default behavior: Falls back to report.json when no variant is specified

UI

  • Variant selector positioned in upper right corner (below theme toggle)
  • Responsive design for mobile devices
  • Only shows when multiple variants are detected

Files Modified

  • support/accuracy-viewer/src/App.svelte: Added variant discovery and selection logic
  • .gitignore: Updated to exclude all report*.json files (including variants)

Testing

Tested with real data from lang-smj repository which contains report.json, report-NO.json, and report-SE.json.

The bundled files (bundle.js, bundle.css) are not included in this PR as they should be built during deployment. To test locally:

cd support/accuracy-viewer
npm install
npm run build
npm run start

Related

Based on existing implementation pattern from giellalt/lang-smj.

Extend accuracy-viewer to support multiple report variants:
- Auto-discover report-*.json files
- Add variant selector dropdown (upper right corner)
- Support ?variant=TAG URL parameter
- Default to report.json when no variant specified
- Update .gitignore to exclude all report*.json files
@snomos snomos requested a review from bbqsrc April 16, 2026 11:26
snomos added 2 commits April 17, 2026 09:34
Replace hardcoded variant tags with dynamic discovery from ../badgedata/fst-variants.json.
This reads the existing variant metadata from lang-* repositories and checks for
corresponding report-*.json files.

Supports all variant types:
- areas (e.g., NO, SE)
- dialects
- orthographies
- writing_systems
- Remove HEAD requests when checking for variant report files
  Trust that variants listed in fst-variants.json have corresponding reports
  Show error message if report file is missing when user selects it

- Improve UI responsiveness during report loading:
  Clear report data immediately when changing variants (shows loading state)
  Use setTimeout(0) to yield to browser between data processing and rendering
  Don't await fetchReport() in onMount so variant selector appears faster

Note: Large reports (17MB+) will still cause UI to freeze during initial
rendering due to DOM manipulation. This is a known browser limitation when
rendering thousands of table rows.
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