Skip to content

Issue 2163 - Don't save unnecessary models#2202

Merged
rmroot merged 6 commits intodevelopfrom
issue-2163
Jan 16, 2026
Merged

Issue 2163 - Don't save unnecessary models#2202
rmroot merged 6 commits intodevelopfrom
issue-2163

Conversation

@jamlokim
Copy link
Copy Markdown
Contributor

connects #2163

This pull request introduces a model comparison feature to the regression model selection workflow, refactors how generated models are handled, and improves user feedback when models change. The changes enhance the user experience by allowing users to compare old and new regression models side-by-side and clarify the distinction between generated and selected models.

Key changes include:

Model Comparison Feature

  • Added a modal popup to display side-by-side comparisons of old and updated regression models, highlighting differences in key statistics and formulas. The modal is triggered when the selected model changes after regeneration. (regression-model-menu.component.html, regression-model-menu.component.css, regression-model-menu.component.ts)

Refactoring Model Handling

  • Introduced a new generatedModels property to clearly separate all generated models from the currently selected model(s). Updated all relevant logic and template bindings to use generatedModels instead of group.models. (regression-model-menu.component.ts, regression-model-menu.component.html, regression-model-selection.component.html)
  • Updated model generation logic to persist generatedModels using the analysis database service and to maintain selection state across regenerations. (regression-model-menu.component.ts)

Improved User Feedback

  • Added an alert to notify users when the selected model has changed, with a link to open the comparison modal. (regression-model-menu.component.html)

  • Added logic to compare old and new models and set the changedModel property when differences are detected. (regression-model-menu.component.ts)

UI and Style Enhancements

  • Added new CSS classes for the model comparison modal and improved scrolling for large model lists. (regression-model-menu.component.css)

Minor Improvements

  • Updated overlay logic to include the model comparison modal. (regression-model-menu.component.html)

  • Added necessary imports for routing events (preparation for possible navigation-related logic). (regression-model-selection.component.ts)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces a model comparison feature for regression analysis, refactors model storage to distinguish between generated and selected models, and improves user feedback when models change. The changes implement deterministic model ID generation based on group ID, predictor variables, and model year, replacing the previous random ID approach.

Changes:

  • Added a modal popup to display side-by-side comparisons of old vs updated regression models with key statistics
  • Introduced generatedModels property and service methods to store all generated models separately from the selected model
  • Implemented change detection logic to alert users when selected models are updated with different statistics

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
regression-models.service.ts Changed model ID generation from random to deterministic (groupId + predictor variables + year)
analysis-validation.service.ts Added optional chaining for safer null handling when checking model validity
analysis-db.service.ts Added BehaviorSubject and service methods to persist generated models per group
regression-model-selection.component.ts Added subscriptions for generated models tracking and router navigation cleanup; updated model selection to use generatedModels array
regression-model-selection.component.html Updated template bindings from group.models to generatedModels
regression-model-menu.component.ts Implemented model comparison logic, modal management, and updated model generation to maintain both generated and selected models
regression-model-menu.component.html Added model comparison modal UI with side-by-side table and alert banner for changed models
regression-model-menu.component.css Added CSS styling for the model comparison modal

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jamlokim jamlokim requested a review from rmroot January 14, 2026 17:48
Copy link
Copy Markdown
Member

@rmroot rmroot left a comment

Choose a reason for hiding this comment

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

Looks good. Just one change please.

@jamlokim jamlokim requested a review from rmroot January 15, 2026 16:35
@rmroot rmroot merged commit b2307f9 into develop Jan 16, 2026
3 checks passed
@jamlokim jamlokim deleted the issue-2163 branch January 23, 2026 16:49
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.

3 participants