Argo-Scheduling Implementation Guide CI Build

Appointment_Book

OPERATION: Appointment_Book

The official URL for this operation definition is:

http://fhir.org/guides/argonaut-scheduling/OperationDefinition/appointment-book

Request to book a selected Appointment. This operation follows the appointment availability and optional hold interactiona. This operaton completes the booking of an appointment. The server determines if the nominated appointment is still available (i.e., all the required actors and physical assets needed for the appointment are still available) and either accepts or rejects the hold request and updates the resource status accordingly. See the Appointment State Diagram for further details on statuses.

URL: [base]/Appointment/$book

URL: [base]/Appointment/[id]/$book

Parameters

Use Name Cardinality Type Binding Documentation
IN appt-id 0..1 uri

A resource id for one of proposed Appointments returned by a prior $find operation (e.g., Resource/1234). This is the same resource id as used for the $hold operation. References can be to an absolute URL, but servers only perform this operation on their own appointments.

IN appt-resource 0..1 Appointment (Argonaut Appointment Profile)

When prefetching open Slots, an Argonaut Appointment Profile resource is created by the Client Application and is exchanged with the FHIR Scheduler (EHR). This parameter represents this profile and is the same as used for the $hold operation.

IN cancelled-appt-id 0..1 uri

For this implementation, rescheduling is two step process of cancelling an appointment and rebooking a new appointment. This parameter represents the resource id (e.g., Resource/1234) of the cancelled Appointment and the appt-id parameter represents the new appointment when rescheduling and rebooking a new appointment. References can be to an absolute URL, but servers only perform this operation on their own appointments.

IN patient-id 0..* uri

A resource id for the Patient(s) participant in the resource (e.g., Patient/1234). References can be to an absolute URL, but servers only perform this operation on their own patients. For existing patients the client may need to fetch Patient ID using RESTful GET to the FHIR Server (i.e., US-Core Patient Search). For new patients client needs to fetch Patient ID using RESTful POST to register the patient on the FHIR Server (see create and conditional create)

IN comment 0..1 string

Comments or special instructions

OUT return 0..1 Bundle (Argonaut Appointment Bundle Profile)

An Argonaut Appointment Bundle Profile of type searchset of requested Appointment resource and may also contain an OperationOutcome with errors, warnings or information as a result of processing the operation. If the booking is accepted, the Appointment resource will have an updated status of "booked" and the participantselement updated to include the patients. If the booking is rejected, the Appointment resource will have an updated status of "cancelled".

  • This operation is not idempotent and may only be invoked by performing an HTTP POST.

  • When using the appt-resource as the only input parameter, the payload can be either the Appointment resource or use the Parameters format as shown in the examples below

The operation can be invoked as follows:

  1. POST [base]/Appointment/[id]/$book when using appt-id as an input parameter
  2. POST [base]/Appointment/$book when using appt-resource as an input parameter
Examples
1) Using appt-id as an input parameter

Request

POST [base]/Appointment/proposed-appt2a-1/$book

Request body

    {
      "resourceType": "Parameters",
      "parameter": [
        {
          "name": "appt-id",
          "valueUrl" : "Appointment/proposed-appt2a-1"
        },
        {
          "name": "patient-id",
            "valueUrl" : "Patient/1234"
        }
    ]
    }

Response

HTTP/1.1 200 OK
[other headers]

Response body

        {
          "resourceType": "Bundle",
          "id": "derm-booked",
          "type": "searchset",
          "total": 1,
          "entry": [{
            "fullUrl": "http://server/path/Appointment/booked-derm-appt",
            "resource": {
              "resourceType": "Appointment",
              "id": "booked-derm-appt",
              ...snip...
                "status" : "booked",
                "serviceType" : [
              ...snip...
            ]
            "entry": [{
            "fullUrl": "http://server/path/OperationOutcome/oo-booked-derm-appt",
            "resource": {
              "resourceType": "OperationOutcome",
              "id": "oo-booked-derm-appt",
              .. snip ...
            }
          ]
        }
2) Using appt-resource as an input parameter

Request

POST [base]/Appointment/$book

Appointment resource as request body

{
  "resourceType" : "Appointment",
...snip...
  "status" : "pending",
  "serviceType" : [
...snip...
  "start" : "2017-07-17T01:00:00Z",
  "end" : "2017-07-17T01:15:00Z",
  "participant" : [
    {
      "actor" : {
        "reference" : "Practitioner/dr-y",
        "display" : "Dr Y"
...snip...
}

Parameter format as request body

      {
        "resourceType": "Parameters",
        "parameter": [
          {
            "name": "appt-resource",
            "resource":{
                        "resourceType" : "Appointment",
                        "id" : "proposed-appt2",
                      ...snip...
                        "status" : "pending",
                        "serviceType" : [
                      ...snip...
                        "start" : "2017-07-17T01:00:00Z",
                        "end" : "2017-07-17T01:15:00Z",
                        "participant" : [
                          {
                            "actor" : {
                              "reference" : "Practitioner/dr-y",
                              "display" : "Dr Y"
                      ...snip...
            }

          }
        ]
      }

Response

HTTP/1.1 201 Created
Location: [base]/Appointment/argo-appt-1/_history/1
[other headers]

Response body


    {
      "resourceType": "Bundle",
      "id": "argo-appt-1",
      "type": "searchset",
      "total": 2,
      "entry": [{
        "fullUrl": "http://server/path/Appointment/scheduled-appt2a",
        "resource": {
          "resourceType": "Appointment",
          "id": "held-appt2a",
          ...snip...
            "status" : "booked",
            "serviceType" : [
          ...snip...
        "fullUrl": "http://server/path/OperationOutcome/oo-held-appt1a",
        "resource": {
          "resourceType": "OperationOutcome",
          "id": "oo-held-appt1a-appt1a",
          .. snip ...
        }
      ]
    }