Skip to content

Commit b32df1a

Browse files
NPA-5357: Replaced referenceCode with accessRequestUUID and updated responses
1 parent 3bf5643 commit b32df1a

File tree

7 files changed

+59
-59
lines changed

7 files changed

+59
-59
lines changed

sandbox/api/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@
100100
# GET QuestionnaireResponse
101101
GET_QUESTIONNAIRE_RESPONSE_DIRECTORY = "./api/examples/GET_QuestionnaireResponse/"
102102
GET_QUESTIONNAIRE_RESPONSE__SUCCESS = f"{GET_QUESTIONNAIRE_RESPONSE_DIRECTORY}success.yaml"
103-
GET_QUESTIONNAIRE_RESPONSE__INVALID = f"{GET_QUESTIONNAIRE_RESPONSE_DIRECTORY}errors/invalid_reference_code.yaml"
104-
GET_QUESTIONNAIRE_RESPONSE__MISSING = f"{GET_QUESTIONNAIRE_RESPONSE_DIRECTORY}errors/missing_reference_code.yaml"
103+
GET_QUESTIONNAIRE_RESPONSE__INVALID = f"{GET_QUESTIONNAIRE_RESPONSE_DIRECTORY}errors/invalid_access_request_uuid.yaml"
104+
GET_QUESTIONNAIRE_RESPONSE__MISSING = f"{GET_QUESTIONNAIRE_RESPONSE_DIRECTORY}errors/missing_access_request_uuid.yaml"
105105
GET_QUESTIONNAIRE_RESPONSE__NOT_FOUND = (
106106
f"{GET_QUESTIONNAIRE_RESPONSE_DIRECTORY}errors/questionnaire_response_not_found.yaml"
107107
)

