Book appointment leads to unexplainable result

This forum is for programmers who have questions about the source code.
Post Reply
bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Book appointment leads to unexplainable result

Post by bravegag » Thu Aug 22, 2019 2:57 pm

Hello (Hi Chris :)),

I submit the following two request to OD under my private FHIR API key:

Code: Select all

FHIR POST request https://api.opendental.com/fhir/v2/servicerequest with body:
{
  "status": "active",
  "intent": "proposal",
  "code": {
    "coding": [
      {
        "system": "http://hl7.org/fhir/us/sid/cdt",
        "code": "T1356"
      }
    ]
  },
  "subject": {
    "reference": "Patient/24"
  },
  "occurrenceDateTime": "2019-08-26T09:15:00",
  "performer": [
    {
      "reference": "Practitioner/3"
    }
  ]
}
and the following book appointment request using the previously successful creation of servicerequest `ServiceRequest/138`:

Code: Select all

FHIR POST request https://api.opendental.com/fhir/v2/appointment with body
{
  "start": "2019-08-26T09:15:00",
  "end": "2019-08-26T10:15:00",
  "minutesDuration": 60,
  "status": "booked",
  "priority": 5,
  "participant": [
    {
      "actor": {
        "reference": "Patient/24"
      },
      "type": [
        {
          "code": [
            {
              "code": "PART",
              "system": "http://hl7.org/fhir/participant-type"
            }
          ]
        }
      ],
      "required": "required",
      "status": "accepted"
    },
    {
      "actor": {
        "reference": "Practitioner/3"
      },
      "type": [
        {
          "code": [
            {
              "code": "PPRF",
              "system": "http://hl7.org/fhir/participant-type"
            }
          ]
        }
      ]
    },
    {
      "actor": {
        "reference": "Location/1"
      },
      "type": [
        {
          "code": [
            {
              "code": "PART",
              "system": "http://hl7.org/fhir/participant-type"
            }
          ]
        }
      ]
    }
  ],
  "basedOn": [
    {
      "reference": "ServiceRequest/138"
    }
  ],
  "reasonReference": []
}
I get a successful response, however, when I look at my OD sandbox I see that the book appointment was done for the wrong DDS and with multiple servicerequests instead of the single request with code T1356:
Image

Many TIA,
Best regards,
Giovanni

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

Re: Book appointment leads to unexplainable result

Post by cmcgehee » Thu Aug 22, 2019 3:21 pm

In your screenshot "Dr. Brian Albert" is the name of the operatory the appointment is in. The provider on the actual appointment is "DOC1". It may be that you scheduled an appointment with one provider in another provider's operatory.

In the Edit Appointment window, the procedures grid lists all treatment planned procedures for the patient. The procedure(s) actually attached to this appointment are highlighted. So this appointment does have a single T1356 attached.
Chris McGehee
Open Dental Software
http://www.opendental.com

bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Re: Book appointment leads to unexplainable result

Post by bravegag » Fri Aug 23, 2019 2:16 am

Hi Chris,

Thanks once more for your great support.
cmcgehee wrote:In your screenshot "Dr. Brian Albert" is the name of the operatory the appointment is in. The provider on the actual appointment is "DOC1". It may be that you scheduled an appointment with one provider in another provider's operatory.
Where do I see this in my book appointment request? I only see the reference to the correct intended DDS which, in this case is, Sarah K Lexington.

Code: Select all

"actor": {
        "reference": "Practitioner/3"
      },
cmcgehee wrote:In the Edit Appointment window, the procedures grid lists all treatment planned procedures for the patient. The procedure(s) actually attached to this appointment are highlighted. So this appointment does have a single T1356 attached.
It's clear now, thank you!

Best regards,
Giovanni

bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Re: Book appointment leads to unexplainable result

Post by bravegag » Mon Aug 26, 2019 7:48 am

Hi Chris,

Can you please help me with this open bit:
bravegag wrote:
cmcgehee wrote:In your screenshot "Dr. Brian Albert" is the name of the operatory the appointment is in. The provider on the actual appointment is "DOC1". It may be that you scheduled an appointment with one provider in another provider's operatory.
Where do I see this in my book appointment request? I only see the reference to the correct intended DDS which, in this case is, Sarah K Lexington.

