Recurring Appointments in Appointment Module

As per the discussion with Angshu on the model and api, we have come to the following agreements:

1. The current technical model is good, with the following changes:

  • Rename ‘appointment_recurrence_map’ table to ‘patient_appointment_occurrence’.
  • Rename ‘appointment_recurrence_pattern’ table to ‘patient_appointment_timings’ ', hence the primary key will be now called ‘patient_appointment_timings_id’
  • Pass the type of recurrence as enum values (eg. 1 for DAY, 3 for MONTH & 2 for WEEK), handled in code. No need of an additional table called ‘appointment_recurring_type’.
  • If we have needs to encode date in data (e.g MONDAY) etc - use String (MONDAY, TUESDAY) instead of using 1, 2 etc.

2. Have API to return just one instance of that recurring appointment and another API to return the series of all recurring appointment.

3. The above API request body looks good. The final request body would look like below eg:

{
  "appointmentDetail": {
    "patientUuid": "f0d06506-8071-4ec4-a528-31cad0dff9dd",
    "serviceUuid": "7b200662-e21a-488c-8274-4eff81117608",
    "startDateTime": "2019-05-14T05:30:00.000Z",
    "endDateTime": "2019-05-14T06:30:00.000Z",
    "locationUuid": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
    "appointmentKind": "Recurring"
  },
  "recurringPattern": {
    "frequency": "5",
    "period": "1",
    "daysOfWeek": [],
    "endDate": "",
    "type": "DAY"
  }
}

@angshuonline @vmalini @shivarachakonda @vvinay @sowmika @binduak @sravya @ramses @abhinavpc @megkmcguire @mohitd @jinal

1 Like

Hey,

Here is the updated technical documentation of the recurring appointments data model. This is the final model and we are going to develop the same…

Updated Technical Details - Recurring Appointments.pdf (323.1 KB)

We would call the ‘patient_appointment_timings’ table as ‘patient_appointment_recurring_time’, as per the discussion on community slack channel.

Based on the past conversations, we have shared the mock-ups for developing this functionality: https://docs.google.com/presentation/d/1smSa9qH7DNFNN7w94umdetAXffsBu0lJouB5kqnCABM/edit#slide=id.g5ad73faae4_0_0

It covers the following:

  1. Context and use case for recurring appointments
  2. Assumptions we are making when creating recurrences, especially in case of weekly recurring appts (we have gotten these assumptions validated by many implementations)
  3. User flow for editing an appointment and managing conflicts for a recurring appointment, which follows the current logic of allowing a user to double-book a patient or let him/her book an appt when service is unavailable but alerts the user for the same

Do let us know if there are any further questions

CC: @snehabagri @vmalini @sowmika @bhiravabhatla @shivarachakonda @grssvinay

@angshuonline @rajashri @sravya

Looking at the mocks, I feel users (and dev teams) are going to struggle for real estate (especially on Bahmni’s min display requirement of 9"). In another thread, there is mention of relooking at the UI design for the appointment create/edit display. I feel we need to think through the design and layout and not just make the “repeat” patterns follow on in a single column layout.

As part of edit of recurring appointments we are planning to create a new PUT API as below: <HOST>/openmrs/ws/rest/v1/appointment?applyForAll=true/false

In the above API,

  • applyForAll = true means that the change should be applied to all the pending occurrences of recurring appointment.
  • applyForAll = false means that the change should be applied to that particular appointment.

Below is the sample request and response:

Request: (same as existing AppointmentRequest)
{
 "uuid": "5eebc88b-3ad5-4fd8-8a6b-ac1601a4c3d3",
  "patientUuid": "7023ee46-e2ec-40c4-8f55-15673209dbf0",
  "serviceUuid": "2b87edcf-39ac-4dec-94c9-713b932e847c",
  "serviceTypeUuid": "e7912578-bb5b-4617-ba45-28dd178b46de",
  "startDateTime": "2019-06-12T04:30:00.000Z",
  "endDateTime": "2019-06-12T05:00:00.000Z",
  "providers": [
    {
      "uuid": "8e482ebc-20e0-11e7-a53f-000c29e530d2",
      "response": "ACCEPTED",
      "comments": null
    }
  ],
  "locationUuid": "8de35e75-20e0-11e7-a53f-000c29e530d2",
  "appointmentKind": "Scheduled",
  "recurringPattern": {
    "frequency": 10,
    "period": 2,
    "type": "Day"
  }
}

Response: (edited appointments)
[
  {
    "uuid": "5eebc88b-3ad5-4fd8-8a6b-ac1601a4c3d3",
    "appointmentNumber": "0000",
    "patient": {
      "identifier": "IQ1230",
      "name": "CFE4BD7C CFE4BD80",
      "uuid": "7023ee46-e2ec-40c4-8f55-15673209dbf0"
    },
    "service": {
      "appointmentServiceId": 1,
      "name": "Physiotherapy OPD",
      "description": null,
      "speciality": {},
      "startTime": "",
      "endTime": "",
      "maxAppointmentsLimit": null,
      "durationMins": null,
      "location": {
        "name": "Physiotherapy",
        "uuid": "8de35e75-20e0-11e7-a53f-000c29e530d2"
      },
      "uuid": "2b87edcf-39ac-4dec-94c9-713b932e847c",
      "color": "#00CED1",
      "creatorName": null
    },
    "serviceType": {
      "duration": 30,
      "name": "1x session",
      "uuid": "e7912578-bb5b-4617-ba45-28dd178b46de"
    },
    "provider": null,
    "location": {
      "name": "Physiotherapy",
      "uuid": "8de35e75-20e0-11e7-a53f-000c29e530d2"
    },
    "startDateTime": 1560313800000,
    "endDateTime": 1560315600000,
    "appointmentKind": "Scheduled",
    "status": "Scheduled",
    "comments": null,
    "additionalInfo": null,
    "providers": [
      {
        "uuid": "8e482ebc-20e0-11e7-a53f-000c29e530d2",
        "comments": null,
        "response": "ACCEPTED",
        "name": "Ahmad Alrosan"
      }
    ]
  },
  {...................................
  }]```

@angshuonline @snehabagri @shivarachakonda @venkatavineela

While working on Edit Recurring Appointments, we discovered that we would like to maintain the info of the actual appointment which was created as part of the recurring appointment series and the new appointment which got created when I edited the ‘start_date’ for an appointment within that series. In order to achieve this we are introducing a new column in the patient_appointment table, called ‘related_appointment_id’.

@angshuonline @sowmika @jinal @binduak @vmalini

1 Like