Appointment App Provider Dropdown Does Not Display Beyond 5 Providers

Hi community,

When creating an appointment in the Bahmni Appointments Scheduling App, the application fails to handle more than 5 providers list from dropdown selection.

While the first 5 providers load and display perfectly, adding or scrolling to a 6th provider causes the dropdown element to crash. Following this crash, the Provider dropdown malfunctions, displaying a provider list of only 2 to 3 entries.

My Global property value"webservices.rest.maxResultsDefault=200

Has anyone encountered this issue before, or does anyone know a workaround to fix this dropdown behavior? Any help would be highly appreciated

@akhilmalhotra

To my understanding, your Global property value"webservices.rest.maxResultsDefault=200 controls how many results the server sends back - 200 is plenty. The problem is almost certainly on the display side, not the server side.

The setting maxAppointmentProviders in the appointments app configuration controls how many providers can be selected for a single appointment. The default value in Bahmni/default-config is 4, which would explain why the dropdown breaks around the 5th or 6th provider.

A couple of questions to help troubleshoot:

  1. Are you using the standard Bahmni default-config, or do you have a custom config repository?

    • If standard : you’ll need to override it with your own config repo to change this value.

    • If custom config: you can directly edit the setting in your config.

Thank you for your reply, regarding your troubleshooting question, We are managing the Git repository based on the Bahmni Standard version. The maxAppointmentProviders setting is already configured in our repo as: “maxAppointmentProviders”: 15.

Let’s get on a call to debug this. I would like to understand how are you using config and what steps have you already followed.

@arshiya_sehzad I had the same issue and could reproduce it locally.

About my environment:

Bahmni Docker: 1.0.1-standard

Bahmni Appointment Scheduling: 2.0.2

bahmni/appointments:1.1.1 (appointment frontend image version)

“maxAppointmentProviders”: 15 (as you mentioned, this is not the configuration for controlling the provider list in the dropdown, but we increase this anyway to see the impact )

Steps followed:

  1. I have created 5 providers; all 5 providers show on the drop-down.
  2. I have created a 6th provider; only providers one and five show on the drop-down.
  3. Retired the 6th provider; all 5 providers (1-5) show on the drop-down.
  4. Unretired the 6th provider and retired provider one; 5 providers show on the drop-down (2-6); noticed the 6th provider showing on the drop-down list; this confirms the 6th provider data and entity link is ok.
  5. Provider API call (https://localhost/openmrs/ws/rest/v1/provider?v=custom:(display,person,uuid,retired,attributes:(attributeType:(display),value,voided))) returning all 6 providers.
  6. All 6 providers have attributes,
{
          "attributeType": {
            "display": "Available for appointments"
          },
          "value": true,
          "voided": false
        }

Providers data returned from API call:

It seems the frontend is always limiting the dropdown to 2 providers when there are more than 5.

I think in openmrs-module-appointments-frontend module this dropdown filtering option is causing trouble if a provider has multiple attributes and ‘Available for Appointments’ is not the first attribute then this code should missed the first index and break the entire provider list in provider option.

. openmrs-module-appointments-frontend

ui/react-components/components/Provider/ProviderSearch.jsx line no 44

ProviderSearch.jsx

const createDropdownOptions = results => {
    const options = [];
    forEach(results, provider => {
      if (
        provider.attributes.length > 0
          ? provider.attributes[0].attributeType.display ===
          availableForAppointments
          : false
      ) {
        options.push(createProviderOption(provider));
      }
    });
    return sortBy(options, providerOption =>
      providerOption.label.toLowerCase()
    )
  };

@sohel you are right ,the filtering logic checks only provider.attributes[0] to look for the “Available for Appointments” attribute, assuming it is always the first element of the attributes array. If a provider has multiple attributes and “Available for Appointments” is not the first one, the filter check fails for that provider, causing it to be dropped from the dropdown. This is why the effect appears to be “more than 5 providers breaks the list” - it’s actually dependent on attribute ordering per provider, not a hard count limit. We will create a bug card and fix it in the upcoming days.