Skip to content

Chore/merge#35248

Open
hjxilinx wants to merge 10 commits into3.0from
chore/merge
Open

Chore/merge#35248
hjxilinx wants to merge 10 commits into3.0from
chore/merge

Conversation

@hjxilinx
Copy link
Copy Markdown
Contributor

This pull request refactors the implementation of the Pearson correlation and profile search endpoints in the analytics service. The main logic for these features has been moved from app.py into dedicated handler functions in handlers/misc.py, improving code organization and maintainability. Additionally, the API endpoints for model deployment have been updated for better versioning, and the profile search API documentation has been expanded.

Refactoring and Code Organization:

  • Moved the implementations of handle_pearsonr and do_profile_search from app.py into handlers/misc.py, and updated imports and references accordingly. This centralizes business logic in handler modules and keeps the main app routing file cleaner.

API Endpoint Improvements:

  • Changed the deployment and undeployment endpoints to /api/v1/deploy and /api/v1/undeploy for improved versioning and consistency.

Profile Search API Documentation:

  • Enhanced the docstring for do_profile_search with more detailed parameter and result descriptions, including new options like window_size_step, window_sliding_step, exclude_contained, and exclude_source.

Logging Consistency:

  • Updated logging calls to use the AppLogger class consistently instead of the app_logger instance.

Minor Cleanups:

  • Removed an unused import of os from app.py.
  • Removed unnecessary blank lines and improved code formatting in app.py.

These changes make the codebase more modular, easier to maintain, and improve the clarity and usability of the API.# Description

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

hjxilinx and others added 2 commits April 28, 2026 10:33
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 28, 2026 07:52
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the API routes to include versioning, adds new handlers for Pearson correlation and profile search, and refactors existing code. Feedback was provided regarding potential compatibility issues with older Scipy versions in the Pearson correlation implementation, a discrepancy between the profile search documentation and its actual implementation, and the need to maintain backward compatibility for renamed API endpoints.

Comment thread tools/tdgpt/taosanalytics/handlers/misc.py Outdated
Comment thread tools/tdgpt/taosanalytics/handlers/misc.py
Comment thread tools/tdgpt/taosanalytics/app.py
Comment thread tools/tdgpt/taosanalytics/app.py
Comment thread tools/tdgpt/taosanalytics/handlers/misc.py
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 refactors Pearson correlation and profile search endpoint logic out of app.py into dedicated handler functions under handlers/misc.py, and updates model deployment endpoints to use versioned routes.

Changes:

  • Move handle_pearsonr and do_profile_search implementations into tools/tdgpt/taosanalytics/handlers/misc.py and update routing imports accordingly.
  • Change deployment routes to /api/v1/deploy and /api/v1/undeploy.
  • Expand the profile-search handler docstring with additional parameter/result documentation.

Reviewed changes

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

File Description
tools/tdgpt/taosanalytics/handlers/misc.py Adds Pearson and profile-search handlers (and expanded profile-search API docstring) to centralize miscellaneous business logic.
tools/tdgpt/taosanalytics/app.py Updates routing to call the new handlers, switches deploy/undeploy endpoints to versioned paths, and standardizes logging via AppLogger.

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

Comment thread tools/tdgpt/taosanalytics/app.py
Comment thread tools/tdgpt/taosanalytics/handlers/misc.py
Comment thread tools/tdgpt/taosanalytics/handlers/misc.py
hjxilinx and others added 2 commits April 28, 2026 16:25
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 28, 2026 08:34
Co-authored-by: Copilot <copilot@github.com>
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 PR refactors analytics endpoint logic by moving Pearson correlation and profile-search implementations out of the main Flask routing module into handlers/misc.py, while also updating deployment endpoints to use versioned API paths and expanding profile-search documentation.

Changes:

  • Moved handle_pearsonr and do_profile_search implementations from app.py into handlers/misc.py.
  • Updated deployment routes to /api/v1/deploy and /api/v1/undeploy.
  • Switched request logging to use AppLogger and expanded the profile-search docstring.

Reviewed changes

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

File Description
tools/tdgpt/taosanalytics/handlers/misc.py Adds Pearson correlation + profile-search handler functions and expands profile-search API documentation.
tools/tdgpt/taosanalytics/app.py Updates imports, routes requests to the new handler functions, and changes deploy/undeploy endpoints to versioned paths.

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

Comment thread tools/tdgpt/taosanalytics/handlers/misc.py Outdated
Comment thread tools/tdgpt/taosanalytics/handlers/misc.py Outdated
Comment thread tools/tdgpt/taosanalytics/app.py
hjxilinx and others added 2 commits April 28, 2026 16:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 28, 2026 08:41
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 PR refactors analytics endpoint implementations by moving Pearson correlation and profile search logic out of app.py into handlers/misc.py, while also versioning model deployment endpoints under /api/v1/* and extending profile-search documentation.

Changes:

  • Moved handle_pearsonr and do_profile_search business logic into tools/tdgpt/taosanalytics/handlers/misc.py and updated routing/logging accordingly.
  • Versioned deploy/undeploy endpoints to /api/v1/deploy and /api/v1/undeploy and updated tests to match.
  • Implemented Prophet execution path in the dynamic forecast service (replacing the previous NotImplementedError) and tightened config/log singleton typing/guards.

Reviewed changes

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

Show a summary per file
File Description
tools/tdgpt/tests/restful_api_test.py Updates tests for versioned deploy/undeploy routes and adjusts profile-search assertions.
tools/tdgpt/taosanalytics/service_registry.py Adds Prophet model execution logic for dynamic forecast services.
tools/tdgpt/taosanalytics/log.py Adds typing/guards around the AppLogger singleton instance.
tools/tdgpt/taosanalytics/handlers/misc.py Introduces dedicated handler functions for pearsonr + profile-search (moved from app.py).
tools/tdgpt/taosanalytics/conf.py Hardens config module loading with explicit spec/loader checks and improves typing.
tools/tdgpt/taosanalytics/app.py Switches routes to /api/v1/(un)deploy, delegates pearsonr/profile-search to handler module, and uses AppLogger consistently.

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

Comment thread tools/tdgpt/tests/restful_api_test.py Outdated
Comment thread tools/tdgpt/tests/restful_api_test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants