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 42 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
and correct example taskQuestionnaire
by removing detail wrapper
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-19784cf.zip |
| description: ODS Organisation name (NHS Trust). | ||
| type: string | ||
| example: "THE NEWCASTLE UPON TYNE HOSPITALS NHS FOUNDATION TRUST" | ||
| reasonCode: |
There was a problem hiding this comment.
On reasonCode used for task type can we confirm task classification is intended to live in Task.code rather than reasonCode? In FHIR Task, reasonCode is typically rationale/context rather than the primary task type.
There was a problem hiding this comment.
Yes, good spot, unfortunately we cannot change the producer, but will align the Consumer with this FHIR standard, will resolve once updated.
There was a problem hiding this comment.
Aligned the Consumer spec, now uses Task.code instead of reasonCode
| type: string | ||
| enum: | ||
| - Questionnaire | ||
| - BookingInvitation |
There was a problem hiding this comment.
BookingInvitation is not a base FHIR resource type. Can you confirm whether this is a formally profiled custom resource (with canonical definition/capability declaration)? If yes, please share the canonical contract so consumers can validate references safely.
There was a problem hiding this comment.
Aligned with the correct Task type
| items: | ||
| type: object | ||
| required: | ||
| - system |
There was a problem hiding this comment.
I can see mixed canonical URI styles for coding.system across schema and examples (CodeSystem-style vs StructureDefinition extension-style). Could we standardize to one canonical set so validators and contract tests behave consistently?
| 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.
| 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 |
❌ 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-582522c.zip |
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.