Skip to content

Conversation

@adamrefaey
Copy link
Collaborator

@adamrefaey adamrefaey commented Apr 22, 2025

Change

This pull request introduces several updates across the backend and frontend to enhance functionality, improve user experience, and add support for new metadata in reports. Key changes include adding metadata fields for reports, updating APIs to handle these fields, improving localization, and refining UI components.

Backend Changes

Report Metadata Enhancements:

  • Added originalFilename and fileSize properties to the Report model and updated the corresponding API endpoints and service methods to handle these fields. (backend/src/reports/models/report.model.ts, backend/src/reports/reports.controller.ts, backend/src/reports/reports.service.ts) [1] [2] [3] [4]

Simplified Summary Logic:

  • Simplified the logic for generating the summary field in DocumentProcessorController by removing fallback conditions and directly using simplifiedExplanation. (backend/src/document-processor/controllers/document-processor.controller.ts)

Frontend Changes

Report Metadata Support:

  • Updated the uploadReport function to include originalFilename and fileSize when sending data to the backend. (frontend/src/common/api/reportService.ts)
  • Extended the MedicalReport interface to include originalFilename and fileSize properties. (frontend/src/common/models/medicalReport.ts)

UI and Icon Improvements:

  • Added new icons (fileText, filePdf, lightbulb) to the Icon component for enhanced visual representation. (frontend/src/common/components/Icon/Icon.tsx) [1] [2] [3] [4] [5] [6] [7]
  • Fixed a naming inconsistency by replacing Processing with ProcessingPage in the router configuration. (frontend/src/common/components/Router/TabNavigation.tsx) [1] [2]

Localization Enhancements:

  • Added new translations for loading states, error messages, and report details in English, Spanish, and French. (frontend/src/common/utils/i18n/resources/en, frontend/src/common/utils/i18n/resources/es, frontend/src/common/utils/i18n/resources/fr) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Status Enum Update:

  • Added a FAILED status to the ProcessingStatus enum to handle failed report processing scenarios. (frontend/src/common/models/medicalReport.ts)

Does this PR introduce a breaking change?

{...}

What needs to be documented once your changes are merged?

{...}

Additional Comments

{...}

…ing and functionality

- Updated ReportItem component to use new category translation keys and improved bookmark icon styling.
- Modified ReportDetailPage styles for better layout and responsiveness, including adjustments to padding, margins, and colors.
- Enhanced ReportDetailPage structure by replacing IonButton with a custom button for closing the report.
- Implemented new sections for displaying flagged and normal lab values with improved UI elements.
- Added functionality to display uploaded file details with formatted date.
- Removed unnecessary AI Assistant help section from ReportDetailPage.
…nd file size, update frontend components for improved file metadata display
…ysis and original report, improving code organization and readability
@adamrefaey adamrefaey self-assigned this Apr 22, 2025
@adamrefaey adamrefaey changed the title [ADE-66] [ADE-66] refactor and improve uploading a report & processing it Apr 22, 2025
@adamrefaey adamrefaey requested a review from Copilot April 22, 2025 12:12
Copy link
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 the report upload and processing functionalities, adding support for new metadata fields and refining both backend handling and frontend presentation.

  • Adds new metadata fields (originalFilename and fileSize) to the Report model and corresponding API endpoints.
  • Improves UI consistency by updating the router configuration and extending the Icon component with new icons.
  • Simplifies the logic in report summary generation by removing fallback conditions.

Reviewed Changes

Copilot reviewed 28 out of 38 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/src/common/utils/i18n/resources/es/index.ts Added reportDetail translations entry
frontend/src/common/utils/i18n/resources/en/index.ts Added reportDetail translations entry
frontend/src/common/models/medicalReport.ts Extended MedicalReport interface with new metadata fields
frontend/src/common/components/Router/TabNavigation.tsx Renamed Processing to ProcessingPage for consistency
frontend/src/common/components/Icon/Icon.tsx Added new icons (fileText, filePdf, lightbulb) and updated mappings
frontend/src/common/api/reportService.ts Updated uploadReport to include new metadata fields
backend/src/reports/reports.service.ts Updated saveReport to accept new metadata parameters
backend/src/reports/reports.controller.ts Updated createReport endpoint to pass new metadata fields
backend/src/reports/models/report.model.ts Updated Report model to include new metadata properties
backend/src/document-processor/controllers/document-processor.controller.ts Simplified summary generation logic for reports
Files not reviewed (10)
  • frontend/src/common/utils/i18n/resources/en/common.json: Language not supported
  • frontend/src/common/utils/i18n/resources/en/errors.json: Language not supported
  • frontend/src/common/utils/i18n/resources/en/report.json: Language not supported
  • frontend/src/common/utils/i18n/resources/en/reportDetail.json: Language not supported
  • frontend/src/common/utils/i18n/resources/es/common.json: Language not supported
  • frontend/src/common/utils/i18n/resources/es/errors.json: Language not supported
  • frontend/src/common/utils/i18n/resources/es/errors.json.new: Language not supported
  • frontend/src/common/utils/i18n/resources/es/reportDetail.json: Language not supported
  • frontend/src/common/utils/i18n/resources/fr/common.json: Language not supported
  • frontend/src/common/utils/i18n/resources/fr/errors.json: Language not supported
Comments suppressed due to low confidence (1)

backend/src/document-processor/controllers/document-processor.controller.ts:205

  • The use of the non-null assertion operator (!) on result.simplifiedExplanation removes the fallback logic previously used. Ensure that simplifiedExplanation is always defined at runtime or consider restoring a safe default to prevent potential runtime errors.
report.summary = result.simplifiedExplanation!;

@adamrefaey adamrefaey requested a review from GuidoBR April 22, 2025 12:12
@GuidoBR GuidoBR merged commit 3c642a0 into main Apr 22, 2025
2 checks passed
@adamrefaey adamrefaey deleted the ADE-66 branch April 22, 2025 14:12
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