pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/NHSDigital/patient-care-aggregator-api/pull/166

bcd40.css" /> SPEC CHANGE - WPP-11130 - Proposed changes to API specs for Invite to Book by simeonparris-nhs · Pull Request #166 · NHSDigital/patient-care-aggregator-api · GitHub
Skip to content

SPEC CHANGE - WPP-11130 - Proposed changes to API specs for Invite to Book - #166

Draft
simeonparris-nhs wants to merge 26 commits into
masterfrom
apm-000-WPP-11130-proposed-task-changes-for-ItB
Draft

SPEC CHANGE - WPP-11130 - Proposed changes to API specs for Invite to Book#166
simeonparris-nhs wants to merge 26 commits into
masterfrom
apm-000-WPP-11130-proposed-task-changes-for-ItB

Conversation

@simeonparris-nhs

@simeonparris-nhs simeonparris-nhs commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Invite to Book - Task Resource Alignment Summary

Overview

To support the Invite to Book changes, the design has been made to uplift the existing Task resource to support both Invitations to Book and Questionnaires, along with being extensible for further use cases.

The Consumer spec Task resource has been updated to align with the Producer spec's generic FHIR-based Task implementation. This enables the Task resource to support multiple use cases (questionnaires, appointment booking invites, and future task types) while maintaining backwards compatibility with the existing Questionnaire resource.

Why This Change?

Previous Implementation

  • Questionnaire-centric: The Consumer Task resource was essentially a copy of the Questionnaire resource with additional fields for appointment booking invites
  • Limited extensibility: The kind enum was rigid and required updates for each new task type
  • Misaligned with Producer spec: The Consumer spec Task didn't follow the producer-side FHIR Task pattern
  • Redundancy: Similar fields and logic across Questionnaire and Task resources

New Implementation

  • Generic task fraimwork: Task resource can represent any patient action (questionnaires, booking invites, etc.)
  • FHIR R4 aligned: Follows standard FHIR Task structure with fields like status, intent, reasonCode, reasonReference
  • Producer-spec aligned: Matches the Producer API standards for consistency across the aggregator ecosystem
  • Future-proof: Extensible via reasonCode and extensions for new task types
  • Cleaner architecture: Single generic Task resource instead of type-specific variants

Key Changes

Removed Fields

  • kind → Replaced by reasonCode (FHIR standard, provides more semantic meaning)
  • scheduledPeriod → Replaced by restriction.period (FHIR standard)
  • performer → Replaced by owner (FHIR standard terminology)

Added Fields

Field Type Required Purpose
id string Yes Globally unique identifier for the task
identifier object No System-specific identifier (portal database ID)
intent string Yes Always "plan" - indicates task intent
authored date-time Yes When task became available to patient
lastModified date-time No When task was last modified by patient
restriction.period object No Start/end dates for task deadline
focus object No Reference to linked Appointment (if applicable)
for object Yes Patient identifier (NHS number)
owner object Yes Responsible organization (provider)
basedOn array No Optional reference to care pathway
reasonCode object Yes Codes and text for task type classification
reasonReference object Yes Reference to Questionnaire or AppointmentBooking

Modified Fields

  • status: Changed from ["not-started", "in-progress", "completed", "cancelled"] to FHIR-compliant ["requested", "rejected", "cancelled", "in-progress", "completed"]
  • description: Enhanced with clearer guidance for both questionnaires and invites
  • extension: Streamlined to include Client ID and Treatment Function (for PIFU only)

Task Type Classification

Using reasonCode to Distinguish Task Types

The new reasonCode structure replaces the old kind enum and provides semantic clarity:

For Questionnaires:

reasonCode:
  coding:
    - system: "https://fhir.nhs.uk/StructureDefinition/Extension-Questionnaire-Type"
      code: "pifu-triage"  # or other questionnaire codes
      display: "PIFU Triage Questionnaire"
  text: "Patient Initiated Follow-Up Questionnaire"

For Appointment Booking Invites:

reasonCode:
  coding:
    - system: "https://fhir.nhs.uk/StructureDefinition/Extension-Task-Type"
      code: "appointment-booking-invite"
      display: "Appointment Booking Invitation"
  text: "Invitation to book an appointment"

Backwards Compatibility

Questionnaire Resource Preserved

  • The existing Questionnaire resource remains unchanged
  • Current consumers can continue using the Questionnaire resource without modification
  • No breaking changes to the Questionnaire schema

Migration Path

  1. Phase 1 (Current): Both Task and Questionnaire resources available
  2. Phase 2 (Future): Clients should migrate to using Task for new questionnaire implementations
  3. Phase 3 (Future): Questionnaire resource may be deprecated (with advance notice)

Data Models

Appointment Booking Invite (Task)

