API to update appointment status

This forum is for programmers who have questions about the source code.
Post Reply
arm5060
Posts: 4
Joined: Tue Nov 05, 2019 12:40 am

API to update appointment status

Post by arm5060 » Wed Feb 05, 2020 10:06 pm

Hello,

I need a small help regarding updating Appointment status to confirmed/cancelled etc using API.
I do have appointment ID.

Can any one provide me sample request to do it?

Much appreciated.

Thanks,
Arpit

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: API to update appointment status

Post by cmcgehee » Thu Feb 06, 2020 7:49 am

When you GET an appointment, you will see there is a participant where the actor is a patient. One of the fields on the participant object is "status". This will be "needsaction" when the patient has not confirmed the appointment and will be "accepted" once the patient has confirmed. You can send a PUT request to change the status to accepted. Keep in mind that you have to include all other fields in your request so that don't inadvertently change a different field. Here is an example PUT request to change an appointment to confirmed:

Code: Select all

{
  "resourceType": "Appointment",
  "status": "booked",
  "priority": 1,
  "description": "CmpEx",
  "start": "2020-03-20T14:20:00",
  "end": "2020-03-20T15:00:00",
  "minutesDuration": 40,
  "participant": [{
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PART",
              "display": "Participation"
            }
          ]
        }
      ],
      "actor": {
        "reference": "patient/149",
        "display": "Hannah Abbott"
      },
      "required": "required",
      "status": "accepted"
    }, {
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PPRF",
              "display": "primary performer"
            }
          ]
        }
      ],
      "actor": {
        "reference": "practitioner/1",
        "display": "Madame Pomprey, DMD"
      },
      "required": "required",
      "status": "accepted"
    }, {
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PART",
              "display": "Participation"
            }
          ]
        }
      ],
      "actor": {
        "reference": "location/3",
        "display": "OP-3"
      },
      "required": "required",
      "status": "accepted"
    }
  ],
  "basedOn": [{
      "reference": "servicerequest/7854856268706751589",
      "display": "CmpEx"
    }
  ]
}
To indicate that a patient will not show up for their appointment, set the "status" on the Appointment resource to "noshow". This will display as a broken appointment within Open Dental. Here's an example:

Code: Select all

{
  "resourceType": "Appointment",
  "status": "noshow",
  "priority": 1,
  "description": "CmpEx",
  "start": "2020-03-20T14:20:00",
  "end": "2020-03-20T15:00:00",
  "minutesDuration": 40,
  "participant": [{
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PART",
              "display": "Participation"
            }
          ]
        }
      ],
      "actor": {
        "reference": "patient/149",
        "display": "Hannah Abbott"
      },
      "required": "required",
      "status": "accepted"
    }, {
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PPRF",
              "display": "primary performer"
            }
          ]
        }
      ],
      "actor": {
        "reference": "practitioner/1",
        "display": "Madame Pomprey, DMD"
      },
      "required": "required",
      "status": "accepted"
    }, {
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PART",
              "display": "Participation"
            }
          ]
        }
      ],
      "actor": {
        "reference": "location/3",
        "display": "OP-3"
      },
      "required": "required",
      "status": "accepted"
    }
  ],
  "basedOn": [{
      "reference": "servicerequest/7854856268706751589",
      "display": "CmpEx"
    }
  ]
}
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 20
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Mon Sep 14, 2020 12:03 pm

Hi,

I am trying to cancel the appointment through API call but it gives server error.

I am using following body-code with PUT request for updating the appointment status.

Code: Select all

{
                "status": "cancelled",
                "priority": 5,
                "description": "Flo",
                "start": "2020-09-15T16:00:00",
                "end": "2020-09-15T16:45:00",
                "minutesDuration": 45,
                "participant": [
                    {
                        "type": [
                            {
                                "coding": [
                                    {
                                        "system": "http://hl7.org/fhir/participant-type",
                                        "code": "PART",
                                        "display": "Participation"
                                    }
                                ]
                            }
                        ],
                        "actor": {
                            "reference": "patient/13",
                            "display": "test"
                        },
                        "required": "required",
                        "status": "needsaction"
                    },
                    {
                        "type": [
                            {
                                "coding": [
                                    {
                                        "system": "http://hl7.org/fhir/participant-type",
                                        "code": "PPRF",
                                        "display": "primary performer"
                                    }
                                ]
                            }
                        ],
                        "actor": {
                            "reference": "practitioner/3",
                            "display": "Practitioner"
                        },
                        "required": "required",
                        "status": "accepted"
                    },
                    {
                        "type": [
                            {
                                "coding": [
                                    {
                                        "system": "http://hl7.org/fhir/participant-type",
                                        "code": "PART",
                                        "display": "Participation"
                                    }
                                ]
                            }
                        ],
                        "actor": {
                            "reference": "location/1",
                            "display": "OP-1"
                        },
                        "required": "required",
                        "status": "accepted"
                    }
                ],
                "basedOn": [
                    {
                        "reference": "servicerequest/40"
                    }
                ],
                "reasonReference": []
}

The response for the same is

Code: Select all

{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "exception",
            "details": {
                "text": "The server has encountered an error."
            }
        }
    ]
}
On the other hand, when I am trying status from the below list:
proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist
Only booked and no-show works.