sandbox/api/get_questionnaire_response.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ def get_questionnaire_response_response() -> Union[dict, tuple]:
2323
Union[dict, tuple]: Response for GET /QuestionnaireResponse
2424
"""
2525
try:
26-
reference_code = request.args.get("referenceCode")
27-
if reference_code == "19318ZGLAB":
26+
access_request_uuid = request.args.get("accessRequestUUID")
27+
if access_request_uuid == "156e1560-e532-4e2a-85ad-5aeff03dc43e":
2828
return generate_response_from_example(GET_QUESTIONNAIRE_RESPONSE__SUCCESS, 200)
29-
elif reference_code == "INVALID":
29+
elif access_request_uuid == "INVALID":
3030
return generate_response_from_example(GET_QUESTIONNAIRE_RESPONSE__INVALID, 400)
31-
elif reference_code == "" or reference_code is None:
31+
elif access_request_uuid == "" or access_request_uuid is None:
3232
return generate_response_from_example(GET_QUESTIONNAIRE_RESPONSE__MISSING, 400)
33-
elif reference_code == "ABC123XY":
33+
elif access_request_uuid == "60d09b82-f4bb-41f9-b41e-767999b4ac9b":
3434
return generate_response_from_example(GET_QUESTIONNAIRE_RESPONSE__NOT_FOUND, 404)
3535
else:
36-
raise ValueError("Invalid reference code")
36+
raise ValueError("Invalid access request UUID")
3737
except Exception:
3838
logger.exception("GET questionnaire response failed")
3939
return generate_response_from_example(INTERNAL_SERVER_ERROR_EXAMPLE, 500)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
InvalidAccessRequestUUID:
2+
summary: Invalid access request UUID
3+
description: The provided access request UUID is invalid in format.
4+
value:
5+
resourceType: "OperationOutcome"
6+
issue:
7+
- severity: "error"
8+
code: "invalid"
9+
details:
10+
coding:
11+
- system: "https://fhir.nhs.uk/CodeSystem/Spine-ErrorOrWarningCode"
12+
code: "INVALID_IDENTIFIER_VALUE"
13+
display: "Invalid identifier value"
14+
diagnostics: "The specified access request UUID is invalid. Access request UUIDs must be a valid UUID."

specification/examples/responses/GET_QuestionnaireResponse/errors/invalid_reference_code.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
missingAccessRequestUUID:
2+
summary: Missing access request UUID
3+
description: No access request UUID was provided in the request.
4+
value:
5+
resourceType: "OperationOutcome"
6+
issue:
7+
- severity: "error"
8+
code: "required"
9+
details:
10+
coding:
11+
- system: "https://fhir.nhs.uk/CodeSystem/Spine-ErrorOrWarningCode"
12+
code: "BAD_REQUEST"
13+
display: "Bad request"
14+
diagnostics: "The access request UUID parameter is required but was not provided."

specification/examples/responses/GET_QuestionnaireResponse/errors/missing_reference_code.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

specification/validated-relationships-service-api.yaml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ paths:
292292
summary: Get a proxy access request
293293
description: |
294294
## Overview
295-
Retrieve a QuestionnaireResponse using its unique reference code. This endpoint returns the full
295+
Retrieve a QuestionnaireResponse using its unique access request UUID. This endpoint returns the full
296296
QuestionnaireResponse document that was previously submitted.
297297
298298
## Request Requirements
299-
A valid reference code must be provided as a query parameter. This reference code is returned
299+
A valid access request UUID must be provided as a query parameter. This access request UUID is returned
300300
when a QuestionnaireResponse is initially submitted via the POST endpoint.
301301
302302
## Access modes
@@ -307,25 +307,25 @@ paths:
307307
308308
## Sandbox test scenarios
309309
310-
| Scenario | Request | Response |
311-
| --------------------------- | -------------------------- | ------------------------------------------------------------- |
312-
| Valid reference code | referenceCode=19318ZGLAB | HTTP Status 200 with QuestionnaireResponse |
313-
| Invalid reference code | referenceCode=INVALID | HTTP Status 400 with INVALID_REFERENCE_CODE message |
314-
| Missing reference code | No referenceCode parameter | HTTP Status 400 with MISSING_REFERENCE_CODE message |
315-
| Non-existent reference code | referenceCode=ABC123XY | HTTP Status 404 with QUESTIONNAIRE_RESPONSE_NOT_FOUND message |
310+
| Scenario | Request | Response |
311+
| -------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------- |
312+
| Valid access request UUID | accessRequestUUID=156e1560-e532-4e2a-85ad-5aeff03dc43e | HTTP Status 200 with QuestionnaireResponse |
313+
| Invalid access request UUID | accessRequestUUID=INVALID | HTTP Status 400 with INVALID_REFERENCE_CODE message |
314+
| Missing access request UUID | No accessRequestUUID parameter | HTTP Status 400 with MISSING_REFERENCE_CODE message |
315+
| Non-existent access request UUID | accessRequestUUID=60d09b82-f4bb-41f9-b41e-767999b4ac9b | HTTP Status 404 with QUESTIONNAIRE_RESPONSE_NOT_FOUND message |
316316
317317
operationId: get-questionnaire-response
318318
parameters:
319319
- $ref: "#/components/parameters/BearerAuthorization"
320320
- $ref: "#/components/parameters/RequestID"
321321
- $ref: "#/components/parameters/CorrelationID"
322-
- name: referenceCode
322+
- name: accessRequestUUID
323323
in: query
324-
description: The unique reference code of the QuestionnaireResponse to retrieve
324+
description: The unique access request UUID of the QuestionnaireResponse to retrieve
325325
required: true
326326
schema:
327327
type: string
328-
example: "19318ZGLAB"
328+
example: "156e1560-e532-4e2a-85ad-5aeff03dc43e"
329329
responses:
330330
"200":
331331
description: QuestionnaireResponse successfully retrieved.
@@ -342,13 +342,13 @@ paths:
342342
343343
| HTTP status | Error code | Description |
344344
| ----------- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
345-
| 400 | `INVALID_REFERENCE_CODE` | The reference code must be alphanumeric and exactly 10 characters long. |
345+
| 400 | `INVALID_IDENTIFIER_VALUE` | The access request UUID must be a valid uuid. |
346346
| 400 | `INVALID_VALUE` | Invalid Parameter or Invalid operation. |
347-
| 400 | `MISSING_REFERENCE_CODE` | The reference code is required but was not provided in the request. |
347+
| 400 | `BAD_REQUEST`. | The access request UUID is required but was not provided in the request. |
348348
| 400 | `MISSING_VALUE` | Missing header or parameter. For details, see the `diagnostics` field. |
349349
| 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. |
350350
| 403 | `FORBIDDEN` | Access denied to resource. |
351-
| 404 | `QUESTIONNAIRE_RESPONSE_NOT_FOUND` | No questionnaire response was found for the provided reference code. |
351+
| 404 | `QUESTIONNAIRE_RESPONSE_NOT_FOUND` | No questionnaire response was found for the provided access request UUID. |
352352
| 404 | `INVALIDATED_RESOURCE` | Resource that has been marked as invalid was requested - invalid resources cannot be retrieved |
353353
| 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. |
354354
| 408 | `TIMEOUT` | Request timed out. |
@@ -359,11 +359,11 @@ paths:
359359
schema:
360360
$ref: "#/components/schemas/OperationOutcome"
361361
examples:
362-
invalidReferenceCode:
363-
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/invalid_reference_code.yaml#/InvalidReferenceCode"
364-
missingReferenceCode:
365-
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/missing_reference_code.yaml#/MissingReferenceCode"
366-
referenceCodeNotFound:
362+
invalidAccessRequestUUID:
363+
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/invalid_access_request_uuid.yaml#/InvalidAccessRequestUUID"
364+
missingAccessRequestUUID:
365+
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/missing_access_request_uuid.yaml#/MissingAccessRequestUUID"
366+
questionnaireResponseNotFound:
367367
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/questionnaire_response_not_found.yaml#/QuestionnaireResponseNotFound"
368368
"5XX":
369369
description: |
@@ -539,12 +539,12 @@ paths:
539539
| Multiple proxy relationships without filtering and details | `performer:identifier`=`9000000022` | HTTP Status 200 Bundle containing a multiple proxy relationships without details |
540540
| Multiple proxy relationships including performer details | `performer:identifier`=`9000000022` and `_include` = `Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including performer details |
541541
| Multiple proxy relationships including patient details | `performer:identifier`=`9000000022` and `_include` = `Consent:patient` | HTTP Status 200 Bundle containing a multiple proxy relationships including patient details |
542-
| Multiple proxy relationships including performer and patient details | `performer:identifier`=`9000000022` and `_include` = `Consent:patient` and `_include` = `Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including performer and patient details |
542+
| Multiple proxy relationships including performer and patient details | `performer:identifier`=`9000000022` and `_include` = `Consent:patient` and `_include` = `Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including performer and patient details |
543543
| Multiple proxy relationships, single patient | `patient:identifier`=`9000000100` | HTTP Status 200 Bundle containing a multiple proxy relationships including performer and patient details |
544-
| Multiple proxy relationships, single patient, including proxy details | `patient:identifier`=`9000000100` and `_include` = `Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including proxy details |
544+
| Multiple proxy relationships, single patient, including proxy details | `patient:identifier`=`9000000100` and `_include` = `Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including proxy details |
545545
| Multiple proxy relationships, single patient, including patient details | `patient:identifier`=`9000000100` and `_include` = `Consent:patient` | HTTP Status 200 Bundle containing a multiple proxy relationships including patient details |
546-
| Multiple proxy relationships, single patient, including proxy and patient details | `patient:identifier`=`9000000100` and `_include` = `Consent:patient` and `_include` = `Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including proxy and patient details |
547-
| No proxy relationships | `performer:identifier`=`9000000025` and `_include` = `Consent:patient` and `_include` = `Consent:performer` and `status` = `active` | HTTP Status 200 empty bundle |
546+
| Multiple proxy relationships, single patient, including proxy and patient details | `patient:identifier`=`9000000100` and `_include` = `Consent:patient` and `_include` = `Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including proxy and patient details |
547+
| No proxy relationships | `performer:identifier`=`9000000025` and `_include` = `Consent:patient` and `_include` = `Consent:performer` and `status` = `active` | HTTP Status 200 empty bundle |
548548
| A single proxy relationship between consenting adults | `performer:identifier`=`9000000010` and/or `patient:identifier`=`9000000005` | HTTP Status 200 Bundle containing a single proxy relationship |
549549
| A single proxy relationship between consenting adults including details | `performer:identifier`=`9000000010` and/or `patient:identifier`=`9000000005` and `_include` = `Consent:patient` and `_include` = `Consent:proxy` | HTTP Status 200 Bundle containing a single proxy relationship including performer and patient details |
550550
| A single proxy relationship between a mother and child | `performer:identifier`=`9000000019` and/or `patient:identifier`=`9000000009` | HTTP Status 200 Bundle containing a single proxy relationship |

0 commit comments

Comments
 (0)