O3-5428: Validate program enrollment/completion dates against patient DOB#5886
Open
BlessedAmrita wants to merge 1 commit intoopenmrs:masterfrom
Open
O3-5428: Validate program enrollment/completion dates against patient DOB#5886BlessedAmrita wants to merge 1 commit intoopenmrs:masterfrom
BlessedAmrita wants to merge 1 commit intoopenmrs:masterfrom
Conversation
|
Author
|
@denniskigen @dkayiwa please review this |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5886 +/- ##
============================================
- Coverage 59.26% 59.25% -0.01%
- Complexity 9251 9260 +9
============================================
Files 686 686
Lines 37219 37225 +6
Branches 5445 5448 +3
============================================
+ Hits 22056 22057 +1
- Misses 13201 13207 +6
+ Partials 1962 1961 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sagarkhandagre998
suggested changes
Mar 9, 2026
api/src/test/java/org/openmrs/validator/PatientProgramValidatorTest.java
Show resolved
Hide resolved
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
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.



Description of what I changed
Added DOB lower-bound validation for
dateEnrolledanddateCompletedinPatientProgramValidator.When either date falls before the patient's date of birth, the validator now rejects it with a field error. This prevents clinically impossible data entry: a patient cannot be enrolled in a program before they were born. Dates equal to the birthdate are allowed.
Changes:
PatientProgramValidator.java: Added birthdate lower-bound checks for both date fields after existing future-date checks, with null guards for patient and birthdate.PatientProgramValidatorTest.java: Added 10 test cases (5 per date field) covering before/equal/after birthdate, null date, and null birthdate scenariosmessages.properties: Addederror.patientProgram.enrolledDateCannotBeBeforeBirthdateanderror.patientProgram.completionDateCannotBeBeforeBirthdatekeysTest scenarios (for each date field):
Part of the Date Picker Improvements epic (O3-5424).
Issue I worked on
see https://issues.openmrs.org/browse/O3-5428
Checklist: I completed these to help reviewers :)
existing code that was well tested you do not have to add tests)
mvn clean packageright before creating this pull request andadded all formatting changes to my commit.