-
Notifications
You must be signed in to change notification settings - Fork 159
#13426 - Fixes Male case has unnecessary information as Pregnancy #13779
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
base: development
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request implements sex-based conditional visibility logic across multiple UI components and forms to hide pregnancy-related fields (PREGNANT, POSTPARTUM, TRIMESTER) when the patient is male, ensuring these fields do not appear inappropriately in case and vaccination forms. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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)
sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataForm.java (1)
1451-1453: Inconsistent null-safety pattern.Line 1452 uses
Objects.isNull(person.getSex()) || !Sex.MALE.equals(person.getSex())while line 971 usesSex.MALE.equals(person.getSex())without an explicit null check. Both approaches produce the same result (sinceequals()safely handles null), but the inconsistency may confuse future maintainers.Consider using a consistent pattern throughout:
- boolean isMale = Sex.MALE.equals(person.getSex()); + boolean isMale = Sex.MALE.equals(person.getSex()); // equals() safely returns false for nullOr use the explicit null check everywhere:
- boolean isMale = Sex.MALE.equals(person.getSex()); + boolean isMale = person.getSex() != null && Sex.MALE.equals(person.getSex());
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
sormas-app/app/src/main/java/de/symeda/sormas/app/caze/edit/CaseEditFragment.java(2 hunks)sormas-app/app/src/main/java/de/symeda/sormas/app/caze/read/CaseReadFragment.java(3 hunks)sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataForm.java(5 hunks)sormas-ui/src/main/java/de/symeda/sormas/ui/vaccination/VaccinationController.java(5 hunks)sormas-ui/src/main/java/de/symeda/sormas/ui/vaccination/VaccinationEditForm.java(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
sormas-ui/src/main/java/de/symeda/sormas/ui/vaccination/VaccinationController.java (1)
sormas-api/src/main/java/de/symeda/sormas/api/FacadeProvider.java (1)
FacadeProvider(128-599)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: SORMAS CI
- GitHub Check: android app test (27)
- GitHub Check: android app test (26)
- GitHub Check: android app test (28)
🔇 Additional comments (11)
sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataForm.java (1)
41-41: LGTM: Imports support the new sex-based field visibility.The new imports for
ObjectsandSexare correctly used in the sex-based conditional visibility logic introduced in this file.Also applies to: 117-117
sormas-app/app/src/main/java/de/symeda/sormas/app/caze/read/CaseReadFragment.java (2)
32-32: LGTM: Import supports sex-based field visibility.The
Seximport is correctly used in the visibility logic at lines 137-141.
136-141: LGTM: Pregnancy fields correctly hidden for male cases.The implementation properly checks for male sex and hides the pregnancy-related fields (PREGNANT, POSTPARTUM, TRIMESTER). The null-safety check for
personand the use ofSex.MALE.equals()ensure correct behavior.sormas-app/app/src/main/java/de/symeda/sormas/app/caze/edit/CaseEditFragment.java (2)
56-56: LGTM: Import supports sex-based field visibility.The
Seximport is correctly used in the visibility logic at lines 216-220.
215-220: LGTM: Pregnancy fields correctly hidden for male cases.The implementation mirrors the read fragment's approach and correctly hides pregnancy-related fields for male patients with appropriate null-safety checks.
sormas-ui/src/main/java/de/symeda/sormas/ui/vaccination/VaccinationController.java (3)
33-33: LGTM: Imports support sex-aware vaccination forms.The new imports enable the controller to retrieve person sex information to pass to
VaccinationEditForm, ensuring pregnancy-related fields are hidden appropriately for male patients.Also applies to: 37-37, 39-39
95-96: LGTM: Sex information correctly passed to vaccination forms.The controller properly retrieves person sex using the new helper methods and passes it to
VaccinationEditForm, enabling appropriate field visibility based on patient sex across all vaccination form creation paths.Also applies to: 134-135, 236-237
195-224: Helper methods retrieve person sex with proper null-safety.Both
getPersonSexandgetPersonSexFromVaccinationmethods correctly navigate the object graph (Immunization → Person → Sex) with appropriate null checks at each level. The multiple facade calls are acceptable for form initialization scenarios.Note: These methods make multiple remote facade calls, which could be a performance concern if called frequently. However, since they're only invoked during form initialization, the performance impact should be minimal.
sormas-ui/src/main/java/de/symeda/sormas/ui/vaccination/VaccinationEditForm.java (3)
24-24: LGTM: Imports support sex-aware field visibility.The
Seximport enables the form to hide pregnancy-related fields for male patients, and theStringUtilsimport is correctly retained for existing vaccine validation logic.Also applies to: 32-32
55-67: LGTM: Constructor properly accepts and stores person sex.The
personSexfield is correctly declared as final and initialized in the constructor. The constructor signature change is supported by corresponding updates inVaccinationController.java.
128-146: LGTM: Pregnancy fields correctly hidden based on sex.The implementation properly:
- Hides PREGNANT and TRIMESTER fields when patient is male
- For non-male patients, sets up conditional visibility where TRIMESTER is shown only when PREGNANT=YES
- Handles null sex safely (treated as not male, which is appropriate)
This aligns with the acceptance criteria and follows a clean implementation pattern.
|
SonarCloud analysis: https://sonarcloud.io/dashboard?id=SORMAS-Project&pullRequest=13779 |
Fixes #13426
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.