-
Notifications
You must be signed in to change notification settings - Fork 336
(feat)O3-4447: Validate visit start/end time against overlapping visits #2893
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: main
Are you sure you want to change the base?
(feat)O3-4447: Validate visit start/end time against overlapping visits #2893
Conversation
chibongho
left a 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.
Pulling all visits from the patient to check for overlaps on the frontend is inefficient. We should query the backend for visits within the overlapping range instead. I'm not sure if the backend already supports that; if not, we should implement it there.
|
Thanks for the feedback @chibingho! I looked into the backend API and found that it partially supports date filtering: The So the backend doesn’t fully support querying visits within an overlapping range. What would you prefer I do? Option 1: |
Where did you see that? |
|
Ahh, sorry, that page is horribly out of date. I usually need to go directly to the Java code to see what's supported: So |
ok got it! |
04dcf55 to
90cfed5
Compare
- Query backend with toStartDate and fromStopDate parameters - Add async validation with custom Zod resolver - Show error if overlapping visits exist - Prevent form submission until overlap resolved
90cfed5 to
c79e0ba
Compare
|
@chibongho hello, can you check now! |

Requirements
Summary
This PR adds client-side validation to prevent users from creating visits that overlap with existing visits for the same patient. Previously, overlapping visits could only be caught by the server, resulting in 400 errors. Now users receive immediate feedback when attempting to create or edit a visit that conflicts with an existing one.
Key changes:
Screenshots
N/A - This is a validation enhancement with no UI changes. Error messages are displayed inline on existing form fields.
Related Issue
https://openmrs.atlassian.net/browse/O3-4447
Other