Code: Select all

"actor": {
        "reference": "Practitioner/3"
      },
Many TIA,
Best regards,
Giovanni

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

Re: Book appointment leads to unexplainable result

Post by cmcgehee » Mon Aug 26, 2019 9:49 am

You can find the name of the practitioner by

Code: Select all

GET https://api.opendental.com/fhir/v2/practitioner/3
I see in your appointment create request there is

Code: Select all

"actor": {
    "reference": "Location/1"
},
You can find the name of the operatory (location) by

Code: Select all

GET https://api.opendental.com/fhir/v2/location/1
Chris McGehee
Open Dental Software
http://www.opendental.com

bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Re: Book appointment leads to unexplainable result

Post by bravegag » Fri Aug 30, 2019 3:32 am

Hi Chris,

Thank you, but it's still not clear to me how it should work. I have the patient that chooses to make an appointment with practitioner say e.g. DDS Brian L Albert with practitioner id 1. Now I need the operatory where this practitioner operates ... and I can't find this in the API.

Another alternative is to book the appointment for any operatory, I only care that the appointment is made for the given practitioner id.

How can I achieve either of the use-cases above using the FHIR API?

Another possibility is to provide the operatory where each practitioner operates when we call the API

Code: Select all

https://api.opendental.com/fhir/v2/practitioner
Many thanks in advance,
Best regards,
Giovanni

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

Re: Book appointment leads to unexplainable result

Post by cmcgehee » Tue Sep 03, 2019 8:02 am

You make a good point that you don't have any way to find which operatory the appointment should be scheduled in. I have submitted a job proposal to add the information about which provider is assigned to which operatory in the API.
Chris McGehee
Open Dental Software
http://www.opendental.com

bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Re: Book appointment leads to unexplainable result

Post by bravegag » Fri Sep 06, 2019 11:51 am

Hi Chris,

Fantastic! Thank you! as of now I'm doing the following workaround:

I read from the following API the locationId and resource name of the practitioners e.g. { "name": "Dr. Brian Albert", "locationId": "1" } here there isn't any practitioner id unfortunately. In fact, it is hard to even match the practitioners because here they appear as "Dr. Brian Albert", some times doesn't even include the family name etc.

Code: Select all

https://api.opendental.com/fhir/v2/location?organization=organization/XXX
I then call the following API and match the resulting practitioners with the id using a heuristic soft matching of the previous API results:

Code: Select all

https://api.opendental.com/fhir/v2/practitioner
In Scala, I do something like:

Code: Select all

// location operatory id keyed by all possible practitioner's name matches e.g. doesn't work if two practitioners have the same first or last name.
val myMap = ... e.g. Map("Dr. Brian Albert" -> 1, "Albert" -> 1, "Brian" -> 1) // of course not like this but after parsing the result of request #1 above, is like a thesaurus with all possible ways to identify a practitioner by any of her names.
// then match it with the practitioner results from the second request using any of names
myMap.get(fullName).getOrElse(myMap.get(family).getOrElse(myMap.get(given).getOrElse(""))).toString
Best regards,
Giovanni

bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Re: Book appointment leads to unexplainable result

Post by bravegag » Mon Sep 23, 2019 5:45 am

Hi Chris,

Are there any updates on this? I have seen multiple software updates lately and was wondering whether this use-case has been implemened/solved?

Many TIA,
Best regards,
Giovanni

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

Re: Book appointment leads to unexplainable result

Post by cmcgehee » Mon Sep 23, 2019 7:25 am

There are not any updates on this. I can update this forum post if/when we complete this.
Chris McGehee
Open Dental Software
http://www.opendental.com

bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Re: Book appointment leads to unexplainable result

Post by bravegag » Mon Sep 23, 2019 8:25 am

Hi Chris,

Fantastic! thanks! please keep me (us) posted.

Many TIA,
Best regards,
Giovanni

Post Reply