SPEC CHANGE - WPP-11130 - Proposed changes to API specs for Invite to Book - #166
simeonparris-nhs wants to merge 56 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
| 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
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-5e80716.zip |
to reference tasks rather than just questionnaires
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-270119f.zip |
for the task type and task input type
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-536d058.zip |
API Spec HTML DocsBuilt from commit Download HTML API Specs: api-specs-html-docs-d81a485.zip |
to consumer and producer API specs
to consumer API spec
❌ 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-39a9d54.zip |
Invite to Book - Task Resource Alignment Summary
Overview
To support the Invite to Book changes, the decision has been made to uplift the existing Task resource in the producer API specification to support both Invitations to Book and Questionnaires, along with being extensible for further use cases. In the Consumer API specification, the current
Questionnaire, and theTaskintroduced in this PR, are not technically resources but are "activities" that are part of theCarePlanresource.The Consumer API's CarePlan Task activity and Producer API's 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 activity in the consumer API's CarePlan. However, there are intentional differences in field naming between the two APIs:
codefield for task type classification andinputfield for referencing upstream resourcesreasonCodefield for task type classification andreasonReferencefield for referencing upstream resourcesThis 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,code,inputcodeand 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
ididentifierintentauthoredOnlastModifiedrestriction.periodfocusforownerbasedOncodeinputreasonCodereasonReferenceModified Fields
status: Changed from["not-started", "in-progress", "completed", "cancelled"]to FHIR-compliant["requested", "rejected", "cancelled", "in-progress", "on-hold", "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, and this will continue to be supported for the purposes of backwards compatibility:For Questionnaires:
However, the Task resource has also been uplifted to include the
codefield, with the intention of it initially being used for appointment booking tasks, but as its Code System includes all of the same questionnaire codes used inreasonCode, it can be used in the place ofreasonCode, eventually becoming the way the task type is communicated, allowingreasonCodeto be later deprecated.For Appointment Booking Invites:
For Questionnaires:
Accessing Upstream Resources
Consumer API: Using
inputFieldThe Consumer API uses the
inputarray to provide the URL and metadata for accessing the task in the upstream portal system:Producer API: Using
reasonReferenceFieldThe Producer API uses the
reasonReferencefield to reference the upstream resource (Questionnaire or BookingInvitation):Backwards Compatibility
CarePlan Questionnaire Activity Preserved
Questionnaireactivity remains unchangedMigration Path
Use Cases
For NHS App and Consumer Applications (Consumer API):
codefieldinput.valueUrlFor Portal/Provider Systems (Producer API):
reasonCodereasonReferenceData 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
input.valueUrlto get the portal URL where the task is performedFor Portal Providers (Producer API)
For the Aggregator Service
reasonCode→ Consumer'scodereasonReference.reference→ Consumer'sinput.valueUrlStatus Values Mapping
The new Task activity uses FHIR R4 compliant status values:
not-startedrequestedin-progressin-progresscompletedcompletedcancelledcancelledrejectedon-holdExtension 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 activity be deprecated?
A: No immediate deprecation. The Questionnaire activity 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 activity 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/England/CodeSystem/wayfinder-task-type.reasonCode.coding.codefield. The system ishttps://fhir.nhs.uk/StructureDefinition/Extension-Questionnaire-Type.Q: How do I access the upstream portal resource?
A:
input.valueUrlfield to get the portal URL. The input array contains type information (with code "portal-url") and the valueUrl with the direct link to the task in the upstream system.reasonReference.referencefield to get the reference to the upstream resource.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.