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 50 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
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 |
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?
There was a problem hiding this comment.
Will be removing from Consumer spec as replaced by Task.Input. The Producer will support Task and Questionnaire , I believe all those examples are correct
| 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?
There was a problem hiding this comment.
Good spot updated thanks
| @@ -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?
There was a problem hiding this comment.
Confirming the difference is intentional, as the Producer spec is currently in use by the PEPs for Questionnaire flow, we are unable to alter it at this time to maintain compatibility. However as we're adding to the Consumer spec, we are aligning strongly with FHIR standards.
| - 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?
There was a problem hiding this comment.
Confirming the difference is intentional, as the Producer spec is currently in use by the PEPs for Questionnaire flow, we are unable to alter it at this time to maintain compatibility. However as we're adding to the Consumer spec, we are aligning strongly with FHIR standards.
| @@ -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.
There was a problem hiding this comment.
reasonReference is now being removed from Consumer spec to use Task.Input to purvey URL
|
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'
|
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-5f940c4.zip |
to align more closely with FHIR standard and more clearly indicate the URL needed to perform the task in the portal system
to replace reasonReference with input
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-f78fa18.zip |
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-e15ce17.zip |
| system: "https://fhir.nhs.uk/Id/ods-organization-code" | ||
| value: "RFF" | ||
| display: "Barnsley Hospital NHS Foundation Trust" | ||
| code: |
There was a problem hiding this comment.
reasonCode is listed as required at the Task level, but this example doesn't include it (only code is present). Since reasonCode was kept for questionnaire backward-compatibility, can we make it conditionally required (e.g. only when the task is a questionnaire type) rather than universally required? Otherwise this example fails schema validation.
There was a problem hiding this comment.
Ah yes of course, thank you, I've removed reasonCode from required at task level.
…to be used for qeuestionnaires and tasks
…hub.com:NHSDigital/patient-care-aggregator-api into apm-000-WPP-11130-proposed-task-changes-for-ItB
❌ 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-5e80716.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) - Producer API
Questionnaire (Task) - Producer API
Appointment Booking Invite (Task) - Consumer API
Questionnaire (Task) - Consumer 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.