generated from ModusCreateOrg/template
-
Notifications
You must be signed in to change notification settings - Fork 0
[ADE-56] - Upload Medical Report File for Easy Access #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Introduced UploadModal for handling file uploads with validation and progress tracking. - Added useFileUpload hook to manage file selection, validation, and upload status. - Updated UploadPage to integrate UploadModal and handle file upload requests. - Added new assets for upload states and updated styles for UploadModal. - Enhanced general.mdc with new image links for upload status visuals.
- Added uploadReport function to handle file uploads with progress tracking. - Introduced UploadProgressCallback interface for progress updates. - Updated TabNavigation and UploadPage components to navigate after successful uploads. - Refactored UploadModal to support onUploadComplete callback. - Created comprehensive tests for reportService and UploadModal to ensure functionality and error handling. - Added file validation utilities and tests for various file types and sizes.
- Updated UploadModal.scss for enhanced styling, including background colors and padding adjustments. - Replaced IonHeader and IonToolbar with a custom header for better layout control. - Consolidated file size limit display into a single paragraph for clarity. - Added new localization strings for upload functionality in English, Spanish, and French.
- Expanded reportService.test.ts with additional tests for uploadReport, fetchLatestReports, and fetchAllReports functions. - Mocked axios for better control over API responses in tests. - Updated localization strings in English, Spanish, and French for consistency, changing "try-again" to "tryAgain" and modifying no reports messages. - Adjusted NoReportsMessage component to utilize updated translation keys.
- Changed appId and appName to reflect new project branding. - Added server configuration to allow navigation for all HTTP and HTTPS requests.
- Updated UploadModal.scss to enhance styling, including height adjustments and new success/error visual elements. - Modified UploadModal.tsx to automatically start uploads upon file selection and added cancel functionality during uploads. - Introduced new success and error states with improved user feedback. - Enhanced tests for UploadModal to cover new features and ensure proper functionality.
- Deleted the HTTP entry from the allowNavigation array in capacitor.config.ts to enhance security by restricting navigation to HTTPS only.
- Implemented onKeyDown handler to trigger onClick when 'Enter' is pressed. - Added role and tabIndex attributes for improved accessibility.
- Removed outdated @capacitor/filesystem dependency from package.json. - Added @capacitor/filesystem version 6.0.2 to both package.json and package-lock.json for consistency. - Updated @capacitor/ios version to 6.2.0 in both package.json and package-lock.json for alignment with other Capacitor packages.
GuidoBR
approved these changes
Mar 25, 2025
Comment on lines
130
to
139
if (lowerFilename.includes('heart') || lowerFilename.includes('cardiac') || lowerFilename.includes('stress')) { | ||
return ReportCategory.HEART; | ||
} else if (lowerFilename.includes('brain') || lowerFilename.includes('neuro')) { | ||
return ReportCategory.NEUROLOGICAL; | ||
} else if (lowerFilename.includes('eye') || lowerFilename.includes('vision')) { | ||
return ReportCategory.OFTALMOLOGICAL; | ||
} else if (lowerFilename.includes('stomach') || lowerFilename.includes('gastro')) { | ||
return ReportCategory.GASTRO; | ||
} else if (lowerFilename.includes('bone') || lowerFilename.includes('joint')) { | ||
return ReportCategory.ORTHOPEDIC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked claude to improve this code and he did this
// Convert filename to lowercase once for case-insensitive matching
const lowerFilename = filename.toLowerCase();
// Define mapping of keywords to categories
const categoryKeywords = {
[ReportCategory.HEART]: ['heart', 'cardiac', 'stress'],
[ReportCategory.NEUROLOGICAL]: ['brain', 'neuro'],
[ReportCategory.OPHTHALMOLOGICAL]: ['eye', 'vision', 'optic'],
[ReportCategory.GASTRO]: ['stomach', 'gastro', 'digestive'],
[ReportCategory.ORTHOPEDIC]: ['bone', 'joint', 'skeletal']
};
// Check each category
for (const [category, keywords] of Object.entries(categoryKeywords)) {
if (keywords.some(keyword => lowerFilename.includes(keyword))) {
return category;
}
}
// Default category if no match found
return ReportCategory.OTHER;
}
- Introduced a new section in general.mdc outlining guidelines for determining categories based on keywords. - Refactored the determineCategory function in reportService.ts to utilize a constant mapping object for improved readability and maintainability. - Replaced multiple if-else statements with a more efficient approach using Array methods for keyword matching.
|
GuidoBR
approved these changes
Mar 26, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change
Implemented complete file upload functionality in the mobile app with the following features:
Does this PR introduce a breaking change?
No. This PR adds new functionality without affecting existing features.
What needs to be documented?
Additional Comments
The implementation includes:
Testing Notes
Testing should cover: