We're trying to show Appointments in our app but finding some oddities when it comes to clinics. When we make the call for appointments, the ClinicNum associated appears to be the one associated with the patient, not where the appointment is. E.g. if a patient who was registered under ClinicNum 1 goes to ClinicNum 0 for an appointment, we're told the appointment is ClinicNum 1. Are we missing something or doing something wrong that we're overlooking? Thanks.
Here's an example response:
[
{
"AptNum": 151,
"PatNum": 33,
"AptStatus": "Scheduled",
"Pattern": "//XX//",
"Confirmed": 19,
"confirmed": "Unconfirmed",
"Op": 1,
"Note": "",
"ProvNum": 1,
"provAbbr": "DOC1", <- this doc is in the default clinic 0
"ProvHyg": 0,
"AptDateTime": "2024-09-04 11:30:00",
"NextAptNum": 0,
"UnschedStatus": 0,
"unschedStatus": "",
"ProcDescript": "Flo",
"ClinicNum": 1, <- I made the appointment in clinic 0, not 1
"IsHygiene": "False",
"DateTStamp": "2024-09-04 09:24:19",
"DateTimeArrived": "2024-09-04 00:00:00",
"DateTimeSeated": "2024-09-04 00:00:00",
"DateTimeDismissed": "2024-09-04 00:00:00",
"AppointmentTypeNum": 0,
"eServiceLogType": "None",
"serverDateTime": "2024-09-04 10:17:24"
},
{
"AptNum": 150,
"PatNum": 33,
"AptStatus": "Scheduled",
"Pattern": "//XXXX//",
"Confirmed": 19,
"confirmed": "Unconfirmed",
"Op": 7,
"Note": "",
"ProvNum": 5,
"provAbbr": "C1 Doc1",
"ProvHyg": 0,
"AptDateTime": "2024-09-04 11:40:00",
"NextAptNum": 0,
"UnschedStatus": 0,
"unschedStatus": "",
"ProcDescript": "PA, 4-BWX",
"ClinicNum": 1,
"IsHygiene": "False",
"DateTStamp": "2024-09-04 09:24:03",
"DateTimeArrived": "2024-09-04 00:00:00",
"DateTimeSeated": "2024-09-04 00:00:00",
"DateTimeDismissed": "2024-09-04 00:00:00",
"AppointmentTypeNum": 0,
"eServiceLogType": "None",
"serverDateTime": "2024-09-04 10:17:24"
}
]
What I see in OD for clinic 1 (the other appointment shows up when I toggle to clinic 0):
Appointments
Re: Appointments
The ClinicNum associate with an appointment can be set to any clinic, regardless of the operatory associated with the appointment.
When using Appointments POST (create) without specifying a ClinicNum, the default value will match the appointments patient.ClinicNum up to version 24.2.22. In version 24.2.23 and later, ClinicNum will default to op.ClinicNum if they have one set. Otherwise, default is patient.ClinicNum.
We recommend specifying the ClinicNum when using the API to ensure it is set to the value you desire.
When using Appointments POST (create) without specifying a ClinicNum, the default value will match the appointments patient.ClinicNum up to version 24.2.22. In version 24.2.23 and later, ClinicNum will default to op.ClinicNum if they have one set. Otherwise, default is patient.ClinicNum.
We recommend specifying the ClinicNum when using the API to ensure it is set to the value you desire.
Re: Appointments
I'm creating the appointments in Open Dental itself. So it's correct in Open Dental and shows as I expect it to, but when I pull in the data via the API, I'm not seeing the clinicNum I would expect.
Re: Appointments
I recommend using the User Query to retrieve the appointment from the database. The ClinicNum should be identical to what is being returned via the API.
Re: Appointments
I'm not sure how that helps? The API is returning what for me is an unexpected result, so running a different query that should give me the same result as the API doesn't help me figure out why I'm getting this unexpected result.
Re: Appointments
Good morning,
As I understand it, you originally reported an issue of seeing appointments in clinics you don't expect.
You say you are making the appointments within the Open Dental UI. As DerekR explained, there is specific logic that is used to determine which clinicnum is used. If you have Clinic A selected (on the toolbar, Clinics > Clinic A) and create an appointment for the patient in one of its operatories, the appointment.clinicnum with be for Clinic A. This is regardless of the patient's default clinic (patient.clinicnum) and regardless of the provider's assigned clinic (providercliniclink.clinicnum). Your expectation should be to see appointments in whichever clinic the user selected (in their OD session) before creating the appointment.
As an aside, when using clinics the Headquarters clinic (clinicnum 0) is typically used for administrative purposes, and not recommended to use as a location serving patients. You can find more information on how clinics behave in Open Dental in our manual. API POST and PUT endpoints always follow logic performed via the Open Dental UI.
As I understand it, you originally reported an issue of seeing appointments in clinics you don't expect.
The suggestion to run a query is to determine if the API is returning the unexpected result or if the database itself contains the expected result. API GET endpoints only return what is in the database. So if you query this appointment and the database values match, then there is not a an issue with the API endpoint.The API is returning what for me is an unexpected result...
You say you are making the appointments within the Open Dental UI. As DerekR explained, there is specific logic that is used to determine which clinicnum is used. If you have Clinic A selected (on the toolbar, Clinics > Clinic A) and create an appointment for the patient in one of its operatories, the appointment.clinicnum with be for Clinic A. This is regardless of the patient's default clinic (patient.clinicnum) and regardless of the provider's assigned clinic (providercliniclink.clinicnum). Your expectation should be to see appointments in whichever clinic the user selected (in their OD session) before creating the appointment.
As an aside, when using clinics the Headquarters clinic (clinicnum 0) is typically used for administrative purposes, and not recommended to use as a location serving patients. You can find more information on how clinics behave in Open Dental in our manual. API POST and PUT endpoints always follow logic performed via the Open Dental UI.