Appointment duration set per provider schedule not appointment type

I am posting this message to see if any of you have solved this issue already. @adunsulag I am including you because you are overhauling the calendar to use twig.

The practice has several providers and they all have different durations of visit. There are only 4 visit types in the system.

They want to be able to set the appointment duration based on the provider schedule and not by the visit type. The way the system currently now works to achieve what they want from the calendar. They would have to create a lot of different visit types for 15, 30, and 1hr increments. The calendar is set for 15 minute intervals. This is a good starting point so that each duration can be displayed properly.

My thoughts are adding a global to check of whether duration will be set by the provider schedule or visit type. Next, create a class to handle this function of collecting the provider specific duration. We have tested setting the duration in the provider tab of the calendar but it returns an odd number value and not 15, 30, or 90. Also there are some other factors that make using that structure to retrieve a stable value.
I was looking at creating a twig form to manage the data input. Once a schedule has been set for the provider, the provider would show on this form so the duration of their appointments can be set. I was thinking of storing this information in the first “In Office” entry. This entry will never change is the reason that I am selecting this spot. The rest is substituting the destination in the add edit event.

Share your thoughts, insights, and things I may not have considered.


This sounds like Behavioral Health, am I right?

You are correct. It is a group of different specialties if you want to call them that.

So I know that the CPT codes are contigent on the amount of time spent with the patient. I’m wondering if you can use that as leverage to get what you need done.

This seems like a lot of complexity for a solution that can already be replicated in the system. I assume each Provider doesn’t have a different duration of visit, but instead each group of providers have a different duration (i.e. “All Adolescents Therapists have a 90 minute appointment time, all adult therapists have a 60 minute time, etc”)

I would be hesitant to inject this feature into core as it only solves a narrowly defined problem. Instead, we should look at what in the Calendar needs to be modified to allow a Module to handle this task. This keeps the complexity of core at bay, and allows modules to interact with the calendar to address these very specific cases.

1 Like

I know this could be a vary narrow issue. The complexity for us is that each provider in this group are different. There are 5 providers and each one treats a different patient type.

Looking purely at the calendar. It is the duration field that needs to be populated with the specific duration requested by the provider. That is what I have gotten it down too. There is not going to be a lot of changes to the codebase. I created a form and table to store the duration information for each provider. I decided not to change anything about the core of the system. The durations will be populated into the add edit event form when the staff opens it. That is the only thing that needs to change.

Instead of the category populating the duration. The data from the provider duration table will populate that field. Problem solved. I hope. I can certainly turn this into a module but at this time I see no interest for others in the community to do so.

Thanks for your input @robert.down and @growlingflea

The next day:

I created a screen to individually set the providers appointment durations. I made a new table for that information alone as to not interfere with the calendar at all. In the add edit events form, I called the data for that provider and put in it in the duration instead of the default.

If I understand the problem, I have seen it dealt with by creating appointment categories named for the provider and procedure or appointment type, e.g., ‘SmithMHSExam’ or ‘JonesIQTest’.

Each category can have its own duration, as a multiple of the global minimum session length, and the name makes sure the category is used in the right calendar. And it’s much simpler than using a code revision to accomplish the same thing.

Just offering a non-dev’s perspective…

  • HT

I have done it that way in the past but then you end up with a whole bunch of categories trying to solve this delimma.

I created this:

This is outside of the calendar system. It allow them to set the duration of appointments by the provider and not the category. They on have 4 categories for the calendar. They way they can keep the same 4 categories and as providers come on or leave. The categories stay the same. The list is populated by the user being marked on the calendar with a schedule. That ensures that only providers with proper calendar schedule is on the list. The data is stored in its own table. I just had to make a couple of small changes to the add edit event page to get this working. Now all the appointments are set according to the providers desired appointment time.

If there is enough interest in this add on. I will make a repo for it.

Hi!. Can you share how you did it? Thanks

