Switch scatter regression to OLS with statistics#14
Conversation
Code Review: Switch scatter regression to OLS with statisticsOverall, this is a well-implemented change that significantly enhances the dashboard's analytical capabilities. The switch from Theil-Sen to OLS regression with statistical measures is appropriate for this use case. Below are my detailed findings: ✅ Strengths
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const formatRegressionFormula = regression => { | ||
| if (!regression || !Number.isFinite(regression.slope) || !Number.isFinite(regression.intercept)) { | ||
| return 'Formula unavailable'; | ||
| } | ||
| const slopeText = formatCoefficient(regression.slope); | ||
| const intercept = regression.intercept; | ||
| const interceptAbs = Math.abs(intercept); | ||
| const interceptText = formatCoefficient(interceptAbs); | ||
| const sign = intercept >= 0 ? ' + ' : ' - '; | ||
| return `y = ${slopeText}x${sign}${interceptText}`; |
There was a problem hiding this comment.
Escape JS template literals inside Python f-string
The new regression helpers embed JavaScript template literals like return `y = ${slopeText}x${sign}${interceptText}`; inside a Python f-string. When the dashboard runs, Python tries to evaluate slopeText, sign, and interceptText (and the similar placeholders in the stats string below) as Python expressions and immediately raises NameError, preventing any HTML from being generated. These ${…} sequences need to be escaped (e.g., ${{…}}) or the block should be converted to a regular triple-quoted string so the JavaScript interpolation is left untouched.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_69095661587483258cee0fada0a71fcd