From 81baee6b4f7099675f0344fb227dcc201a47fcaf Mon Sep 17 00:00:00 2001 From: chris-young-12-nhs <157396487+chris-young-12-nhs@users.noreply.github.com> Date: Wed, 15 May 2024 17:25:38 +0100 Subject: [PATCH 1/7] First cut of request/response for QuestionnaireResponse Has top level attributes but no item(s) yet. --- .../validated-relationships-service-api.yaml | 76 ++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 11344e9..8c981be 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -3,7 +3,7 @@ openapi: '3.0.0' info: title: 'Validated Relationships Service API' - version: '1.0.0' + version: '1.1.0' description: | ## Overview Use this API to access the Validated Relationships Service - the national electronic database of relationships @@ -149,6 +149,37 @@ servers: - url: 'https://api.service.nhs.uk/validated-relationships/FHIR/R4' description: Production environment. paths: + /QuestionnaireResponse + post: + summary: New Access request + description: | + ## Overview + For any new access request, the necessary details should be collected from a user facing service e.g. + Proxy Access Service and submitted as a QuestionaireResponse. + + For the most part demographics information doesn't need to be provided in the access request since it can be pulled from PDS. + operationId: new-access-request + requestBody: + description: FHIR QuestionnaireResponse + required: true + content: + application/fhir+json: + schema: + $ref: '#/components/schemas/QuestionnaireResponse' + responses: + '200': + description: Request was received successfully for processing + content: + application:fhir+/json: + schema: + $ref: '#/components/schemas/OpearationOutcome' + '400': + description: Bad request + content: + application:fhir+/json: + schema: + $ref: '#/components/schemas/OpearationOutcome' + /RelatedPerson: get: summary: Get validated relationships @@ -199,6 +230,49 @@ paths: $ref: '#/components/schemas/OperationOutcome' components: schemas: + QuestionnaireResponse: + type: object + description: A FHIR QuestionnaireResponse + properties: + resourceType: + type: string + description: The FHIR resource type + enum: ["QuestionnaireResponse"] + status: + type: code + description: The position of the questionnaire response within its overall lifecycle. + enum: ["completed"] + authored: + type: dateTime + description: The date and/or time that this set of answers were last changed. + # On Confluence the example has this as a string but here: + # https://simplifier.net/packages/hl7.fhir.r4.core/4.0.1/files/81730/~details + # it looks like an object + source: + type: object + description: The person who answered the questions about the subject. + properties: + type: + type: string + description: + enum: [RelatedPerson] # Here: https://simplifier.net/packages/hl7.fhir.r4.core/4.0.1/files/81189/~details this looks like it should be a URI + identifier: + description: An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers. + properties: + system: + type: string + description: Codesystem URL for the patient's NHS number. + enum: ["https://fhir.nhs.uk/Id/nhs-number"] + value: + type: string + description: The patient's NHS number. + example: "9000000009" + questionnaire: + type: string + description: The Questionnaire that defines and organizes the questions for which answers are being provided. + item: + type: array + description: A group or question item from the original questionnaire for which answers are provided. Relationship: type: object description: A FHIR searchset. From cbe353dbaa99e45cbffdbbf0024bdb9b31363c12 Mon Sep 17 00:00:00 2001 From: chris-young-12-nhs <157396487+chris-young-12-nhs@users.noreply.github.com> Date: Wed, 15 May 2024 22:28:56 +0100 Subject: [PATCH 2/7] NPA-2676: Added Proxy Details --- .../validated-relationships-service-api.yaml | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 8c981be..83d6661 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -272,7 +272,59 @@ components: description: The Questionnaire that defines and organizes the questions for which answers are being provided. item: type: array - description: A group or question item from the original questionnaire for which answers are provided. + description: A group or question item from the original questionnaire for which answers are provided. + items: + oneOf: + - $ref: '#/components/schemas/QuestionnaireItem/ProxyDetails + # - $ref: '#/components/schemas/QuestionnaireItem/PatientDetails + # - $ref: '#/components/schemas/QuestionnaireItem/RequestedServices + + QuestionnaireItem: + ProxyDetails: + type: object + properties: + linkId: + text: + item: + type: array + description: Proxy Details + items: + oneOf: + - type: object + properties: + linkId: + type: string + enum: ["proxy_details"] + text: + type: string + item: + type: array + items: + oneOf: + - type: object + properties: + linkId: + type: string + enum ["nhs_number"] + text: + type: string + answer: + type: array + items: + oneOf: + - type: object + properties: + valueString: + type: string + # PatientDetails: + # type: object + # properties: + + # RequestedServices: + # type: object + # properties: + + Relationship: type: object description: A FHIR searchset. From 67b867c11ade329c34c4cdd95e888fc92ccee7a5 Mon Sep 17 00:00:00 2001 From: chris-young-12-nhs <157396487+chris-young-12-nhs@users.noreply.github.com> Date: Wed, 15 May 2024 22:55:05 +0100 Subject: [PATCH 3/7] NPA-2676: Fixed errors in spec --- .../validated-relationships-service-api.yaml | 103 ++++++++---------- 1 file changed, 47 insertions(+), 56 deletions(-) diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 83d6661..561bfa1 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -149,7 +149,7 @@ servers: - url: 'https://api.service.nhs.uk/validated-relationships/FHIR/R4' description: Production environment. paths: - /QuestionnaireResponse + /QuestionnaireResponse: post: summary: New Access request description: | @@ -158,7 +158,7 @@ paths: Proxy Access Service and submitted as a QuestionaireResponse. For the most part demographics information doesn't need to be provided in the access request since it can be pulled from PDS. - operationId: new-access-request + operationId: new-access-request requestBody: description: FHIR QuestionnaireResponse required: true @@ -172,13 +172,13 @@ paths: content: application:fhir+/json: schema: - $ref: '#/components/schemas/OpearationOutcome' + $ref: '#/components/schemas/OperationOutcome' '400': description: Bad request content: application:fhir+/json: schema: - $ref: '#/components/schemas/OpearationOutcome' + $ref: '#/components/schemas/OperationOutcome' /RelatedPerson: get: @@ -239,11 +239,11 @@ components: description: The FHIR resource type enum: ["QuestionnaireResponse"] status: - type: code + type: string description: The position of the questionnaire response within its overall lifecycle. enum: ["completed"] authored: - type: dateTime + type: string description: The date and/or time that this set of answers were last changed. # On Confluence the example has this as a string but here: # https://simplifier.net/packages/hl7.fhir.r4.core/4.0.1/files/81730/~details @@ -254,7 +254,6 @@ components: properties: type: type: string - description: enum: [RelatedPerson] # Here: https://simplifier.net/packages/hl7.fhir.r4.core/4.0.1/files/81189/~details this looks like it should be a URI identifier: description: An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers. @@ -266,7 +265,7 @@ components: value: type: string description: The patient's NHS number. - example: "9000000009" + example: "9000000001" questionnaire: type: string description: The Questionnaire that defines and organizes the questions for which answers are being provided. @@ -275,54 +274,46 @@ components: description: A group or question item from the original questionnaire for which answers are provided. items: oneOf: - - $ref: '#/components/schemas/QuestionnaireItem/ProxyDetails - # - $ref: '#/components/schemas/QuestionnaireItem/PatientDetails - # - $ref: '#/components/schemas/QuestionnaireItem/RequestedServices - - QuestionnaireItem: - ProxyDetails: - type: object - properties: - linkId: - text: - item: - type: array - description: Proxy Details - items: - oneOf: - - type: object - properties: - linkId: - type: string - enum: ["proxy_details"] - text: - type: string - item: - type: array - items: - oneOf: - - type: object - properties: - linkId: - type: string - enum ["nhs_number"] - text: - type: string - answer: - type: array - items: - oneOf: - - type: object - properties: - valueString: - type: string - # PatientDetails: - # type: object - # properties: - - # RequestedServices: - # type: object - # properties: + - $ref: '#/components/schemas/QuestionnaireItem_ProxyDetails' + # - $ref: '#/components/schemas/QuestionnaireItem/PatientDetails' + # - $ref: '#/components/schemas/QuestionnaireItem/RequestedServices' + + QuestionnaireItem_ProxyDetails: + type: object + properties: + linkId: + type: string + enum: ["proxy_details"] + text: + type: string + item: + type: array + items: + oneOf: + - type: object + properties: + linkId: + type: string + enum: ["nhs_number"] + text: + type: string + example: "9000000001" + answer: + type: array + items: + oneOf: + - type: object + properties: + valueString: + type: string + example: "9000000005" + # PatientDetails: + # type: object + # properties: + + # RequestedServices: + # type: object + # properties: Relationship: From 39ecaa8995202b35d6941a1267885bbe2e238550 Mon Sep 17 00:00:00 2001 From: chris-young-12-nhs <157396487+chris-young-12-nhs@users.noreply.github.com> Date: Thu, 16 May 2024 09:19:37 +0100 Subject: [PATCH 4/7] NPA-2676: Added rest of Questionnaire Response structure --- .../validated-relationships-service-api.yaml | 164 ++++++++++++++++-- 1 file changed, 154 insertions(+), 10 deletions(-) diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 561bfa1..72733ed 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -275,8 +275,8 @@ components: items: oneOf: - $ref: '#/components/schemas/QuestionnaireItem_ProxyDetails' - # - $ref: '#/components/schemas/QuestionnaireItem/PatientDetails' - # - $ref: '#/components/schemas/QuestionnaireItem/RequestedServices' + - $ref: '#/components/schemas/QuestionnaireItem_PatientDetails' + - $ref: '#/components/schemas/QuestionnaireItem_RequestedServices' QuestionnaireItem_ProxyDetails: type: object @@ -297,7 +297,7 @@ components: enum: ["nhs_number"] text: type: string - example: "9000000001" + example: "NHS Number" answer: type: array items: @@ -307,14 +307,158 @@ components: valueString: type: string example: "9000000005" - # PatientDetails: - # type: object - # properties: - - # RequestedServices: - # type: object - # properties: + - type: object + properties: + linkId: + type: string + enum: ["relationship"] + text: + type: string + example: "Relationship" + answer: + type: array + items: + oneOf: + - type: object + properties: + valueCoding: + type: object + properties: + system: + type: string + enum: ['http://terminology.hl7.org/CodeSystem/v3-RoleCode'] + code: + type: string + enum: ['PRN', 'Personal'] + display: + type: string + example: "Personal" + + QuestionnaireItem_PatientDetails: + type: object + properties: + linkId: + type: string + enum: ["patient_details"] + text: + type: string + item: + type: array + items: + oneOf: + - type: object + properties: + linkId: + type: string + enum: ["nhs_number"] + text: + type: string + example: "NHS Number" + answer: + type: array + items: + oneOf: + - type: object + properties: + valueString: + type: string + example: "9000000006" + - type: object + properties: + linkId: + type: string + enum: ["first_name"] + text: + type: string + example: "First Name" + answer: + type: array + items: + oneOf: + - type: object + properties: + valueString: + type: string + example: "Timmy" + - type: object + properties: + linkId: + type: string + enum: ["first_name"] + text: + type: string + example: "First Name" + answer: + type: array + items: + oneOf: + - type: object + properties: + valueString: + type: string + example: "Tenenbaum" + - type: object + properties: + linkId: + type: string + enum: ["date_of_birth"] + text: + type: string + example: "Date pf Birth" + answer: + type: array + items: + oneOf: + - type: object + properties: + valueString: + type: string + example: "2020-10-22" + - type: object + properties: + linkId: + type: string + enum: ["postcode"] + text: + type: string + example: "Postcode" + answer: + type: array + items: + oneOf: + - type: object + properties: + valueString: + type: string + example: "LS1 4AP" + QuestionnaireItem_RequestedServices: + type: object + properties: + linkId: + type: string + enum: ["requested_services"] + text: + type: string + example: "Requested services" + answer: + type: array + items: + anyOf: + - type: object + properties: + valueCoding: + type: object + properties: + system: + type: string + enum: ['http://terminology.hl7.org/CodeSystem/consentaction'] + code: + type: string + enum: ['appointments','medicines','records','demographics'] + display: + type: string + example: "manage appointments" Relationship: type: object From 83c9e0973f8e57ced709c9c3246fabc46c6ecf65 Mon Sep 17 00:00:00 2001 From: chris-young-12-nhs <157396487+chris-young-12-nhs@users.noreply.github.com> Date: Thu, 16 May 2024 09:42:56 +0100 Subject: [PATCH 5/7] NPA-2676: Fixed typo in spec --- specification/validated-relationships-service-api.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 72733ed..2a3f19e 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -384,10 +384,10 @@ components: properties: linkId: type: string - enum: ["first_name"] + enum: ["last_name"] text: type: string - example: "First Name" + example: "Last Name" answer: type: array items: From 8eab0ab73660f06af3dd1389e19e529d21a1e55a Mon Sep 17 00:00:00 2001 From: chris-young-12-nhs <157396487+chris-young-12-nhs@users.noreply.github.com> Date: Thu, 16 May 2024 12:30:56 +0100 Subject: [PATCH 6/7] NPA-2676: Added missing headers and 500 responses --- .../validated-relationships-service-api.yaml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 2a3f19e..2cfc05b 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -159,6 +159,10 @@ paths: For the most part demographics information doesn't need to be provided in the access request since it can be pulled from PDS. operationId: new-access-request + parameters: + - $ref: "#/components/parameters/BearerAuthorization" + - $ref: "#/components/parameters/RequestID" + - $ref: "#/components/parameters/CorrelationID" requestBody: description: FHIR QuestionnaireResponse required: true @@ -179,6 +183,15 @@ paths: application:fhir+/json: schema: $ref: '#/components/schemas/OperationOutcome' + "500": + description: Internal server error + content: + application/fhir+json: + schema: + $ref: '#/components/schemas/OperationOutcome' + examples: + internalServerError: + $ref: '#/components/examples/InternalServerError' /RelatedPerson: get: @@ -224,10 +237,20 @@ paths: | 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. | | 408 | `TIMEOUT` | Request timed out. | | 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). | + content: application/fhir+json: schema: $ref: '#/components/schemas/OperationOutcome' + "500": + description: Internal server error + content: + application/fhir+json: + schema: + $ref: '#/components/schemas/OperationOutcome' + examples: + internalServerError: + $ref: '#/components/examples/InternalServerError' components: schemas: QuestionnaireResponse: @@ -907,3 +930,18 @@ components: format: uuid pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" example: 11C46F5F-CDEF-4865-94B2-0EE0EDCC26DA + + examples: + InternalServerError: + value: + resourceType: "OperationOutcome" + issue: + - severity: error + code: invalid + diagnostics: "Internal Server Error - Failed to generate response is present in the response" + details: + coding: + - system: "https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode" + version: "1" + code: "SERVER_ERROR" + display: "Failed to generate response" From 85cb7ba0160ec8c1083168cc43783ea23b0b0996 Mon Sep 17 00:00:00 2001 From: chris-young-12-nhs <157396487+chris-young-12-nhs@users.noreply.github.com> Date: Thu, 16 May 2024 12:52:49 +0100 Subject: [PATCH 7/7] NPA-2676: Added example OperationOutcome for successfil QuestionnaireResponse POST --- .../validated-relationships-service-api.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 2cfc05b..dc921fb 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -177,6 +177,9 @@ paths: application:fhir+/json: schema: $ref: '#/components/schemas/OperationOutcome' + examples: + postQuestionnaireResponseSuccess: + $ref: '#/components/examples/PostQuestionnaireResponseSuccess' '400': description: Bad request content: @@ -945,3 +948,13 @@ components: version: "1" code: "SERVER_ERROR" display: "Failed to generate response" + PostQuestionnaireResponseSuccess: + value: + resourceType: "OperationOutcome" + issue: + - severity: information + code: informational + details: + coding: + - code: "HDJ2123F" + display: "HDJ2123F"