Skip to content
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

O3-2472: Appointment Calender Feature does not work in Ref App #954

Merged
merged 3 commits into from
Jan 29, 2024

Conversation

mogoodrich
Copy link
Member

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 conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

Screenshots

Related Issue

Other

@mogoodrich mogoodrich closed this Jan 26, 2024
@mogoodrich mogoodrich reopened this Jan 26, 2024
@mogoodrich mogoodrich marked this pull request as draft January 26, 2024 20:56
Copy link
Contributor

Size Change: -48.5 kB (-2%)

Total Size: 2.87 MB

Filename Size Change
packages/esm-appointments-app/dist/799.js 0 B -48.2 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size Change
packages/esm-active-visits-app/dist/130.js 109 kB 0 B
packages/esm-active-visits-app/dist/255.js 2.21 kB 0 B
packages/esm-active-visits-app/dist/271.js 671 B 0 B
packages/esm-active-visits-app/dist/277.js 12.2 kB 0 B
packages/esm-active-visits-app/dist/316.js 42.9 kB 0 B
packages/esm-active-visits-app/dist/319.js 631 B 0 B
packages/esm-active-visits-app/dist/382.js 1.15 kB 0 B
packages/esm-active-visits-app/dist/460.js 727 B 0 B
packages/esm-active-visits-app/dist/574.js 553 B 0 B
packages/esm-active-visits-app/dist/588.js 6.66 kB 0 B
packages/esm-active-visits-app/dist/635.js 1.15 kB 0 B
packages/esm-active-visits-app/dist/644.js 671 B 0 B
packages/esm-active-visits-app/dist/729.js 3.1 kB 0 B
packages/esm-active-visits-app/dist/757.js 649 B 0 B
packages/esm-active-visits-app/dist/784.js 2.63 kB 0 B
packages/esm-active-visits-app/dist/788.js 551 B 0 B
packages/esm-active-visits-app/dist/807.js 864 B 0 B
packages/esm-active-visits-app/dist/833.js 669 B 0 B
packages/esm-active-visits-app/dist/879.js 2.94 kB 0 B
packages/esm-active-visits-app/dist/964.js 50.8 kB 0 B
packages/esm-active-visits-app/dist/main.js 67.5 kB 0 B
packages/esm-active-visits-app/dist/openmrs-esm-active-visits-app.js 3.33 kB 0 B
packages/esm-appointments-app/dist/130.js 109 kB 0 B
packages/esm-appointments-app/dist/152.js 257 B 0 B
packages/esm-appointments-app/dist/255.js 2.23 kB 0 B
packages/esm-appointments-app/dist/271.js 2.16 kB 0 B
packages/esm-appointments-app/dist/303.js 258 B 0 B
packages/esm-appointments-app/dist/319.js 1.99 kB 0 B
packages/esm-appointments-app/dist/460.js 2.18 kB 0 B
packages/esm-appointments-app/dist/469.js 6.65 kB 0 B
packages/esm-appointments-app/dist/530.js 246 kB -99 B (0%)
packages/esm-appointments-app/dist/574.js 1.74 kB 0 B
packages/esm-appointments-app/dist/591.js 16.9 kB 0 B
packages/esm-appointments-app/dist/610.js 6.71 kB 0 B
packages/esm-appointments-app/dist/636.js 47.9 kB 0 B
packages/esm-appointments-app/dist/644.js 2.16 kB 0 B
packages/esm-appointments-app/dist/729.js 3.1 kB 0 B
packages/esm-appointments-app/dist/757.js 1.75 kB 0 B
packages/esm-appointments-app/dist/784.js 2.63 kB 0 B
packages/esm-appointments-app/dist/788.js 1.75 kB 0 B
packages/esm-appointments-app/dist/80.js 2.53 kB 0 B
packages/esm-appointments-app/dist/807.js 2.4 kB 0 B
packages/esm-appointments-app/dist/833.js 1.99 kB 0 B
packages/esm-appointments-app/dist/main.js 298 kB -347 B (0%)
packages/esm-appointments-app/dist/openmrs-esm-appointments-app.js 3.29 kB 0 B
packages/esm-patient-list-management-app/dist/130.js 109 kB 0 B
packages/esm-patient-list-management-app/dist/255.js 2.21 kB 0 B
packages/esm-patient-list-management-app/dist/271.js 1.33 kB 0 B
packages/esm-patient-list-management-app/dist/319.js 1.53 kB 0 B
packages/esm-patient-list-management-app/dist/382.js 1.15 kB 0 B
packages/esm-patient-list-management-app/dist/435.js 22.8 kB +22 B (0%)
packages/esm-patient-list-management-app/dist/460.js 1.73 kB 0 B
packages/esm-patient-list-management-app/dist/497.js 104 kB 0 B
packages/esm-patient-list-management-app/dist/574.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/588.js 6.66 kB 0 B
packages/esm-patient-list-management-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-list-management-app/dist/635.js 1.15 kB 0 B
packages/esm-patient-list-management-app/dist/644.js 1.31 kB 0 B
packages/esm-patient-list-management-app/dist/716.js 4.66 kB 0 B
packages/esm-patient-list-management-app/dist/729.js 3.1 kB 0 B
packages/esm-patient-list-management-app/dist/757.js 1.51 kB 0 B
packages/esm-patient-list-management-app/dist/784.js 2.64 kB 0 B
packages/esm-patient-list-management-app/dist/788.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/807.js 1.84 kB 0 B
packages/esm-patient-list-management-app/dist/833.js 1.6 kB 0 B
packages/esm-patient-list-management-app/dist/main.js 130 kB +23 B (0%)
packages/esm-patient-list-management-app/dist/openmrs-esm-patient-list-management-app.js 3.3 kB 0 B
packages/esm-patient-registration-app/dist/130.js 109 kB 0 B
packages/esm-patient-registration-app/dist/152.js 262 B 0 B
packages/esm-patient-registration-app/dist/209.js 36.4 kB 0 B
packages/esm-patient-registration-app/dist/255.js 2.21 kB 0 B
packages/esm-patient-registration-app/dist/271.js 1.6 kB 0 B
packages/esm-patient-registration-app/dist/303.js 260 B 0 B
packages/esm-patient-registration-app/dist/319.js 1.97 kB 0 B
packages/esm-patient-registration-app/dist/460.js 2.03 kB 0 B
packages/esm-patient-registration-app/dist/492.js 118 kB 0 B
packages/esm-patient-registration-app/dist/537.js 2.35 kB 0 B
packages/esm-patient-registration-app/dist/574.js 1.7 kB 0 B
packages/esm-patient-registration-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-registration-app/dist/62.js 6.86 kB 0 B
packages/esm-patient-registration-app/dist/644.js 1.6 kB 0 B
packages/esm-patient-registration-app/dist/729.js 3.1 kB 0 B
packages/esm-patient-registration-app/dist/735.js 464 B 0 B
packages/esm-patient-registration-app/dist/757.js 1.96 kB 0 B
packages/esm-patient-registration-app/dist/784.js 2.64 kB 0 B
packages/esm-patient-registration-app/dist/788.js 1.63 kB 0 B
packages/esm-patient-registration-app/dist/807.js 2.43 kB 0 B
packages/esm-patient-registration-app/dist/833.js 1.97 kB 0 B
packages/esm-patient-registration-app/dist/879.js 2.94 kB 0 B
packages/esm-patient-registration-app/dist/884.js 6.1 kB 0 B
packages/esm-patient-registration-app/dist/main.js 157 kB 0 B
packages/esm-patient-registration-app/dist/openmrs-esm-patient-registration-app.js 3.34 kB 0 B
packages/esm-patient-search-app/dist/130.js 109 kB 0 B
packages/esm-patient-search-app/dist/152.js 261 B 0 B
packages/esm-patient-search-app/dist/255.js 2.21 kB 0 B
packages/esm-patient-search-app/dist/271.js 936 B 0 B
packages/esm-patient-search-app/dist/303.js 260 B 0 B
packages/esm-patient-search-app/dist/319.js 950 B 0 B
packages/esm-patient-search-app/dist/379.js 25.4 kB 0 B
packages/esm-patient-search-app/dist/382.js 1.15 kB 0 B
packages/esm-patient-search-app/dist/460.js 1.07 kB 0 B
packages/esm-patient-search-app/dist/574.js 794 B 0 B
packages/esm-patient-search-app/dist/588.js 6.66 kB 0 B
packages/esm-patient-search-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-search-app/dist/635.js 1.15 kB 0 B
packages/esm-patient-search-app/dist/644.js 936 B 0 B
packages/esm-patient-search-app/dist/729.js 3.1 kB 0 B
packages/esm-patient-search-app/dist/757.js 950 B 0 B
packages/esm-patient-search-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-search-app/dist/788.js 788 B 0 B
packages/esm-patient-search-app/dist/807.js 1.13 kB 0 B
packages/esm-patient-search-app/dist/832.js 26 kB 0 B
packages/esm-patient-search-app/dist/833.js 982 B 0 B
packages/esm-patient-search-app/dist/main.js 54.6 kB 0 B
packages/esm-patient-search-app/dist/openmrs-esm-patient-search-app.js 3.34 kB 0 B
packages/esm-service-queues-app/dist/130.js 109 kB 0 B
packages/esm-service-queues-app/dist/152.js 262 B 0 B
packages/esm-service-queues-app/dist/255.js 2.23 kB 0 B
packages/esm-service-queues-app/dist/271.js 3.11 kB 0 B
packages/esm-service-queues-app/dist/303.js 261 B 0 B
packages/esm-service-queues-app/dist/319.js 3.14 kB 0 B
packages/esm-service-queues-app/dist/328.js 3.07 kB 0 B
packages/esm-service-queues-app/dist/389.js 2.42 kB 0 B
packages/esm-service-queues-app/dist/425.js 2.06 kB 0 B
packages/esm-service-queues-app/dist/460.js 3.96 kB 0 B
packages/esm-service-queues-app/dist/469.js 6.66 kB 0 B
packages/esm-service-queues-app/dist/574.js 3.13 kB 0 B
packages/esm-service-queues-app/dist/591.js 16.9 kB 0 B
packages/esm-service-queues-app/dist/610.js 6.71 kB 0 B
packages/esm-service-queues-app/dist/616.js 2.71 kB 0 B
packages/esm-service-queues-app/dist/644.js 3.06 kB 0 B
packages/esm-service-queues-app/dist/694.js 2.64 kB 0 B
packages/esm-service-queues-app/dist/729.js 3.1 kB 0 B
packages/esm-service-queues-app/dist/757.js 3.14 kB 0 B
packages/esm-service-queues-app/dist/784.js 2.63 kB 0 B
packages/esm-service-queues-app/dist/788.js 3.12 kB 0 B
packages/esm-service-queues-app/dist/804.js 161 kB 0 B
packages/esm-service-queues-app/dist/807.js 4.36 kB 0 B
packages/esm-service-queues-app/dist/833.js 3.62 kB 0 B
packages/esm-service-queues-app/dist/895.js 52.3 kB +23 B (0%)
packages/esm-service-queues-app/dist/981.js 2.93 kB 0 B
packages/esm-service-queues-app/dist/main.js 216 kB +27 B (0%)
packages/esm-service-queues-app/dist/openmrs-esm-service-queues-app.js 3.31 kB 0 B

