-
Notifications
You must be signed in to change notification settings - Fork 543
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
Patient Age and Facility Location Edits #10260
Patient Age and Facility Location Edits #10260
Conversation
WalkthroughThis pull request introduces modifications to patient age calculation and facility form handling across multiple files. The changes focus on improving how patient ages are derived by removing the direct Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (7)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/Patient/PatientRegistration.tsx (1)
Line range hint
559-563
: Update age input warning message.Since the backend no longer returns age data, consider updating the warning message to emphasize the importance of accurate birth year input.
- {t("age_input_warning")} - <br /> - <b>{t("age_input_warning_bold")}</b> + {t("year_of_birth_warning")} + <br /> + <b>{t("year_of_birth_warning_bold")}</b>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/Utils/utils.ts
(0 hunks)src/components/Facility/FacilityForm.tsx
(1 hunks)src/components/Patient/PatientRegistration.tsx
(1 hunks)src/types/emr/patient.ts
(0 hunks)
💤 Files with no reviewable changes (2)
- src/types/emr/patient.ts
- src/Utils/utils.ts
✅ Files skipped from review due to trivial changes (1)
- src/components/Facility/FacilityForm.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Label linked issues
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: Test
- GitHub Check: OSSAR-Scan
- GitHub Check: CodeQL-Build
- GitHub Check: cypress-run (1)
🔇 Additional comments (3)
src/components/Patient/PatientRegistration.tsx (3)
Line range hint
1-694
: Implementation aligns with PR objectives.The changes successfully remove direct age usage and switch to year-based age calculation. The form handling and validation are robust, with good error handling and user feedback.
Line range hint
63-70
: Review age validation constraints.The age validation in the schema allows ages between 1-120 years. Ensure this aligns with the backend constraints since the PR mentions changes to age handling.
✅ Verification successful
Age validation constraints are correctly implemented ✅
The age validation in the schema (1-120 years) is consistent with standard medical practice and is properly implemented across the codebase. The validation supports both age and date of birth input methods with appropriate constraints.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for age validation in backend code rg -A 5 'age.*validation|year_of_birth.*validation'Length of output: 1064
Script:
#!/bin/bash # Search for zod schema definitions and age-related validations ast-grep --pattern 'z.object({ $$$ })' # Backup search using ripgrep for age and year_of_birth fields rg -A 10 'z\.number\(\).*age|z\.date\(\).*birth|schema.*age|schema.*birth'Length of output: 26370
287-287
: Verify age calculation edge cases.The age calculation
new Date().getFullYear() - patientQuery.data.year_of_birth!
might be inaccurate for patients born late in the year. Consider using a more precise calculation that takes into account the month and day.Consider using a utility function for consistent age calculation:
-? new Date().getFullYear() - patientQuery.data.year_of_birth! +? calculateAge(patientQuery.data.year_of_birth!) +// Add to utils.ts +export function calculateAge(yearOfBirth: number) { + const today = new Date(); + return today.getFullYear() - yearOfBirth; +}
|
Conditionally Approving this temporary fix, as the mentioned issues need backend changes |
@Jacobjeevan Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌 |
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
age
property from patient model.Documentation
Tests
Chores