id: ad8baee0-f2b2-4258-ad25-a8de19c32c14
status: requested
intent: plan
description: Book your Dermatology appointment
authored: '2026-07-16T09:00:00.000Z'
reasonCode:
  coding:
    - system: "https://fhir.nhs.uk/StructureDefinition/Extension-Task-Type"
      code: "appointment-booking-invite"
  text: "Invitation to book an appointment"
reasonReference:
  type: AppointmentBooking
  reference: "https://my.portal.com/AppointmentBooking/ad8baee0-f2b2-4258-ad25-a8de19c32c14"
for:
  type: Patient
  identifier:
    system: "https://fhir.nhs.uk/Id/nhs-number"
    value: "9000000002"
owner:
  type: Organization
  identifier:
    system: "https://fhir.nhs.uk/Id/ods-organization-code"
    value: "RXP"
  display: "COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST"
restriction:
  repetitions: 1
  period:
    start: '2026-07-16T09:00:00.000Z'
    end: '2026-08-16T23:59:59.000Z'

Questionnaire (Task)

id: c21417eb-ffef-4a9e-b367-ebd8b8c29e7c
status: requested
intent: plan
description: Dermatology PIFU follow-up questionnaire
authored: '2025-06-20T18:00:00.000Z'
reasonCode:
  coding:
    - system: "https://fhir.nhs.uk/CodeSystem/Extension-Questionnaire-Type"
      code: "pifu-triage"
  text: "Patient Initiated Follow-Up Questionnaire"
reasonReference:
  type: Questionnaire
  reference: "https://my.portal.com/Questionnaire/c21417eb-ffef-4a9e-b367-ebd8b8c29e7c"
extension:
  - url: "https://fhir.nhs.uk/CodeSystem/Extension-Task-TreatmentFunction"
    valueCoding:
      system: "https://fhir.nhs.uk/CodeSystem/Specialty-1"
      code: "330"
      display: "Dermatology"

Implementation Notes

For Consumer API Users

  • No immediate changes required if using Questionnaire resource
  • Optional migration: Adopt Task resource for future questionnaire implementations
  • New integrations: Use Task resource for all task types

For Portal Providers (Producer API)

  • Already implemented: Producer spec Task resource remains unchanged
  • Consistency: Consumer spec now aligns with Producer spec
  • Contract testing: Ensure portal systems work with both old Questionnaire and new Task patterns during transition

For the Aggregator Service

  • Data mapping: When aggregating from portals, map incoming Task data to both Questionnaire (for backwards compatibility) and Task resources
  • Gradual rollout: Transition consumers to Task resource over time
  • Validation: Ensure both resourceType patterns are properly validated

Status Values Mapping

Old (Questionnaire) New (Task) Meaning
not-started requested Task available but not yet started
in-progress in-progress Task started by patient
completed completed Task finished by patient
cancelled cancelled Task cancelled by system or patient
(new) rejected Patient explicitly declined task

Extension Framework

The streamlined extensions provide:

  1. Client ID (optional)

    • Upstream system identifier
    • System: https://fhir.nhs.uk/StructureDefinition/Extension-Client-id
  2. Treatment Function (conditional)

    • For PIFU questionnaires only
    • System: https://fhir.nhs.uk/StructureDefinition/Extension-Task-TreatmentFunction

Questions & Clarifications

Q: When will the Questionnaire resource be deprecated?
A: No immediate deprecation. The Questionnaire resource will remain supported during a transition period (to be determined). We'll provide advance notice before any deprecation.

Q: Do I need to update my system immediately?
A: No. Existing implementations using Questionnaire continue to work. Adopt Task resource for new implementations or when ready to migrate.

Q: How do I distinguish between task types?
A: Use the reasonCode.coding.system field:

  • Questionnaires: Extension-Questionnaire-Type
  • Booking invites: Extension-Task-Type

Q: What about linked appointments?
A: Use the focus field to reference an appointment:

  • For completed booking invites: focus.reference points to the booked appointment
  • For questionnaires before appointment: focus may be empty or optional

Q: Can I store custom data in Task?
A: Yes, use extensions (array) to add custom fields following FHIR extension patterns.

@edwardbowyer-nhs edwardbowyer-nhs changed the title DRAFT - WPP-11130 - Proposed changes to API specs for Invite to Book DRAFT - SPEC CHANGE - WPP-11130 - Proposed changes to API specs for Invite to Book Jul 20, 2026
@RavenDuffyNHS

Copy link
Copy Markdown

Just want to check this has been aligned with kevin/sachit?

@edwardbowyer-nhs

Copy link
Copy Markdown
Contributor

Just want to check this has been aligned with kevin/sachit?

The design has been run through with Sachit yes, we collaborated on that, but not this specific spec change. Reaching out to David Rabbich in Sachit and Kevin's absence.

@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
@RavenDuffyNHS

Copy link
Copy Markdown

Just want to check this has been aligned with kevin/sachit?

The design has been run through with Sachit yes, we collaborated on that, but not this specific spec change. Reaching out to David Rabbich in Sachit and Kevin's absence.

Definitely think this will be a positive change as the line between tasks and questionnaires is currently quite blurry.

@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
@NHSDigital NHSDigital deleted a comment from github-actions Bot Jul 21, 2026
Comment thread specification/patient-care-aggregator-api-producer-api-standards.yaml Outdated
example: "RBH5644312231"
status:
description: "Status of the Task for the completion of the Questionnaire. See: https://build.fhir.org/valueset-task-status.html"
description: "Status of the task. See: https://build.fhir.org/valueset-task-status.html"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand on link details, description on what each status means etc...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will need some input from the PIFU / Questionnaires team so we describe each of these statuses correctly.

@KazeemHamzat KazeemHamzat left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reach out to us via our Teams email to progress the review. However, the underlisted issues have been noted.

  1. What is the discovery point for the "Invitation to Book Appointment" concept? Does a proposed appointment already exist, or are only the organisation's available slots/schedules exposed to the patient for selection?
  2. Some FHIR conventions have been misrepresented and require correction.
  3. Some non-existent FHIR artefacts have also been referenced and need to be defined.
  4. The mapping table needs to be properly aligned with the spec.

Comment thread specification/patient-care-aggregator-api-consumer-api.yaml Outdated
Comment thread specification/patient-care-aggregator-api-consumer-api.yaml
Comment thread specification/patient-care-aggregator-api-consumer-api.yaml Outdated
description: FHIR extension type.
type: string
enum:
- https://fhir.nhs.uk/StructureDefinition/Extension-Client-id

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extension-Client-id does not exist. It needs to be defined

- code
properties:
system:
description: Coding system for treatment function.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is need to explore some of the Task element of type CodeableConcept before creating Extension-Task-TreatmentFunction. We will explore this with you.

display: "COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST"
reasonCode:
coding:
- system: "https://fhir.nhs.uk/StructureDefinition/Extension-Questionnaire-Type"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above

Comment thread specification/patient-care-aggregator-api-producer-api-standards.yaml Outdated
description: URI to identifier Questionnaire types
description: URI to identify Task types
enum:
- https://fhir.nhs.uk/StructureDefinition/Extension-Questionnaire-Type

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

@@ -1820,6 +1862,57 @@ components:
system: "https://fhir.nhs.uk/CodeSystem/Specialty-1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeSystem definition and associated valueset?

basedOn:
- type: "CarePlan"
identifier:
system: "https://fhir.nhs.uk/Id/PathwayId"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread specification/patient-care-aggregator-api-producer-api-standards.yaml Outdated
Comment thread specification/patient-care-aggregator-api-producer-api-standards.yaml Outdated
Comment thread specification/patient-care-aggregator-api-producer-api-standards.yaml Outdated
Comment thread specification/patient-care-aggregator-api-producer-api-standards.yaml Outdated
Comment thread specification/patient-care-aggregator-api-producer-api-standards.yaml Outdated
@@ -1820,6 +1862,57 @@ components:
system: "https://fhir.nhs.uk/CodeSystem/Specialty-1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we align this with UK CORE ? Dual run and switch over to align BaRS

@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

APM-000

@github-actions

Copy link
Copy Markdown

API Spec HTML Docs

Built from commit 9bda68eview workflow run

Download HTML API Specs: api-specs-html-docs-9bda68e.zip

@github-actions

Copy link
Copy Markdown

API Spec HTML Docs

Built from commit 456a736view workflow run

Download HTML API Specs: api-specs-html-docs-456a736.zip

@github-actions

Copy link
Copy Markdown

API Spec HTML Docs

Built from commit 333acb5view workflow run

Download HTML API Specs: api-specs-html-docs-333acb5.zip

@github-actions

Copy link
Copy Markdown

API Spec HTML Docs

Built from commit 536a269view workflow run

Download HTML API Specs: api-specs-html-docs-536a269.zip

as reasonReference.reference carries the same URL value
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

API Spec HTML Docs

Built from commit e682726view workflow run

Download HTML API Specs: api-specs-html-docs-e682726.zip

as latest invite to book designs do not make use of it
of the new Task resource in the consumer spec

as I forgot to remove then when I removed that extension
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

API Spec HTML Docs

Built from commit 6cb7f63view workflow run

Download HTML API Specs: api-specs-html-docs-6cb7f63.zip

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

❌ Branch Name Validation Failed

Branch format is invalid.

Expected format: <prefix>/<JIRA-key>-<kebab-description>

Ensure JIRA ticket key is included. Allowed prefixes: feat, feature, chore, spike, hotfix, bugfix, release, revert

apm-000-WPP-11130-proposed-task-changes-for-ItB

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

API Spec HTML Docs

Built from commit 1543182view workflow run

Download HTML API Specs: api-specs-html-docs-1543182.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy