Skip to content

(feat) future and past start dates (medications component) (O3-5374)#2973

Open
Sadashii wants to merge 7 commits intoopenmrs:mainfrom
Sadashii:feat/future-and-past-start-dates
Open

(feat) future and past start dates (medications component) (O3-5374)#2973
Sadashii wants to merge 7 commits intoopenmrs:mainfrom
Sadashii:feat/future-and-past-start-dates

Conversation

@Sadashii
Copy link

@Sadashii Sadashii commented Jan 27, 2026

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work is based on designs, which are linked or shown either in the Jira ticket or the description below. (See also: Styleguide)
  • My work includes tests or is validated by existing tests.

Summary

As per discussions held on:

  1. Old jira ticket: https://openmrs.atlassian.net/browse/O3-4433
  2. Connected talk: https://talk.openmrs.org/t/guidance-needed-should-openmrs-allow-providers-to-schedule-medications-to-start-at-a-future-date/45848
  3. New jira ticket with expanded scope: https://openmrs.atlassian.net/browse/O3-5374

This PR introduces the first set of changes as belows (as a brief)

  1. The future components element for Medications and Summary page
  2. Selection of future/past start dates with proper functionality

Screenshots

image image

Related Issue

https://openmrs.atlassian.net/browse/O3-5375
https://openmrs.atlassian.net/browse/O3-5376

Other

- Add future medications table to medications summary
- Add future medications extension to patient summary panel
- Updated usePatientOrders hook to handle future, active, past with single api call instead of current that makes 2
- Add logic for past/future medicine scheduling
- Show correct 'start date' in UI
@Sadashii Sadashii marked this pull request as draft January 27, 2026 17:52
@Sadashii Sadashii marked this pull request as ready for review January 27, 2026 18:36
@Sadashii Sadashii marked this pull request as draft January 27, 2026 18:37
@Sadashii
Copy link
Author

@denniskigen @VeronicaMuthee fyi

- Allow same medicine to be ordered if active/future prescription
- Add visual cue for medicines that have active/future order in search results
@Sadashii Sadashii changed the title feat/future and past start dates (O3-5374) feat/future and past start dates (medications component) (O3-5374) Jan 28, 2026
@Sadashii
Copy link
Author

Currently, an 'active' medication could not be ordered again, i.e on searching it would show 'Already prescribed' and no button to order it.
As we need to allow that, that validation has been replaced with a visual-cue, that informs the practitioner that the medication is already prescribed, but the buttons are now visible they can place an order for that, with dates such that they do not overlap.

image

@Sadashii
Copy link
Author

Nuance, for medications with start date as today, we store the date as today + hour + minutes, but for future or past, it is set as 00:00. This makes it more intuitive on the 'Active medications' tab, as it shows up as 'Today, x time' instead of 'Today, 12:00'

So, in case a medication starts today (28th), at 11ampm, for 3 days, in terms of validation, it ends 3 days from now (31st, 11am). And the doctor wants the patient to start the next medication once this is over, if he schedules the date as 31st, it will show overlap as technically the previous med runs till 11am (thats after midnight), or he can schedule for 1st but that seems 'wrong'.

Possible alternative:

  • Allow a one day overlap on parallel medications (backend, relatively complex)
  • Add the timestamp to all dates, however when that future day arrives, then it will show up as Today, x time - possible confusion for practitioner, for the rest of the days the medication is active, it will show normally as date (relative time)

@Sadashii
Copy link
Author

Complicaed the commit-history trying to merge the updated main - apologies.

@Sadashii Sadashii marked this pull request as ready for review January 31, 2026 10:19
@Sadashii Sadashii marked this pull request as draft January 31, 2026 10:19
@Sadashii Sadashii marked this pull request as ready for review January 31, 2026 10:20
@Sadashii
Copy link
Author

@bmamlin @ibacher @mogoodrich A reminder ping if either of you could look at this PR and share your opinions on the current implementation.

@ELVIS-KATO
Copy link

Thanks @Sadashii for the great work on this PR — the changes look solid! One small suggestion: the commit history is a bit busy and might be hard to follow. Could you squash or reorganize the commits into a few logical units? That would make the review process even smoother.

@Sadashii Sadashii force-pushed the feat/future-and-past-start-dates branch from 257d9de to c7ce098 Compare February 2, 2026 17:20
@Sadashii
Copy link
Author

Sadashii commented Feb 2, 2026

@ELVIS-KATO My bad - git's kinda annoying. I believe I have fixed it.

What else do I need to add to this PR as of now?

@UjjawalPrabhat
Copy link
Contributor

@ELVIS-KATO My bad - git's kinda annoying. I believe I have fixed it.

What else do I need to add to this PR as of now?

Take a look at this.

@Sadashii Sadashii force-pushed the feat/future-and-past-start-dates branch from 6df564d to 8046f34 Compare February 19, 2026 18:41
@Sadashii Sadashii changed the title feat/future and past start dates (medications component) (O3-5374) (feat) future and past start dates (medications component) (O3-5374) Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments