The Seedlot Selection Tool (SST) is an interactive GIS web application designed to assist forest managers and silviculture professionals in British Columbia. It enables users to match seedlots with optimal planting sites based on ecological characteristics and Biogeoclimatic Ecosystem Classification (BEC) variant compatibility, fully adhering to the Climate-Based Seed Transfer (CBST) standard standards.
Live Deployment: CBST Seedlot Selection Tool
Due to browser security restrictions (CORS), you cannot open the index.html file directly in a web
browser. Instead, you must serve the application from a local web server.
To make local development and quality control as seamless as possible, we leverage standard NPM scripts.
Before running tests, formatting code, or serving the application locally, make sure you install the project's development dependencies and compile the local binary FlatGeobuf database files:
npm install
npm run db:convertSpin up a local development server serving the /docs folder:
npm run dev- How it works: This command starts a lightweight, pre-configured Node-based server serving the
/docsfolder usinghttp-server. - Accessing the App: Once started, open your browser and navigate to:
http://localhost:8000
Verify JavaScript correctness, Prettier formatting consistency, and run lightweight unit tests:
npm run validate- How it works: This command runs three distinct checks sequentially:
- Executes ESLint 10+ flat config across the
docs/scripts/directory to detect logic errors and syntax issues. - Runs Prettier validation across HTML, CSS, and JS source files.
- Runs Node-native Unit Tests on helper utility functions.
- Executes ESLint 10+ flat config across the
- CI Integration: Every pull request automatically executes
npm run validateto ensure fast feedback.
Run the lightweight utility test suite in Node.js (uses the native node:test runner, no bundlers
or transpilation needed):
npm run test:unit- Speed: Executes in under 5 milliseconds!
- Tested Logic: Business logic helpers in
docs/scripts/main.js(e.g.,getIntersection,updateData).
Run the full end-to-end integration suite in a headless Chromium browser:
# 1. Install browser binary (one-time setup if needed)
npx playwright install chromium
# 2. Run tests in headless mode
npm run test:e2e
# 3. Open interactive Playwright UI for debugging/stepping through tests
npx playwright test --ui- Covered Workflows:
- Cutblock Flow: Simulates opening the Cutblock tab, selecting a species & BEC variant, and verifying the suitability and seedlot tables populate with live data.
- Orchard Representative Seedlot: Simulates entering an Orchard number, resolving the representative seedlot via AJAX, and displaying suitability results.
- Direct Seedlot Input: Simulates entering a Seedlot number, auto-detecting the associated Species and BEC variant, and running matching calculations.
Run both unit and E2E tests in a single command:
npm run testEvery Pull Request automatically triggers a parallel validation and integration testing pipeline in
GitHub Actions (.github/workflows/pr-open.yml):
- Lint & Unit Tests (
validatejob): Runs linting, formatting, and unit tests. Takes <15 seconds. - E2E Integration (
e2ejob): Boots up the local server inside the runner and executes Playwright tests. Takes ~20 seconds. - Deploy Preview Sandbox (
deployjob): Runs sequentially only after both validation and E2E testing jobs complete successfully, ensuring no regressions enter staging environments.
Automatically format all HTML, CSS, JS source files, and this README.md using our standardized
Prettier configuration:
npm run format- Formatting Style: This repository strictly matches the styling standard of our larger frontend
applications (such as
quickstart-openshift), which enforces:- Single quotes instead of double quotes (
singleQuote: true) - No trailing semicolons at the end of JS statements (
semi: false) - 2-space indents and standard Unix line endings (
lf) - Trailing commas for all multi-line structures (
trailingComma: 'all')
- Single quotes instead of double quotes (
nr-seedtransfer-map/
├── .github/workflows/ # Automated CI/CD pipelines
│ ├── merge.yml # Production branch deployment
│ ├── pr-close.yml # PR preview environment cleanup
│ ├── pr-open.yml # PR preview sandbox deployment
│ └── pr-validate.yml # Automated PR metadata validation
├── docs/ # Main application payload (GitHub Pages)
│ ├── css/ # Application stylesheets
│ ├── scripts/ # Core JavaScript files (Leaflet/ArcGIS logic)
│ │ ├── main.js # Business & suitability logic
│ │ ├── defineMap.js # Map rendering & widgets
│ │ └── requireMain.js # RequireJS entry point
│ ├── Version_7_0/ # Local JSON seedlot & migration datasets
│ └── index.html # Main HTML application entry point
├── eslint.config.mjs # ESLint 10+ flat config rules
└── README.md # You are here!
To ensure a clean, distraction-free developer experience, our client-side runtime contains a console
interceptor in loader-init.js that intercepts and silences expected external CDN/map-service
errors.
- Esri CDN Tile Load Failures:
- Signature:
[esri.views.2d.layers.features.FeatureSourceEventLog] Failed to load tile <coords>. - Reason: The map layers loaded from
maps.forsite.caare hosted feature services. Under high zoom levels or in certain bounds, some query tiles return 5xx errors from the server. The ArcGIS Maps SDK self-heals these failures automatically (by falling back or retrying), so these warnings are safe to silence. - Impact: Purely cosmetic; silenced to avoid red console spam.
- Signature:
This application is built for the Province of British Columbia and is open to contributions. Code is distributed under the Apache License 2.0.