So please let me know how to change status from booked to cancelled through API?

Thanks in Advance!

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: API to update appointment status

Post by cmcgehee » Mon Sep 21, 2020 10:57 am

We've committed the fix for this error. It will be available in 20.2.44 and 20.3.27. We still might have some more work to do after this because we noticed that when using the status "cancelled" it will give the appointment a status of "noshow".
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 20
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Tue Sep 22, 2020 9:48 am

Hi Chris,

Thank you for your response and we will update the opendental once next version will be released. Also can you help me with finding free slots from multiple operatory in single API call?

For example,
https://api.opendental.com/fhir/v2/slot ... tatus=free
here, we get free slots from operatory 1 and in the same api call if we want free slots from operatory 2 and 3 as well then how to define the condition in API header.

Appreciate your help and time with this!

Sincerely,
Poonam

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: API to update appointment status

Post by cmcgehee » Mon Sep 28, 2020 8:22 am

Poonam,

You should be able to use commas to include multiple schedules to get slots for multiple operatories in one request. For example:

Code: Select all

https://api.opendental.com/fhir/v2/slot?schedule=20200921L1,20200921L2,20200921L3&status=free
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 20
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Mon Sep 28, 2020 1:04 pm

Hi Chris,
Thank you for your reply!

I tried using comma but I am getting response for only last schedule given in the parameters list.

For eg,

Code: Select all

https://api.opendental.com/fhir/v2/slot?schedule=20200921L1,20200921L2,20200921L3&status=free
For the above request I am getting response only for schedule 20200921L3.

Appreciate your time!

Sincerely,
Poonam

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: API to update appointment status

Post by cmcgehee » Mon Sep 28, 2020 5:19 pm

Would you mind telling me the version of Open Dental the database is on that you are sending requests to? In 20.2.29 we fixed an issue that had to do with Slots.
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 20
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Wed Sep 30, 2020 1:00 pm

Hi Chris,

The version of opendental that we are using is 20.2.40.0 which was last updated on 09/10/20.

Thanks and regards,
Poonam

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: API to update appointment status

Post by cmcgehee » Mon Oct 05, 2020 2:00 pm

Thanks, I'll have one of our engineers look into this issue.
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 20
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Fri Oct 16, 2020 1:36 pm

Hi Chris,

Any update on passing multiple schedule?

Thanks,

rochelle
Posts: 17
Joined: Mon Jun 01, 2020 10:29 am

Re: API to update appointment status

Post by rochelle » Mon Oct 19, 2020 11:33 am

Poonam,
I apologize for the delay in getting back to you. I have investigate this and you are correct, presently we only return the slots for 1 schedule. I will be creating a fix for this and will update this thread the moment it is live.

poonam
Posts: 20
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Tue Oct 20, 2020 11:12 am

Thank you for your reply!

Hope to receive the update soon on this.

Thanks,
Poonam

rochelle
Posts: 17
Joined: Mon Jun 01, 2020 10:29 am

Re: API to update appointment status

Post by rochelle » Tue Dec 08, 2020 5:44 am

This problem should be fixed now, please let me know if you have further concerns.

poonam
Posts: 20
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Tue Dec 29, 2020 12:06 pm

Hi,

I am trying to get all the free slots for all the operatories of a particular day using

Code: Select all

https://api.opendental.com/fhir/v2/slot?schedule=20201230L2,20201230L1,20201230L3&status=free
But, I am getting for only 20201230L3 so just wanted to check am I using right endpoint with multiple parameters?

Please suggest!

Thanks and regards,
Poonam

rochelle
Posts: 17
Joined: Mon Jun 01, 2020 10:29 am

Re: API to update appointment status

Post by rochelle » Wed Jan 06, 2021 8:00 am

Your request looks good to me. When I test this on my side, I return both operatories. This makes me curious if there is a schedule for the other locations in your request for the given day? or that maybe those operatories do not have providers? It's hard to say without seeing your set up but I can say that testing it on my side with a day that had completely open schedules in multiple operatories, which had providers attached to them, did return all the locations. If this is not helpful, I may request calling in to see what your setup is like and if we can help you more directly.

poonam
Posts: 20
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Thu Jan 21, 2021 12:02 pm

Hi,

Thank you for your response!
If I check the above operatory individually then I get free slot for each of them. So schedules are open I assume, but if you want to see the set up then let me know the best way to connect.

Thank you again!

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: API to update appointment status

Post by jordansparks » Fri Jan 22, 2021 10:45 am

I don't like the logic in the FHIR API for this. It assumes that you have attached a schedule to an operatory, which is not how most users do it. Usually, you attach a schedule to a provider and then a provider to an operatory. So the FHIR API will miss those. The new non-FHIR API will get it right so that it always matches what you see in the Appointments module.
Jordan Sparks, DMD
http://www.opendental.com

poonam
Posts: 20
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Mon Jun 28, 2021 1:44 pm

Hi,
Can we connect your technical team to know about getting the free slots for a week time in one API call?

Thanks and regards,
Poonam
Last edited by poonam on Mon Jun 28, 2021 4:13 pm, edited 1 time in total.

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: API to update appointment status

Post by jordansparks » Mon Jun 28, 2021 3:13 pm

I will answer this over in the API forum.
Jordan Sparks, DMD
http://www.opendental.com

Post Reply