Skip to content

Improve eye tracking - #99

Merged
jayvdb merged 1 commit into
mainfrom
eye-movement
Jul 22, 2026
Merged

Improve eye tracking#99
jayvdb merged 1 commit into
mainfrom
eye-movement

Conversation

@jayvdb

@jayvdb jayvdb commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added webcam-based eye movement screening with iris tracking.
    • Added analysis for eye misalignment and rhythmic oscillation.
    • Added zoomed eye-region overlays, iris markers, and screening status indicators.
    • The eye screening module is now selected by default when available.
  • Documentation

    • Added a medical disclaimer explaining that results are heuristic signals, not medical advice.
  • Style

    • Refined status cards, notes, typography, and layout styling.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ebf62091-7d0c-4ddf-8edb-9236ece1eb81

📥 Commits

Reviewing files that changed from the base of the PR and between 30f92d3 and 0d59ade.

📒 Files selected for processing (11)
  • services/ws-modules/pyeye1/pkg/et_ws_pyeye1.js
  • services/ws-modules/pyeye1/pyeye1/__init__.py
  • services/ws-modules/pyeye1/pyeye1/eye_detection.py
  • services/ws-modules/pyeye1/pyeye1/gaze_analysis.py
  • services/ws-modules/pyeye1/pyproject.toml
  • services/ws-modules/pyeye1/tests/test_eye_detection.py
  • services/ws-modules/pyeye1/tests/test_gaze_analysis.py
  • services/ws-modules/pyeye1/tests/test_run_workflow.py
  • services/ws-server/static/app.js
  • services/ws-server/static/index.html
  • services/ws-server/static/style.css

📝 Walkthrough

Walkthrough

The PR replaces callback-driven eye detection with a Python-orchestrated eye movement screening workflow, adds iris and gaze analysis, updates browser rendering and payloads, and adjusts the web UI to select and describe the screening module.

Changes

Eye movement screening

Layer / File(s) Summary
Gaze analysis contracts and heuristics
services/ws-modules/pyeye1/pyeye1/gaze_analysis.py, services/ws-modules/pyeye1/pyeye1/__init__.py, services/ws-modules/pyeye1/tests/test_gaze_analysis.py
Adds gaze sample schemas and computes eyelid validity, eye misalignment, oscillation metrics, and combined window analysis with unit coverage.
Screening workflow and result payloads
services/ws-modules/pyeye1/pyeye1/eye_detection.py, services/ws-modules/pyeye1/tests/test_eye_detection.py, services/ws-modules/pyeye1/tests/test_run_workflow.py, services/ws-modules/pyeye1/pyproject.toml
Reworks the asynchronous workflow around a platform interface, adds iris decoding and smoothed eye crops, includes analysis in status/event payloads, and tests success and cleanup failure paths.
Browser platform bridge and rendering
services/ws-modules/pyeye1/pkg/et_ws_pyeye1.js
Moves browser operations behind a Python platform bridge and renders cropped eye regions, iris circles, and analysis overlays.
Module selection and screening presentation
services/ws-server/static/app.js, services/ws-server/static/index.html, services/ws-server/static/style.css
Defaults module selection to et-ws-pyeye1 when available and adds disclaimer, log-note, status markup, and corresponding styles.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant BrowserAdapter
  participant PythonWorkflow
  participant Camera
  participant FaceLandmarker
  participant WebSocketAgent
  participant Canvas
  BrowserAdapter->>PythonWorkflow: provide platformFor(state)
  PythonWorkflow->>WebSocketAgent: connect and send status
  PythonWorkflow->>Camera: acquire and start video
  PythonWorkflow->>FaceLandmarker: infer video frame
  PythonWorkflow->>WebSocketAgent: send analysis event
  PythonWorkflow->>BrowserAdapter: render result payload
  BrowserAdapter->>Canvas: draw crop, irises, and analysis overlay
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main theme of the changes: upgrading eye tracking to eye-movement screening and gaze analysis.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch eye-movement

Comment @coderabbitai help to get the list of available commands.

@deepsource-io

deepsource-io Bot commented Jul 22, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 30f92d3...0d59ade on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Coverage  

Code Review Summary

Analyzer Status Updated (UTC) Details
C# Jul 22, 2026 2:22a.m. Review ↗
C & C++ Jul 22, 2026 2:22a.m. Review ↗
Docker Jul 22, 2026 2:22a.m. Review ↗
Java Jul 22, 2026 2:22a.m. Review ↗
JavaScript Jul 22, 2026 2:22a.m. Review ↗
Python Jul 22, 2026 2:22a.m. Review ↗
Rust Jul 22, 2026 2:22a.m. Review ↗
Secrets Jul 22, 2026 2:22a.m. Review ↗
Code coverage Jul 22, 2026 2:49a.m. Review ↗

Code Coverage Summary

Language Line Coverage (New Code) Line Coverage (Overall)
Aggregate
92.4%
58.3%
[▲ up 1.1% from main]
Python
92.4%
83%
[▲ up 13.3% from main]
Rust -
56.7%

➟ Additional coverage metrics may have been reported. See full coverage report ↗


Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

for index, (dx, dy) in zip(RIGHT_IRIS_RING, ring_offsets, strict=True):
points[index] = (0.35 + dx, 0.50 + dy)
irises = decode_irises(landmarks_with(points), 1000.0, 500.0)
right = next(iris for iris in irises if iris["label"] == "right_eye")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to `next()` should be wrapped in `try-except`


Calls to next() should be inside try-except block.

async def connect_ws(self) -> None:
pass

def ws_state(self) -> str:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method doesn't use the class instance and could be converted into a static method


The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.

def ws_state(self) -> str:
return "connected"

def agent_id(self) -> str:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method doesn't use the class instance and could be converted into a static method


The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.

async def start_camera(self) -> None:
pass

def video_size(self) -> list[int]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method doesn't use the class instance and could be converted into a static method


The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.

let cfg;
let runtime = null;

export default async function init() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'


Found non-compliant syntax. Confirm that there are no syntax errors before committing your code to a version control system.

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 17 minor

Alerts:
⚠ 17 issues (≤ 0 issues of at least minor severity)

Results:
17 new issues

Category Results
Documentation 11 minor
CodeStyle 4 minor
Complexity 2 minor

View in Codacy

🟢 Metrics 164 complexity · 2 duplication

Metric Results
Complexity 164
Duplication 2

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.43028% with 19 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/ws-modules/pyeye1/pyeye1/eye_detection.py 86.86% 18 Missing ⚠️
services/ws-modules/pyeye1/pyeye1/gaze_analysis.py 99.11% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@jayvdb
jayvdb marked this pull request as ready for review July 22, 2026 02:56
@jayvdb
jayvdb requested a review from pierre-tenedero July 22, 2026 02:56
@jayvdb
jayvdb merged commit 8d69f15 into main Jul 22, 2026
30 of 34 checks passed
@jayvdb
jayvdb deleted the eye-movement branch July 22, 2026 03:30
This was referenced Jul 22, 2026
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.

2 participants