Skip to content

bug - schedule screen speed

CATS-683

background

schedule screen makes ajax calls to get data for display in calendar. one call - customers_emp endpoint - includes ‘sites’ data, which is a list of hospital sites.

problem

AdminSiteRepository::getSitesWithTags is called to get the site info (and related ‘tag’ informtion for each site). During development of date-aware rates, date-aware rate info was added in to this getSitesWithTags() call, as it was used in another area. Because getSitesWithTags() is used in multiple places, the additional overhead of pulling in date-aware rate info for all sites was creating extra overhead which was not needed.

resolution(s)

There are two areas of resolution.

avoid adding date-aware rates

getSitesWithTags had an ‘include rate’ flag added, and some calls to getSitesWithTags were changed getSitesWithTagsWithoutRates to skip adding rate information altogether.

cache date aware rate lookup

When needed, in rateService file, date-aware data is loaded in one block and then cached to reduce future lookups. The caching is short term for now (60 seconds), and meant primarily to cover repeated uses in the same request, not necessarily caching for hours or days. The information is date-based, such that data being viewed on Tuesday may not be the same as Monday anyway, so longer-term caching isn’t necessarily useful.

Possible modification in future would be to cache longer term, then clear all related caches on any rate modifications (this would need to assume all rate modifications are made directly via CATS-code, not modified by third party clients making direct modifications).

note

some of the decisions in RateService may have to be modified based on CATS-664 decision regarding ‘effective_end_date’.