SPEC CHANGE - WPP-11130 - Proposed changes to API specs for Invite to Book - #166
SPEC CHANGE - WPP-11130 - Proposed changes to API specs for Invite to Book#166simeonparris-nhs wants to merge 43 commits into
Conversation
so that it is suitable for a variety of tasks rather than just questionnaire responses
so that a variety of task details, such as booking invites and questionnaire responses can be communicated
for allAppointmentBookingInvitationStates
…hile backwards compatible
|
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. |
…nts and only trigger after an API spec change
| Task: | ||
| description: A generic task resource representing an action for the patient to complete (e.g. questionnaire, appointment booking invite). Aligns with FHIR R4 Task and Producer spec implementation. | ||
| type: object | ||
| required: |
There was a problem hiding this comment.
Can we align this required list with the documented contract? The spec text describes intent, for, and owner as required, but they are not enforced here. Please either add them to required or mark them optional in the prose for consistency.
There was a problem hiding this comment.
Added to required
| enum: | ||
| - Appointment | ||
| reference: | ||
| description: Absolute URL to the linked Appointment. |
There was a problem hiding this comment.
Description says absolute URL, but examples use relative references like Appointment/{id}. Can we clarify allowed formats and keep schema/examples consistent?
There was a problem hiding this comment.
Updated examples.
There was a problem hiding this comment.
example include relative Appointment references. Can we clarify allowed format (absolute only vs both) and make schema/examples consistent?
| type: string | ||
| example: "https://my.portal.com/Questionnaire/c21417eb-ffef-4a9e-b367-ebd8b8c29e7c" | ||
| extension: | ||
| description: FHIR extensions for task resources. Includes Portal link, client ID, optional linked appointment, and treatment function. |
There was a problem hiding this comment.
The description mentions Portal link and linked appointment, but the listed extension shapes appear to model client-id and treatment function only. Could we align this section so the declared extensions match what is documented?
There was a problem hiding this comment.
Aligned descriptions.
| reasonCode: | ||
| coding: | ||
| - system: "https://fhir.nhs.uk/StructureDefinition/Extension-Questionnaire-Type" | ||
| code: "pre-assessment" |
There was a problem hiding this comment.
I noticed a schema/example mismatch here, this example uses pre-assessment for reasonCode.coding.code, but that value does not appear in the declared enum. Could we align schema and examples (either add this enum value or update the example to an allowed one)?
There was a problem hiding this comment.
Aligned with schema.
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-340f635.zip |
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-82d0b05.zip |
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-756e8eb.zip |
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-73cf431.zip |
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-6f93dff.zip |
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-582522c.zip |
❌ Branch Name Validation FailedBranch format is invalid. Expected format: Ensure JIRA ticket key is included. Allowed prefixes: feat, feature, chore, spike, hotfix, bugfix, release, revert |
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-c4d2826.zip |
| description: Resource type being referenced. | ||
| type: string | ||
| enum: | ||
| - Task |
There was a problem hiding this comment.
The schema currently restricts reasonReference.type to Task, but examples reference Questionnaire and BookingInvitation URLs. Could we align schema and examples so referenced resource type and reference targets are consistent?
| type: | ||
| type: string | ||
| description: Questionnaire FHIR Resource | ||
| description: The type of task, used to differentiate behaviour in the Aggregator. Must be either `BookingInvitation` for Invite to Book tasks, or `Questionnaire` for questionnaire completion tasks. |
There was a problem hiding this comment.
There is a mismatch between description and enum here: description mentions BookingInvitation for invites, while enum allows Questionnaire and Task. Could we align these so allowed values are unambiguous?
| @@ -1063,8 +1065,8 @@ components: | |||
| - for | |||
| - authored | |||
There was a problem hiding this comment.
Consumer Task now uses authoredOn, while Producer still uses authored. Is this divergence intentional, or should Producer also move to authoredOn for cross-spec alignment?
| - authored | ||
| - reasonReference | ||
| - owner | ||
| - reasonCode |
There was a problem hiding this comment.
Consumer Task now classifies task type in code. Producer still carries task-type semantics in reasonCode for questionnaire flow. Can we confirm if this difference is intentional or align both specs to the same model?
| @@ -1063,8 +1065,8 @@ components: | |||
| - for | |||
| - authored | |||
| - reasonReference | |||
There was a problem hiding this comment.
Could we confirm reasonReference semantics are aligned between producer and consumer? Current shape/typing appears to differ, which may cause mapping ambiguity for Invite-to-Book vs Questionnaire tasks.
|
Under
Under the section for Extension Framework. 1* System:
2 * URL:
4.reasonCode:
5* Producer API: Use the However, there is also a need to clarify how this CodeSystem 'https://fhir.nhs.uk/CodeSystem/Questionnaire-Type' relates to PIFU option in 'https://fhir.nhs.uk/England/CodeSystem/Task-Type'
|
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 API Task resource and Producer API Task resource have been aligned to support multiple use cases (questionnaires, appointment booking invites, and future task types) while maintaining backwards compatibility with the existing Questionnaire resource. However, there are intentional differences in field naming between the two APIs:
codefield for task type classificationreasonCodefield for task type classificationThis aligns the Consumer API spec more closely with FHIR standards.
Why This Change?
Previous Implementation
kindenum was rigid and required updates for each new task typeNew Implementation
status,intent,reasonCode,reasonReferencereasonCodeand extensions for new task typesKey Changes
Removed Fields
kind→ Replaced bycodein Consumer API,reasonCodein Producer API (FHIR standard, provides more semantic meaning)scheduledPeriod→ Replaced byrestriction.period(FHIR standard)performer→ Replaced byowner(FHIR standard terminology)Added Fields
ididentifierintentauthoredlastModifiedrestriction.periodfocusforownerbasedOncodereasonCodereasonReferenceModified 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 invitesextension: Streamlined to include Client ID and Treatment Function (for PIFU only)Task Type Classification
Consumer API: Using
codeto Distinguish Task TypesThe Consumer API uses the
codefield with an enum of specific task types for semantic clarity:For Questionnaires:
For Appointment Booking Invites:
Producer API: Using
reasonCodeto Distinguish Task TypesThe Producer API uses the
reasonCodefield (system:Extension-Questionnaire-Type) for task type classification:For Questionnaires:
For Appointment Booking Invites:
Backwards Compatibility
Questionnaire Resource Preserved
Questionnaireresource remains unchangedMigration Path
Use Cases
For NHS App and Consumer Applications (Consumer API):
For Portal/Provider Systems (Producer API):
reasonCodeData Models
Appointment Booking Invite (Task)
Questionnaire (Task) - Consumer API
Appointment Booking Invite (Task) - Producer API
Questionnaire (Task) - Producer API
Implementation Notes
For Consumer API Users
For Portal Providers (Producer API)
For the Aggregator Service
reasonCode) to Consumer format (code) before returning in Consumer API responsesreasonCodeto Consumer'scodeto maintain consistent Consumer API contractsStatus Values Mapping
The new Task resource uses FHIR R4 compliant status values:
not-startedrequestedin-progressin-progresscompletedcompletedcancelledcancelledrejectedExtension Framework
The Consumer API supports extensions to provide additional metadata:
Client ID (optional)
https://fhir.nhs.uk/StructureDefinition/Extension-Client-id"myportal-01"Treatment Function (conditional)
https://fhir.nhs.uk/StructureDefinition/Extension-Task-TreatmentFunctionThe Producer API includes similar extensions:
https://fhir.nhs.uk/StructureDefinition/Extension-Task-TreatmentFunctionQuestions & 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:
code.coding.codefield with values like "pifu-triage", "appointment-booking-invite", "pre-appointment-questionnaire", etc. All codes use systemhttps://fhir.nhs.uk/CodeSystem/Task-Type.reasonCode.coding.codefield. The system ishttps://fhir.nhs.uk/StructureDefinition/Extension-Questionnaire-Type.Q: What about linked appointments?
A: Use the
focusfield to reference an Appointment this task relates to:focusmay be empty (appointment doesn't exist yet)focus.referencepoints to the related appointmentfocusis not required since the appointment doesn't exist until the patient completes the bookingQ: Can I store custom data in Task?
A: Yes, use extensions (array) to add custom fields following FHIR extension patterns.