PFS Appointments

This guidance is under active development by NHS Digital and content may be added or updated on a regular basis.
Note: This is a draft version of the GP Connect PFS Appointments capability. The current version can be found using this link.

How to book an appointment

Use case

The typical flow to book an appointment is:

  1. Search by NHS Number for, or otherwise obtain, a Patient resource.
  2. Search for available Slot resources by date range.
  3. Create an Appointment for the chosen Slot and Patient resources.

Refer to Consumer sessions illustrated for how this API use case could be used in the context of a typical consumer appointment management session.

Security

  • GP Connect utilises TLS Mutual Authentication for system level authorization
  • GP Connect utilises a JSON Web Tokens (JWT) to transmit clinical audit and provenance detail

Prerequisites

Consumer

The consumer system:

  • SHALL have previously resolved the organisation's FHIR® endpoint base URL through the Spine Directory Service
  • SHALL have previously traced the patient's NHS Number using the Personal Demographics Service or an equivalent service.
  • SHALL have previously obtained the details for one or more free slots that are to be booked, using Search for free slots
  • SHALL have previously performed a Find a patient request to obtain the logical identifier for the patient on the organisation's FHIR server.

Consumer display requirements

Consumer systems SHALL support the following fields in order to provide the full context of the appointment in the current IM1 standard:

  • Confirmation of appointment booking outcome (success, failure, etc).

API usage

The consumer system SHALL only use the book appointment capability to book future appointments, where the appointment start dateTime is after the current date and time. If the appointment start date is in the past the provider SHALL return an error.

Adherence is expected to local business rules, agreements and policies defining good practice in GP Connect-enabled cross-organisational appointment booking. This will discourage for example the over-booking and subsequent cancellation of Slots.

Booking multiple adjacent slots

To book more than one slot in the same Book Appointment message, a consumer needs to be able to identify which adjacent slots may be booked together. This is determined by the following rules:

  • Two slots (Slot A and Slot B) are adjacent when the start time of Slot B equals the end time of Slot A
  • The adjacent slots SHALL reference the same Schedule resource
  • The adjacent slots SHALL both have the same deliveryChannel value
  • The adjacent slots SHALL both have the same serviceType value
  • If the slots do not conform to one or more of the rules above, they SHALL NOT be accepted as part of the same appointment booking

Request operation

FHIR relative request

POST /Appointment

FHIR absolute request

POST https://[proxy_server]/https://[provider_server]/[fhir_base]/Appointment

Payload request body

The request payload is a profiled version of the standard FHIR Appointment resource. See the FHIR resources page for more detail.

Consumer systems:

  • SHALL send an Appointment resource that conforms to the GPConnect-Appointment-1 profile.
  • SHALL include the URI of the GPConnect-Appointment-1 profile StructureDefinition in the Appointment.meta.profile element of the appointment resource.

The following data elements are mandatory (that is, data MUST be present):

  • a patient participant of the appointment with Patient.telecom.system, Patient.telecom.value, Patient.telecom.use field populated if the appointment is a telephone appointment.
  • a location participant of the appointment, representing the physical location where the appointment is to take place (see Design decisions page).
  • an actor reference in any supplied participant.
  • the start and end of the appointment.
    • where multiple slots are being booked, the start SHALL be the start time of the earlier slot, and the end shall be the end time of the latest slot
  • the status identifying the appointment as "booked".
  • the slot details of one or more free slots to be booked.
  • the bookingOrganisation extension referencing an contained Organization resource within the appointment resource.
    • the contained organization resource SHALL represent the organization booking the appointment.
    • the contained organization resource SHALL conform to CareConnect-GPC-Organization-1 profile.
    • the contained organization resource SHALL contain an identifier with the organisation's ODS code.
    • the contained organization resource SHALL contain at least name and telecom details.
    • the contained organization resource SHALL include the type element with a value matching the organization type sent as a searchFilter with the Search for free slots request. If organization type was not passed to the searchFilter then type SHALL not be populated.
  • the created element SHALL be populated with the date and time the appointment was created.
  • description containing a brief description of the appointment.
    • Consumers SHALL impose a character limit of 100 characters for this element.
    • This element SHALL only contain limited information to support the appointment and SHALL NOT be used for "transfer of care" clinical information.

The following data elements SHOULD be included when available:

  • a practitioner participant of the appointment.

The following data elements MAY be included:

  • comment containing 'patient specific notes' and any additional comments relating to the appointment.
    • Consumers SHALL impose a character limit of 500 characters for this element.
    • This element SHALL only contain limited information to support the appointment and SHALL NOT be used for "transfer of care" clinical information.

The following data elements MUST NOT be included:

  • specialty
  • reason

Provider handling of description and comment

When receiving description and comment fields in the provider system:

  • Providers systems SHALL store information received in description and comment fields, supporting the character limit lengths shown above
  • Providers systems SHALL NOT truncate information received in description or comment fields
  • Providers SHALL return description and comment fields to the consumer in the response payload, as stored
  • Where a consumer sends information longer than character limits supported, an error SHALL be returned to the consumer
  • Where there are not two suitable appointment text fields in a provider system, providers MAY concatenate description and comment (with suitable delimiters) in order to store in a single field, such that data is not lost

Request response

Response headers

Provider systems are not expected to add any specific headers beyond that described in the HTTP and FHIR® standards.

Payload response body

Provider systems:

  • SHALL return a 201 Created HTTP status code on successful execution of the operation.

  • SHALL return a Location header as described in FHIR API guidance.

  • SHALL return an Appointment resource that conform to the GPConnect-Appointment-1 profile.

  • SHALL include the URI of the GPConnect-Appointment-1 profile StructureDefinition in the Appointment.meta.profile element of the returned appointment resource.

  • SHALL include the versionId of the current version of each appointment resource.

  • SHALL populate Appointment.serviceType.text with the practice defined slot type description, and where available Appointment.serviceCategory.text with a practice defined schedule type description (may be called session name or rota type).

  • MAY populate Appointment.reason.text with the free text reason for the appointment, if available.

  • SHALL meet General FHIR resource population requirements populating all fields where data is available, excluding those listed below

  • SHALL NOT populate the following fields:

    • specialty

Error handling

Provider systems:

  • SHALL return an HTTP status "409" with an error message "DUPLICATE_REJECTED" when an appointment cannot be booked because the referenced slots within the appointment resource no longer have the status free, such as when the slot has been used to book a different appointment between the "search for free slots" request and the "book appointment" request.
  • SHALL return an error if specialty is included in the appointment resource sent by the consumer.
  • SHALL return a GPConnect-OperationOutcome-1 resource that provides additional detail when one or more request fields are corrupt or a specific business rule/constraint is breached.

For example:

  • the submitted start and end date range does not match that of the requested slot(s)
  • one or more of the requested Slot resources does not exist or already has a status of busy
  • a business rule imposed by Slot Availability Management is breached, e.g. an organisational slot limit
  • multiple slots were requested for booking but do not meet the criteria for booking multiple adjacent slots
  • the description or comment fields contain more characters than can be stored in the provider system

Refer to Development - FHIR API guidance - error handling for details of error codes.

Examples

Book an appointment

Request

The consumer system constructs an Appointment resource from slot (and its associated schedule) chosen by the user and posts the resource to the /Appointment endpoint in order to book the appointment. The consumer organisation making the booking is populated as a contained resource.

POST /Appointment
{
  "resourceType": "Appointment",
  "meta": {
    "profile": [
      "https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-Appointment-1"
    ]
  },
  "contained": [
    {
      "resourceType": "Organization",
      "id": "1",
      "meta": {
        "profile": [
          "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Organization-1"
        ]
      },
      "identifier": [
        {
          "system": "https://fhir.nhs.uk/Id/ods-organization-code",
          "value": "Z100"
        }
      ],
      "type": [
        {
          "coding": [
            {
              "system": "https://fhir.nhs.uk/STU3/CodeSystem/GPConnect-OrganisationType-1",
              "code": "urgent-care"
            }
          ]
        }
      ],
      "name": "North Ambulance Service",
      "telecom": [
        {
          "system": "phone",
          "value": "01111222333"
        }
      ]
    }
  ],
  "extension": [
    {
      "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-GPConnect-BookingOrganisation-1",
      "valueReference": {
        "reference": "#1"
      }
    }
  ],
  "status": "booked",
   "reason": [
          {
            "text": "tennis elbow"
          }
        ],
  "description": "Free text description.",
  "start": "2017-05-30T10:00:00+01:00",
  "end": "2017-05-30T10:25:00+01:00",
  "slot": [
    {
      "reference": "Slot/1"
    }
  ],
  "created": "2017-05-25T13:48:41+01:00",
  "comment": "Free text comment.",
  "participant": [
    {
      "actor": {
        "reference": "Patient/1"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "reference": "Location/32"
      },
      "status": "accepted"
    }
  ]
}

Response

The provider system responds back with the Appointment resource with the id field populated to indicate the appointment was booked.

{
  "resourceType": "Appointment",
  "id": "9",
  "meta": {
    "versionId": "636068818095315079",
    "profile": [
      "https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-Appointment-1"
    ]
  },
  "contained": [
    {
      "resourceType": "Organization",
      "id": "1",
      "meta": {
        "profile": [
          "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Organization-1"
        ]
      },
      "identifier": [
        {
          "system": "https://fhir.nhs.uk/Id/ods-organization-code",
          "value": "Z100"
        }
      ],
      "type": [
        {
          "coding": [
            {
              "system": "https://fhir.nhs.uk/STU3/CodeSystem/GPConnect-OrganisationType-1",
              "code": "urgent-care"
            }
          ]
        }
      ],
      "name": "North Ambulance Service",
      "telecom": [
        {
          "system": "phone",
          "value": "01111222333"
        }
      ]
    }
  ],
  "extension": [
    {
      "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-GPConnect-BookingOrganisation-1",
      "valueReference": {
        "reference": "#1"
      }
    },
    {
      "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-GPConnect-PractitionerRole-1",
      "valueCodeableConcept": {
        "coding": [
          {
            "system": "https://fhir.nhs.uk/STU3/CodeSystem/CareConnect-SDSJobRoleName-1",
            "code": "R0260",
            "display": "General Medical Practitioner"
          }
        ]
      }
    },
    {
      "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-GPConnect-DeliveryChannel-2",
      "valueCode": "In-person"
    }
  ],
  "status": "booked",
  "reason": [
    {
      "text": "tennis elbow"
     }
           ],
  "serviceCategory": {
    "text": "General GP Appointments"
  },
  "serviceType": [
    {
      "text": "General GP Appointment"
    }
  ],
  "description": "Free text description.",
  "start": "2017-05-30T10:00:00+01:00",
  "end": "2017-05-30T10:25:00+01:00",
  "minutesDuration": 25,
  "slot": [
    {
      "reference": "Slot/1"
    }
  ],
  "created": "2017-05-25T13:48:41+01:00",
  "comment": "Free text comment.",
  "participant": [
    {
      "actor": {
        "reference": "Patient/1"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "reference": "Location/32"
      },
      "status": "accepted"
    }
  ]
}


back to top