compressed-size-action


const CalendarView: React.FC<{
calendarView: CalendarType;
events: any;
events: Array<DailyAppointmentsCountByService>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I typed this to assure consistency throughout the code.

@@ -23,7 +23,7 @@ const DailyCalendarView: React.FC<DailyCalendarViewProps> = ({
}) => {
return (
<div className={styles.container}>
<DailyHeader type={type} currentDate={currentDate} setCurrentDate={setCurrentDate} events={events} />
<DailyHeader type={type} currentDate={currentDate} setCurrentDate={setCurrentDate} />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there were some places where this prop wasn't actually being used, so I removed it in those cases.

const currentData = events?.find(
(event) => dayjs(event.appointmentDate).format('YYYY-MM-DD') === dayjs(dateTime).format('YYYY-MM-DD'),
);
const colorCoding = { HIV: 'red', 'Lab testing': 'purple', Refill: 'blue' };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were a couple places where there was coloring based on hard-coded service names... I just removed these, we will need to make this configurable somehow if we want this.

@@ -38,11 +37,11 @@ const DailyWorkloadView: React.FC<WeeklyCellProps> = ({ type, dateTime, currentD
<>
<div className={styles.allDayComponent}>
<small className={styles.allDay}>All Day</small>
{currentData?.service && (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, but I changed "service" to "services" since it was an array of services

};
const filterOnClick = () => {
// filter functionality
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the above two buttons since they have not yet been implemented

@@ -42,7 +42,8 @@ const WeeklyCalendarView: React.FC<WeeklyCalendarViewProps> = ({
);
})}
</p>
<p className={styles['weekly-calendar-all']}>
{/* displays hours of day but commented out because showing the appts by hour is not currently implemented within this code
<p className={styles['weekly-calendar-all']}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment ^^

}

export const useAppointmentsCalendar = (forDate: string, period: string) => {
const { startDate, endDate } = evaluateAppointmentCalendarDates(forDate, period);
const url = `/ws/rest/v1/appointment/appointmentCalendar?startDate=${startDate}&endDate=${endDate}`;
const url = `/ws/rest/v1/appointment/appointmentSummary?startDate=${startDate}&endDate=${endDate}`;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the "results" code block below is the meat of this code, basically we are switching from using the "appointmentCalender" endpoint, which is only a custom fork of the Bahmni Appointment module, to use the appointmentSummary endpoint that is in the released module.

}
});
return acc;
}, []);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is updated so that that maps the return from appointmentSummary endpoint to the expected data structure used previously... I also typed this data structure as "DailyAppointmentCountByService" (see below)

serviceName: string;
count: number;
}>;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this basically just types the existing data structure, so though I did change "service" to "services" to make it more clear.

@@ -0,0 +1,83 @@
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I skipped all these, but I guess they got added... :)

@mogoodrich
Copy link
Member Author

mogoodrich commented Jan 26, 2024

The failing E2E tests appear unrelated to my commit, or am I missing something?

Update: I confirmed that the playwright tests are failing for me locally, even prior to my changes.

@mogoodrich mogoodrich marked this pull request as ready for review January 26, 2024 21:35
@ibacher
Copy link
Member

ibacher commented Jan 26, 2024

The failing E2E tests appear unrelated to my commit, or am I missing something?

Yes, unrelated. Should be fixed soonish.

Copy link
Member

@donaldkibet donaldkibet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks @mogoodrich, do we plan on having support to display Weekly and Daily appointments with AppointmentSummary endpoint.

Copy link
Member

@mseaton mseaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mogoodrich! This all looks good to me.

@mogoodrich
Copy link
Member Author

LGTM Thanks @mogoodrich, do we plan on having support to display Weekly and Daily appointments with AppointmentSummary endpoint.

@donaldkibet it's a good question, it depends on the priority/need I guess. One clarification though, did the new "appointmentCalendar" endpoint in the Palladium fork support this? My goal of this PR was just to make "feature parity" with the existing Palladium fork, and, looking at the existing code (well, the UI code, at least) in the Daily and Weekly views it didn't seem to support "slotting" appointments by time, it just displayed all the appointments at the top in a row that said something like "all day". It's a good question if a daily view like this is particularly useful, but I think is the way the current code works, unless I missed something?

@mogoodrich
Copy link
Member Author

Thanks @donaldkibet @mseaton , merging this in, also see my response to Donald's question above, happy to discuss further.

@mogoodrich mogoodrich merged commit ac43897 into main Jan 29, 2024
6 checks passed
@mogoodrich mogoodrich deleted the O3-2472 branch January 29, 2024 13:37
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.

4 participants