The feature above, I built it to record the provider individual duration’s. Created a table to store the data. Then change the duration on the appointment scheduler to get the duration based on the provider and not the appointment type.

I am going to invite @robert.down and @adunsulag into the conversation. I know that Stephen is working on twigging the calendar and he may have already included a feature like this in the work that he is doing.

This is one of the files in the duration processor.
provider_duration_mgr.php (723 Bytes)

Should this be a module or should I submit a PR for the code base.

is this feature avaiable in 7.0.1?

No, I never made a repo for this feature.

There are challenges setting up calendar.

  1. I am trying to setup the height of the timeslot to around 60px but not able to find the right place to make the change. Looks like multifile files needs to be changed.
  2. I want to display the phone number of the patient in the calendar. Hence the size to 60px
  3. The default duration in the appointment popup is always 15. this should be as per the set providers duration. Which I think you developed.
    Sherwin, Any pointers on these above issues?

To change the default height of the calendar from 15 minutes. Go into Config under calendar. You should find all the

Sherwin, Only the Calendar interval can be changed to 15,30 and 60 mins. I am talking about the size, The height of the Interval. This is not available in the Globals. Also the duration field in the Appointment popup is default to 15 and we dont have a way to change the default.

I understand now and yes that would need the code to change. Here is the location of all the templates.

Thanks Serwin,
There is this below code in the ajaz_template.html
[-Values used in setting timeslot and event heights-]
/* if you change these be sure to change their matching values in

  • the CSS for the calendar, found in interface/themes/ajax_calendar.css

.timeslot {
/* height value is tied to two PHP variables in the ajax_*.html files
* if you change this value then be sure to change the matching value
* in those files */
height: 60px;

I changed the value to 60 in both. Below is the output. The height of the timeslot on the left does not seem to increase.


IMO, the left side should not change. The appointment spans an hour and that is what your screenshot is showing me. So the appointment should only cover from 9 AM to 10 AM. In the screenshot, it is covering from 9 AM to 10:30 AM.

Thanks Sherwin,
Honestly No. The appointment is set for 30mins. The size is 60px hence its spanning over.
Below is a sample that I would like. I think its a little complex than I think


Additional Info> At present it looks like the code is trying to fit the time line in one screen. Its a good thing but we end up making the columns smaller. For eg: if you set an appint for a patient for 15 mins duration it becomes miniscule and it very hard to edit again from the calender.
No matter the Global for timeslot is set to 15 or 60 minutes, the size of the timeslot in the calendar should be fixed. So that more info can be shown in the calendar. Scrolling is okay atleast for Desktops. Its also great if the calendar can auto center to the current time. This avoids a lot of scrolling when you open or refresh the calendar. Consider this only for Days Calendar.</Additional Info>

What i am looking for is a fixed size for the calendar timeslot no mater the global is set to any minutes. If set for 15 Minutes, the calender will show 9:00-9:15-9:30 but the height beween 9:00 and 9:15 shoudl be xxpx. If set for 30 Minutes, the calender will show 9:00-9:30-10:00 but the height beween 9:00 and 9:35, 10:00 should be xxpx. Idealy 60px.

1 Like

Hi @levijustus -
I could be wrong but is it possible you folks have re-invented the wheel? When you say that the default 15 minute duration can’t be changed, that is not correct. And, when the default time is changed, the size of the appointment blank in the calendar changes proportionately with the new time.

To be clear, the default duration of an appointment category can be changed.
Take for example, an Office Visit:

Its default duration is 15 minutes.
But go to Admin/ Clinic/ Calendar, select ‘Categories’ link (not shown)
then scroll down to the details panel for that appointment category (arrow).
Changing that Duration value (oval below) will make the default duration of any ‘Office Visit’ the new time.


Compare the 2 Underwood appointments with different default durations, the 1st for 15 minutes, the 2nd for 45. The 45 min appointment occupies 3 of the 15 minute slots.


But if that’s not what you’re talking about… never mind! :slight_smile: