Skip to content

Conversation

@hoangsonww
Copy link
Member

SUMMARY

This PR adjusts the API to pass the integer AI CRC Risk Score instead of the 0.xxx Adjusted CRC Risk Score to the frontend. This thus makes the UI display the correct score. It also updates the README.md file to correctly reflect the app's setup.

@hoangsonww hoangsonww requested a review from Copilot June 7, 2025 04:05
@hoangsonww hoangsonww self-assigned this Jun 7, 2025
Copy link

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 ensures the frontend receives the intended AI CRC Risk Score and refreshes setup instructions in the README.

  • Refactors get_case_review to prioritize a CSV‐provided CRC score, fall back to existing risk logic, or emit “N/A”
  • Updates the SendEmailError message to include support contact information
  • Expands the README with local setup and CORS configuration steps

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/user/controller/auth_controller_test.py Updated expected error message to include support contact
src/common/exception/BusinessException.py Expanded the SendEmailError message for support
src/cases/service/case_service.py Overhauled CRC score selection logic in get_case_review
README.md Added environment setup instructions and CORS notes
Comments suppressed due to low confidence (2)

src/cases/service/case_service.py:375

  • [nitpick] The variable csv_obs is ambiguous—it actually holds a DB‐sourced score. Consider renaming it to something like db_crc_score_value for clarity.
csv_obs = next(

src/cases/service/case_service.py:366

  • No tests appear to cover the new CSV override branch. Add unit tests that simulate both CSV‐provided scores and fallback paths to ensure all branches in get_case_review behave as expected.
sorted_important.append(TreeNode(ai_label, [csv_crc_score_leaf]))

ai_label = "AI CRC Risk Score (<6: Low; 6-11: Medium; >11: High)"

if csv_crc_score_leaf:
sorted_important.append(TreeNode(ai_label, [csv_crc_score_leaf]))
Copy link

Copilot AI Jun 7, 2025

Choose a reason for hiding this comment

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

The code still returns the full CSV leaf string (which may include non‐integer text) instead of parsing and returning an integer score. Consider extracting the numeric part and converting it to an integer before wrapping it in the TreeNode.

Suggested change
sorted_important.append(TreeNode(ai_label, [csv_crc_score_leaf]))
import re
match = re.search(r'\d+', csv_crc_score_leaf)
if match:
numeric_score = int(match.group())
sorted_important.append(TreeNode(ai_label, [numeric_score]))
else:
sorted_important.append(TreeNode(ai_label, ["N/A"]))

Copilot uses AI. Check for mistakes.
@hoangsonww hoangsonww merged commit 8ea90b8 into main Jun 7, 2025
5 checks passed
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