diff --git a/sandbox/src/mocks/stu3/retrieveWorklist/requests/AppointmentsForBookingWithReason.json b/sandbox/src/mocks/stu3/retrieveWorklist/requests/AppointmentsForBookingWithReason.json new file mode 100644 index 000000000..b3035f6c2 --- /dev/null +++ b/sandbox/src/mocks/stu3/retrieveWorklist/requests/AppointmentsForBookingWithReason.json @@ -0,0 +1,28 @@ +{ + "resourceType": "Parameters", + "meta": { + "profile": [ + "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-FetchWorklist-Parameters-1" + ] + }, + "parameter": [ + { + "name": "listType", + "valueCodeableConcept": { + "coding": [ + { + "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralListSelector-1", + "code": "APPOINTMENTS_FOR_BOOKING" + } + ] + } + }, + { + "name": "bookingReason", + "valueCoding": { + "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-BookingReason-1", + "code": "TRIAGE_TO_BE_BOOKED" + } + } + ] +} diff --git a/sandbox/src/mocks/stu3/retrieveWorklist/responses/AppointmentsForBooking.json b/sandbox/src/mocks/stu3/retrieveWorklist/responses/AppointmentsForBooking.json new file mode 100644 index 000000000..4a6e65895 --- /dev/null +++ b/sandbox/src/mocks/stu3/retrieveWorklist/responses/AppointmentsForBooking.json @@ -0,0 +1,174 @@ +{ + "meta": { + "profile": [ + "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-FetchWorklist-List-1" + ] + }, + "resourceType": "List", + "status": "current", + "mode": "snapshot", + "entry": [ + { + "extension": [ + { + "extension": [ + { + "url": "patient", + "valueReference": { + "identifier": { + "system": "http://fhir.nhs.net/Id/nhs-number", + "value": "9462979626" + } + } + }, + { + "url": "appointmentStart", + "valueDateTime": "2021-09-05T19:24:02.198Z" + }, + { + "url": "eReferralPathwayStart", + "valueDateTime": "2021-09-03T14:24:06.483Z" + }, + { + "url": "referrer", + "valueReference": { + "identifier": { + "system": "http://fhir.nhs.net/Id/sds-user-id", + "value": "021600556514" + } + } + }, + { + "url": "priority", + "valueCodeableConcept": { + "coding": [ + { + "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1", + "code": "ROUTINE" + } + ] + } + }, + { + "url": "reason", + "valueCodeableConcept": { + "coding": [ + { + "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-BookingReason-1", + "code": "TRIAGE_TO_BE_BOOKED" + } + ] + } + }, + { + "url": "service", + "valueReference": { + "identifier": { + "system": "http://fhir.nhs.net/Id/ers-service", + "value": "11012" + }, + "display": "Excellent Cardiology Business Service 12" + } + }, + { + "url": "specialty", + "valueCodeableConcept": { + "coding": [ + { + "system": "_baseUrl_/STU3/CodeSystem/SPECIALTY", + "code": "CARDIOLOGY" + } + ] + } + } + ], + "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AppointmentsForBooking-WorkListItem-1" + } + ], + "item": { + "reference": "ReferralRequest/000000070001" + } + }, + { + "extension": [ + { + "extension": [ + { + "url": "patient", + "valueReference": { + "identifier": { + "system": "http://fhir.nhs.net/Id/nhs-number", + "value": "9462979626" + } + } + }, + { + "url": "appointmentStart", + "valueDateTime": "2021-09-05T19:24:02.198Z" + }, + { + "url": "eReferralPathwayStart", + "valueDateTime": "2021-09-03T14:24:06.483Z" + }, + { + "url": "referrer", + "valueReference": { + "identifier": { + "system": "http://fhir.nhs.net/Id/sds-user-id", + "value": "021600556514" + } + } + }, + { + "url": "priority", + "valueCodeableConcept": { + "coding": [ + { + "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1", + "code": "ROUTINE" + } + ] + } + }, + { + "url": "reason", + "valueCodeableConcept": { + "coding": [ + { + "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-BookingReason-1", + "code": "TRIAGE_TO_BE_BOOKED" + } + ] + } + }, + { + "url": "service", + "valueReference": { + "identifier": { + "system": "http://fhir.nhs.net/Id/ers-service", + "value": "11012" + }, + "display": "Excellent Cardiology Business Service 12" + } + }, + { + "url": "specialty", + "valueCodeableConcept": { + "coding": [ + { + "system": "_baseUrl_/STU3/CodeSystem/SPECIALTY", + "code": "CARDIOLOGY" + } + ] + } + } + ], + "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AppointmentsForBooking-WorkListItem-1" + } + ], + "item": { + "reference": "ReferralRequest/000000070001" + } + } + ] + } diff --git a/sandbox/src/routes/stu3/services/mockResponseProvider.js b/sandbox/src/routes/stu3/services/mockResponseProvider.js index e07279f98..f3e8ce2e8 100644 --- a/sandbox/src/routes/stu3/services/mockResponseProvider.js +++ b/sandbox/src/routes/stu3/services/mockResponseProvider.js @@ -169,11 +169,11 @@ module.exports = { const attachmentId = request.params.attachmentLogicalID if (attachmentId) { - + if (attachmentId.startsWith('att-')) { return { responsePath: 'stu3/retrieveAttachment/responses/example_attachment.pdf', filename: 'example_attachment.pdf', responseCode: 200 } } - + if (attachmentId === 'c5d2d200-7613-4a69-9c5f-1bb68e04b8d8') { return { responsePath: 'stu3/retrieveAttachment/responses/example_attachment.pdf', filename: 'example_attachment.pdf', responseCode: 200 } } @@ -276,7 +276,7 @@ module.exports = { getExampleResponseForRetrieveAdviceAndGuidanceOverviewPdf: function () { return { responsePath: 'stu3/retrieveAdviceAndGuidanceOverviewPdf/responses/000049146177_Advice_And_Guidance_20220610143044.pdf', filename: '000049146177_Advice_And_Guidance_20220610143044.pdf', responseCode: 200 } - }, + }, getExampleResponseForRetrieveWorklist: function (request) { var responseMap = { @@ -287,7 +287,8 @@ module.exports = { 'src/mocks/stu3/retrieveWorklist/requests/MinimalRejectedTriageResponse.json': 'stu3/retrieveWorklist/responses/RejectedTriageResponse.json', 'src/mocks/stu3/retrieveWorklist/requests/MinimalAssessmentReturnedCancelledDna.json': 'stu3/retrieveWorklist/responses/AssessmentReturnedCancelledDna.json', 'src/mocks/stu3/retrieveWorklist/requests/MinimalAwaitingBooking.json': 'stu3/retrieveWorklist/responses/AwaitingBooking.json', - 'src/mocks/stu3/retrieveWorklist/requests/MinimalLettersOutstanding.json': 'stu3/retrieveWorklist/responses/LettersOutstanding.json' + 'src/mocks/stu3/retrieveWorklist/requests/MinimalLettersOutstanding.json': 'stu3/retrieveWorklist/responses/LettersOutstanding.json', + 'src/mocks/stu3/retrieveWorklist/requests/AppointmentsForBookingWithReason.json': 'stu3/retrieveWorklist/responses/AppointmentsForBooking.json' } return mapExampleResponse(request, responseMap) diff --git a/specification/components/stu3/schemas/eRS-FetchWorklist-List.yaml b/specification/components/stu3/schemas/eRS-FetchWorklist-List.yaml index 5e63151a4..30ee28543 100644 --- a/specification/components/stu3/schemas/eRS-FetchWorklist-List.yaml +++ b/specification/components/stu3/schemas/eRS-FetchWorklist-List.yaml @@ -144,6 +144,7 @@ properties: | `Extension-eRS-AssessmentReturnedCancelledDna-WorklistItem` | `0..1` | Type of worklist items depends on the worklist type requested | | `Extension-eRS-AwaitingBooking-WorklistItem` | `0..1` | Type of worklist items depends on the worklist type requested | | `Extension-eRS-LettersOutstanding-WorklistItem` | `0..1` | Type of worklist items depends on the worklist type requested | + | `Extension-eRS-AppointmentsForBooking-WorklistItem` | `0..1` | Type of worklist items depends on the worklist type requested | items: anyOf: - $ref: 'extensions/Extension-eRS-ReferralsforReview-WorkListItem.yaml' @@ -153,4 +154,5 @@ properties: - $ref: 'extensions/Extension-eRS-AssessmentReturnedCancelledDna-WorklistItem.yaml' - $ref: 'extensions/Extension-eRS-AwaitingBooking-WorklistItem.yaml' - $ref: 'extensions/Extension-eRS-LettersOutstanding-WorklistItem.yaml' + - $ref: 'extensions/Extension-eRS-AppointmentsForBooking-WorklistItem.yaml' diff --git a/specification/components/stu3/schemas/eRS-FetchWorklist-Parameters.yaml b/specification/components/stu3/schemas/eRS-FetchWorklist-Parameters.yaml index 66c10be71..8b75ddae6 100644 --- a/specification/components/stu3/schemas/eRS-FetchWorklist-Parameters.yaml +++ b/specification/components/stu3/schemas/eRS-FetchWorklist-Parameters.yaml @@ -37,6 +37,8 @@ properties: | `location` | `0..1` | | | `clinicianAssignedIndicator` | `0..1` | | | `clinician` | `0..1` | | + | `bookingReason` | `0..*` | | + items: anyOf: - $ref: 'parameters/ListType.yaml' @@ -46,3 +48,4 @@ properties: - $ref: 'parameters/Location.yaml' - $ref: 'parameters/ClinicianAssignedIndicator.yaml' - $ref: 'parameters/Clinician.yaml' + - $ref: 'parameters/BookingReasons.yaml' diff --git a/specification/components/stu3/schemas/endpoints/a008-retrieve-worklist.yaml b/specification/components/stu3/schemas/endpoints/a008-retrieve-worklist.yaml index 07b5412e1..66fb3c768 100644 --- a/specification/components/stu3/schemas/endpoints/a008-retrieve-worklist.yaml +++ b/specification/components/stu3/schemas/endpoints/a008-retrieve-worklist.yaml @@ -160,6 +160,10 @@ requestBody: summary: Letters Outstanding value: $ref: '../../examples/retrieveWorklist/requests/MinimalLettersOutstanding.json' + appointments-for-booking: + summary: Appointments For Booking + value: + $ref: '../../examples/retrieveWorklist/requests/AppointmentsForBookingWithReason.json' responses: '200': $ref: '../responses/retrieveWorklist/200Response.yaml' diff --git a/specification/components/stu3/schemas/extensions/Extension-eRS-AppointmentsForBooking-WorklistItem.yaml b/specification/components/stu3/schemas/extensions/Extension-eRS-AppointmentsForBooking-WorklistItem.yaml new file mode 100644 index 000000000..7c34193a8 --- /dev/null +++ b/specification/components/stu3/schemas/extensions/Extension-eRS-AppointmentsForBooking-WorklistItem.yaml @@ -0,0 +1,36 @@ +title: 'Extension-eRS-AppointmentsForBooking-WorklistItem' +type: object +required: + - url + - extension +properties: + url: + type: string + enum: + - 'https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AppointmentsForBooking-WorkListItem-1' + example: 'https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AppointmentsForBooking-WorkListItem-1' + extension: + description: | + | Field | Cardinality | Notes | + | ------------------------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------- | + | `patient` | `1..1` | The patient associated with the `ReferralRequest` | + | `appointmentStart` | `0..1` | The current appointment start time | + | `eReferralPathwayStart` | `1..1` | The start time of the referral pathway | + | `referrer` | `1..1` | The `Practitioner` who initially creates the `ReferralRequest` | + | `priority` | `1..1` | The priority associated with the `ReferralRequest` | + | `service` | `1..1` | The Service Name of the deferred-to Service associated with the Appointment Request. | + | `reason` | `1..1` | Reason that Appointment requires booking | + | `specialty` | `1..1` | The speciality of the current booking | + + type: array + items: + anyOf: + - $ref: './worklists/Extension-WorklistItem-Patient.yaml' + - $ref: './worklists/Extension-WorklistItem-AppointmentStart.yaml' + - $ref: './worklists/Extension-WorklistItem-ReferralPathwayStart.yaml' + - $ref: './worklists/Extension-WorklistItem-Referrer.yaml' + - $ref: './worklists/Extension-WorklistItem-Priority.yaml' + - $ref: './worklists/Extension-WorklistItem-Service.yaml' + - $ref: './worklists/Extension-WorklistItem-BookingReason.yaml' + - $ref: './worklists/Extension-WorklistItem-Specialty.yaml' + diff --git a/specification/components/stu3/schemas/extensions/worklists/Extension-WorklistItem-BookingReason.yaml b/specification/components/stu3/schemas/extensions/worklists/Extension-WorklistItem-BookingReason.yaml new file mode 100644 index 000000000..6aa72010c --- /dev/null +++ b/specification/components/stu3/schemas/extensions/worklists/Extension-WorklistItem-BookingReason.yaml @@ -0,0 +1,45 @@ +title: reason +type: object +required: + - url + - valueCodeableConcept +properties: + url: + type: string + enum: + - reason + example: 'reason' + valueCodeableConcept: + type: object + required: + - coding + properties: + coding: + type: array + minItems: 1 + maxItems: 1 + items: + type: object + required: + - system + - code + properties: + system: + type: string + enum: + - https://fhir.nhs.uk/STU3/CodeSystem/eRS-BookingReason-1 + example: 'https://fhir.nhs.uk/STU3/CodeSystem/eRS-BookingReason-1' + code: + type: string + enum: + - REBOOKING + - CANCELLED_APPOINTMENT_ADMIN_REBOOK + - CANCELLED_BY_PATIENT + - CANCELLED_BY_PROVIDER + - DEFERRED_TO_PROVIDER + - ONWARD_REFERRAL + - DNA + - TRIAGE_TO_BE_BOOKED + - TRIAGE_SEE_COMMENTS + - TRIAGE_ANG_CONVERTED_SEE_COMMENTS + example: 'TRIAGE_TO_BE_BOOKED' diff --git a/specification/components/stu3/schemas/parameters/BookingReasons.yaml b/specification/components/stu3/schemas/parameters/BookingReasons.yaml index c4526f56e..a45da1dff 100644 --- a/specification/components/stu3/schemas/parameters/BookingReasons.yaml +++ b/specification/components/stu3/schemas/parameters/BookingReasons.yaml @@ -1,37 +1,37 @@ -- title: bookingReason - description: Parameter to supply a booking reason - type: object - required: - - name - - valueCoding - properties: - name: - type: string - enum: - - bookingReason - example: 'bookingReason' - valueCoding: - type: object - required: - - system - - code - properties: - system: - type: string - enum: - - https://fhir.nhs.uk/STU3/CodeSystem/eRS-BookingReason-1 - example: https://fhir.nhs.uk/STU3/CodeSystem/eRS-BookingReason-1 - code: - type: string - enum: - - REBOOKING - - CANCELLED_APPOINTMENT_ADMIN_REBOOK - - CANCELLED_BY_PATIENT - - CANCELLED_BY_PROVIDER - - DEFERRED_TO_PROVIDER - - ONWARD_REFERRAL - - DNA - - TRIAGE_TO_BE_BOOKED - - TRIAGE_SEE_COMMENTS - - TRIAGE_ANG_CONVERTED_SEE_COMMENTS - example: TRIAGE_TO_BE_BOOKED +title: bookingReason +description: Parameter to supply a booking reason +type: object +required: + - name + - valueCoding +properties: + name: + type: string + enum: + - bookingReason + example: 'bookingReason' + valueCoding: + type: object + required: + - system + - code + properties: + system: + type: string + enum: + - https://fhir.nhs.uk/STU3/CodeSystem/eRS-BookingReason-1 + example: https://fhir.nhs.uk/STU3/CodeSystem/eRS-BookingReason-1 + code: + type: string + enum: + - REBOOKING + - CANCELLED_APPOINTMENT_ADMIN_REBOOK + - CANCELLED_BY_PATIENT + - CANCELLED_BY_PROVIDER + - DEFERRED_TO_PROVIDER + - ONWARD_REFERRAL + - DNA + - TRIAGE_TO_BE_BOOKED + - TRIAGE_SEE_COMMENTS + - TRIAGE_ANG_CONVERTED_SEE_COMMENTS + example: TRIAGE_TO_BE_BOOKED diff --git a/specification/components/stu3/schemas/parameters/ListType.yaml b/specification/components/stu3/schemas/parameters/ListType.yaml index 678983cff..da11d3e00 100644 --- a/specification/components/stu3/schemas/parameters/ListType.yaml +++ b/specification/components/stu3/schemas/parameters/ListType.yaml @@ -47,6 +47,7 @@ properties: - ASSESSMENT_RETURNED_CANCELLED_DNA - AWAITING_BOOKING - LETTERS_OUTSTANDING + - APPOINTMENTS_FOR_BOOKING example: 'REFERRALS_FOR_REVIEW' - title: eRS-CommunicationListSelector type: object diff --git a/specification/components/stu3/schemas/responses/retrieveWorklist/200Response.yaml b/specification/components/stu3/schemas/responses/retrieveWorklist/200Response.yaml index df9591b6f..2e9228bc8 100644 --- a/specification/components/stu3/schemas/responses/retrieveWorklist/200Response.yaml +++ b/specification/components/stu3/schemas/responses/retrieveWorklist/200Response.yaml @@ -47,3 +47,7 @@ content: summary: Letters Outstanding value: $ref: '../../../examples/retrieveWorklist/responses/LettersOutstanding.json' + appointments-for-booking: + summary: Appointments For Booking + value: + $ref: '../../../examples/retrieveWorklist/responses/AppointmentsForBooking.json' diff --git a/specification/e-referrals-service-api.yaml b/specification/e-referrals-service-api.yaml index 8d9d8a546..938124832 100644 --- a/specification/e-referrals-service-api.yaml +++ b/specification/e-referrals-service-api.yaml @@ -290,6 +290,8 @@ info: license: name: MIT servers: + - url: 'https://internal-dev-sandbox.api.service.nhs.uk/referrals-pr-1884/FHIR' + description: Sandbox environment. - url: 'https://sandbox.api.service.nhs.uk/referrals/FHIR' description: Sandbox environment. - url: 'https://int.api.service.nhs.uk/referrals/FHIR' diff --git a/tests/sandbox/stu3/test_a008_get_referral_worklist.py b/tests/sandbox/stu3/test_a008_get_referral_worklist.py index 2a85e9673..45fd040c0 100644 --- a/tests/sandbox/stu3/test_a008_get_referral_worklist.py +++ b/tests/sandbox/stu3/test_a008_get_referral_worklist.py @@ -57,6 +57,10 @@ class TestGetReferralWorklist(SandboxTest): "stu3/retrieveWorklist/requests/MinimalLettersOutstanding.json", "stu3/retrieveWorklist/responses/LettersOutstanding.json", ), + ( + "stu3/retrieveWorklist/requests/AppointmentsForBookingWithReason.json", + "stu3/retrieveWorklist/responses/AppointmentsForBooking.json", + ), ] @pytest.fixture