Conversation
Improved aesthetically the calibration screen
- Add Jest/React Testing Library setup - Add tests for: - Redux auth slice (login, logout, state transitions) - Redux store configuration - Firebase authentication (sign in, sign up, sign out) - Firestore operations (doc, setDoc, getDoc) - Firebase configuration validation - Button component - Input component - Add Firebase mocks for testing - Add GitHub Actions workflow to run tests on PRs - Workflow blocks merge if tests don't pass 90% threshold - Add test:ci script for CI environments Total: 83 tests across 7 test suites
…culation - Changed npm ci to npm install to avoid package-lock sync issues - Fixed bash regex parsing (removed -P flag not available on Ubuntu) - Simplified workflow to single test job with quality gate check - Use awk instead of bc for arithmetic operations - Fixed quality gate job to properly check needs.test.result
- Import Button and Input directly from their folders instead of barrel export - Barrel export (components/index.js) triggers Firebase init via Layout/Navbar - All 83 tests now pass
Add unit tests and CI/CD workflow
…into feature/algorithm-velocity
Added docstrings to Calibration screen, and deleted redundant imports
…into feature/results-page
Add doc and test for gameTest
…into feature/results-page
Feature/results page
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||||||||||||||||
User description
v0.0.2 release.
Finished calibration , added unit tests, added documentation, fixed accuracy and other metric algorithms, added results page.
PR Type
Enhancement, Tests, Bug fix
Description
Comprehensive unit test suite: Added 1000+ lines of tests covering iris tracking, saccade detection, accuracy calculation, Firebase operations, Redux store, and UI components with mocks and edge case handling
Iris tracking refactoring: Implemented local eye coordinate system using
getRelativeIrisPos()for improved accuracy, replacing raw landmark indices with normalized positioningAdaptive threshold system: Added per-trial velocity-based threshold calculation in
velocityConfig.jsand integrated throughout saccade detection and analysis pipelineWebcam-optimized accuracy metrics: New
accuracyAdjust.jsmodule with quality-weighted fixation analysis, saccadic gain calculation, and ADHD biomarker detection tailored for 30fps webcam trackingClinical interpretation layer: Enhanced Results view with research-based ADHD thresholds, dual doughnut accuracy charts, and detailed clinical findings based on Karatekin et al. (2010) and Lee et al. (2020)
Calibration improvements: Ridge regression support with cross-validation, enhanced UI with permission handling, animated demo visualization, and synchronization guards
Validation relaxation: Loosened saccade detection constraints (time delta, binocular requirements, disparity handling) for improved real-world webcam performance
CI/CD pipeline: Added GitHub Actions workflow with automated testing across Node.js versions, coverage reporting, and quality gates
Firebase mocking infrastructure: Created comprehensive mock modules for auth, Firestore, and storage for testing
Route restructuring: Moved GameTest outside layout wrapper for fullscreen support
Diagram Walkthrough
File Walkthrough
18 files
iris-facemesh.test.js
Comprehensive unit tests for iris face mesh trackersrc/tests/utils/iris-facemesh.test.js
IrisFaceMeshTrackerclass functionalitycalibration model setup, gaze prediction, trial context management,
saccade detection, and CSV export
consistency
saccadeData.test.js
Unit tests for saccade data analysis modulesrc/tests/utils/saccadeData.test.js
(
analyzeSaccadeData,aggregateTrialStatistics,compareProVsAnti)(express/normal/delayed), invalid frame handling, and pro vs
anti-saccade comparisons
handling
configuration
accuracyAdjust.test.js
Unit tests for accuracy calculation modulesrc/tests/utils/accuracyAdjust.test.js
calculateAccuracyfunctiondetection, fixation stability assessment, and binocular disparity
handling
quality
detectSaccade.test.js
Unit tests for saccade detection modulesrc/tests/utils/detectSaccade.test.js
(
detectSaccade,calculateAdaptiveThreshold,detectSaccadeRaw)velocity threshold detection, and binocular disparity handling
velocity distributions
parameters
auth.test.js
Firebase authentication unit testssrc/tests/firebase/auth.test.js
registration, login, logout, and profile updates
found scenarios
sequences)
firestore.test.js
Firestore database operation unit testssrc/tests/firebase/firestore.test.js
creation, retrieval, and user data operations
registration/login
authSlice.test.js
Redux authentication slice unit testssrc/tests/store/authSlice.test.js
(
login,logout,setLoading,setError)login/logout flows
firebaseConfig.test.js
Firebase configuration and setup testssrc/tests/firebase/firebaseConfig.test.js
variables and config structure
Results.test.js
Results view component unit testssrc/tests/views/Results.test.js
dashboard rendering with charts
GameTest.test.js
GameTest view component unit testssrc/tests/views/GameTest.test.js
API
operations
store.test.js
Redux store configuration unit testssrc/tests/store/store.test.js
dispatching
firebase.js
Firebase mock module for testingsrc/mocks/firebase.js
functions
createUserWithEmailAndPassword,signInWithEmailAndPassword,signOut,updateProfiledoc,setDoc,getDoc, and collectionoperations
mockAuthenticatedUserandmockUnauthenticatedUserfor test state managementInput.test.js
Input component unit testssrc/tests/components/Input.test.js
values, labels, and input types (password, email)
Button.test.js
Button component unit testssrc/tests/components/Button.test.js
classes (primary/secondary), and fullWidth styling
Instructions.test.js
Instructions view component unit testssrc/tests/views/Instructions.test.js
click
useNavigateand Helmet componentsauth.js
Firebase auth mock modulesrc/mocks/firebase/auth.js
getAuth,createUserWithEmailAndPassword,signInWithEmailAndPassword,signOut,updateProfile, andonAuthStateChangedfunctionsapp.js
Firebase app initialization mock modulesrc/mocks/firebase/app.js
initializeApp,getApps, andgetAppfunctionsstorage.js
Firebase Storage mock modulesrc/mocks/firebase/storage.js
getStorage,ref,uploadBytes, andgetDownloadURLfunctions16 files
iris-facemesh.js
Refactor iris tracking with local coordinates and enhanceddocumentationsrc/views/GameTest/utils/iris-facemesh.js
(relative to eye corners) instead of raw landmark indices
getRelativeIrisPos()method implementing vector projection fornormalized iris positioning
predictGaze()with metadata-aware coordinate system detectionand fallback normalization
settings
point structure
debug information
dotCalibration.js
Calibration refactored to use local eye coordinatessrc/views/Calibration/utils/modules/dotCalibration.js
using
getRelativeIrisPos()getDotPoints()to return both pixel and normalized coordinatesfor calibration points
artifacts
detailed landmark information
margins) instead of magic numbers
index.js
Add clinical interpretation and ADHD threshold analysis to resultssrc/views/Results/index.js
variability metrics
interpretationmemo that generates clinical findings basedon threshold comparisons
anti-saccade) with custom legend
findings list
et al. (2020)
groups
saccadeData.js
Integrate adaptive thresholds and gain-based accuracy metricssrc/views/GameTest/utils/saccadeData.js
calculateAccuracyfromaccuracyAdjustmodulecategories
compareProVsAnti()with safety checks andfallback values
classification output
accuracyAdjust.js
New webcam-optimized accuracy calculation with adaptive ROIsrc/views/GameTest/utils/accuracyAdjust.js
adaptive ROI
velocity plausibility
over landing precision
stability vs 80% desktop)
detection
tracking)
debugging
index.js
Implement adaptive per-trial thresholds and improved calibrationvalidationsrc/views/GameTest/index.js
window velocities
100ms intervals)
value
transitions
getRelativeTime()method
mathUtils.js
Enhanced calibration math utilities with regression algorithmssrc/views/Calibration/utils/modules/mathUtils.js
implementations:
leastSquares(OLS) andridgeRegression(L2regularization)
gaussianEliminationfunction for solving linear systems withpivoting and singular matrix detection
findOptimalLambdafunction using k-fold cross-validationto find optimal regularization parameter
concepts and parameters
display.js
Calibration model fitting with ridge regression supportsrc/views/Calibration/utils/modules/display.js
displayPredictionModelto support both OLS and RidgeRegression methods via
useRidgeparameterranges and symmetry checks
findOptimalLambdafor cross-validation-based lambdaselection
coordinate system information
index.js
Calibration UI improvements and permission handlingsrc/views/Calibration/index.js
data.metrics?.accuracyinsteadof
data.metrics?.detailssections
calibration pattern
velocityConfig.js
Enhanced velocity configuration with latency validationsrc/views/GameTest/utils/velocityConfig.js
window.screentowindow.innerWidth/innerHeightfor better accuracytrials with express/normal/delayed classifications
detection
calculatePerTrialThresholdfunction for per-trial adaptivethreshold calculation with fixation velocity filtering
minimum fixation samples from 10 to 20
video.js
Camera stream initialization with permission handlingsrc/views/Calibration/utils/modules/video.js
cameraLoopandstartDistanceCheckfunctions
frame rate (60fps min 30fps) parameters
check
stopDistanceCheckfunctioncalibration.js
Calibration process synchronization and documentationsrc/views/Calibration/utils/calibration.js
calibrationRunningflag to prevent multiple simultaneouscalibration sessions
initCalibrationwith guard logic to prevent duplicatecalibration starts
faceModel.js
MediaPipe FaceLandmarker initialization improvementssrc/views/Calibration/utils/modules/faceModel.js
@latestfor automatic updates
faceLandmarkerglobal andinitFaceLandmarkerfunction(all set to 0.5)
distance.js
Distance validation threshold and documentationsrc/views/Calibration/utils/modules/distance.js
CLOSEdistance threshold from 0.25 to 0.30distanceOKflag,computeEyeDistance, andhandleDistanceStatefunctionsCalibration.css
Calibration UI styling enhancementssrc/views/Calibration/Calibration.css
layout
9-point pattern
panel
support
Results.css
Results view styling improvementssrc/views/Results/Results.css
styles
formatting
1 files
accuracy.js
Archive original accuracy calculation implementationsrc/views/GameTest/utils/accuracy.js
lines)
2 files
domRefs.js
Add documentation and camera permission modal referencesrc/views/Calibration/utils/modules/domRefs.js
refsobject andinitDomRefs()functionpermissionModal)index.js
Instructions view documentationsrc/views/Instructions/index.js
component and its purpose
3 files
detectSaccade.js
Relaxed saccade detection validation constraintssrc/views/GameTest/utils/detectSaccade.js
(relaxed constraint)
of both eyes
isValid: truewith reason flaginstead of
isValid: falsefor excessive disparityapp.js
GameTest route restructuring for fullscreen supportsrc/app.js
gameTestroute outside of the main layout route to renderwithout the layout wrapper
fullscreen without header/footer
GameTest.css
GameTest fullscreen and dot positioning adjustmentssrc/views/GameTest/GameTest.css
calc(100vh - 60px)to100vhfor fullscreencoverage
3 files
setupTests.js
Jest test environment configurationsrc/setupTests.js
window.matchMediaand
ResizeObservertests
@testing-library/jest-domfor extended matcherstest.yml
GitHub Actions CI/CD test workflow with quality gates.github/workflows/test.yml
pull requests to main, master, and develop branches
enforcement (90% pass rate minimum)
artifact upload with 7-day retention
.env.test
Test environment variables configuration file.env.test
credentials
purposes
1 files
package.json
Testing dependencies and Jest configuration setuppackage.json
test:ciscript for continuous integration testing with coverageand no watch mode
@testing-library/react,@testing-library/jest-dom,@testing-library/user-event)src/__tests__/**/*.test.jsfiles, and mock files
1 files