Skip to content

Commit 5f1516a

Browse files
committed
NPA-4688: Add GET /QuestionnaireResponse endpoint
This commit adds a new GET endpoint for retrieving QuestionnaireResponse by referenceCode, including: - New API endpoint definition with appropriate parameters - Success and error response examples - Reuse of existing QuestionnaireResponse schema
1 parent 1a0704c commit 5f1516a

File tree

5 files changed

+162
-0
lines changed

5 files changed

+162
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
InvalidReferenceCode:
2+
summary: Invalid reference code
3+
description: The provided reference code 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_REFERENCE_CODE"
13+
display: "Invalid reference code"
14+
diagnostics: "The specified reference code format is invalid. Reference codes must be alphanumeric."
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
MissingReferenceCode:
2+
summary: Missing reference code
3+
description: No reference code 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: "MISSING_REFERENCE_CODE"
13+
display: "Missing reference code"
14+
diagnostics: "The reference code parameter is required but was not provided."
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ReferenceCodeNotFound:
2+
summary: Reference code not found
3+
description: The provided reference code does not exist or was not found in the system.
4+
value:
5+
resourceType: "OperationOutcome"
6+
issue:
7+
- severity: "error"
8+
code: "not-found"
9+
details:
10+
coding:
11+
- system: "https://fhir.nhs.uk/CodeSystem/Spine-ErrorOrWarningCode"
12+
code: "REFERENCE_CODE_NOT_FOUND"
13+
display: "Reference code not found"
14+
diagnostics: "The specified reference code was not found in the system."
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
GetQuestionnaireResponseSuccess:
2+
summary: Successfully retrieved QuestionnaireResponse
3+
description: A sample of the QuestionnaireResponse retrieved using a valid reference code.
4+
value:
5+
resourceType: "QuestionnaireResponse"
6+
id: "HDJ2123F"
7+
status: "completed"
8+
authored: "2022-01-15T15:30:00+00:00"
9+
subject:
10+
identifier:
11+
system: "https://fhir.nhs.uk/Id/nhs-number"
12+
value: "9000000009"
13+
source:
14+
identifier:
15+
system: "https://fhir.nhs.uk/Id/nhs-number"
16+
value: "9000000017"
17+
item:
18+
- linkId: "proxy"
19+
item:
20+
- linkId: "proxy.nhsNumber"
21+
answer:
22+
- valueString: "9000000017"
23+
- linkId: "proxy.relationship"
24+
answer:
25+
- valueString: "friend"
26+
- linkId: "patient"
27+
item:
28+
- linkId: "patient.nhsNumber"
29+
answer:
30+
- valueString: "9000000009"
31+
- linkId: "patient.firstName"
32+
answer:
33+
- valueString: "Jane"
34+
- linkId: "patient.lastName"
35+
answer:
36+
- valueString: "Smith"
37+
- linkId: "patient.dateOfBirth"
38+
answer:
39+
- valueDate: "1990-01-01"
40+
- linkId: "accessRequest"
41+
item:
42+
- linkId: "accessRequest.type"
43+
answer:
44+
- valueString: "read"
45+
- linkId: "accessRequest.reason"
46+
answer:
47+
- valueString: "I am helping Jane manage her healthcare"

specification/validated-relationships-service-api.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,79 @@ paths:
246246
examples:
247247
internalServerError:
248248
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
249+
get:
250+
summary: Get QuestionnaireResponse
251+
description: |
252+
## Overview
253+
Retrieve a QuestionnaireResponse using its unique reference code. This endpoint returns the full
254+
QuestionnaireResponse document that was previously submitted.
255+
256+
## Request Requirements
257+
A valid reference code must be provided as a query parameter. This reference code is returned
258+
when a QuestionnaireResponse is initially submitted via the POST endpoint.
259+
260+
## Sandbox test scenarios
261+
262+
| Scenario | Request | Response |
263+
| ------------------------- | -------------------------------- | --------------------------------------------- |
264+
| Valid reference code | referenceCode=HDJ2123F | HTTP Status 200 with QuestionnaireResponse |
265+
| Invalid reference code | referenceCode=INVALID | HTTP Status 400 with error message |
266+
| Missing reference code | No referenceCode parameter | HTTP Status 400 with error message |
267+
| Non-existent reference | referenceCode=ABC123XY | HTTP Status 404 with error message |
268+
269+
operationId: get-questionnaire-response
270+
parameters:
271+
- $ref: "#/components/parameters/BearerAuthorization"
272+
- $ref: "#/components/parameters/RequestID"
273+
- $ref: "#/components/parameters/CorrelationID"
274+
- name: referenceCode
275+
in: query
276+
description: The unique reference code of the QuestionnaireResponse to retrieve
277+
required: true
278+
schema:
279+
type: string
280+
example: "HDJ2123F"
281+
responses:
282+
"200":
283+
description: QuestionnaireResponse successfully retrieved.
284+
content:
285+
application/fhir+json:
286+
schema:
287+
$ref: "#/components/schemas/QuestionnaireResponse"
288+
examples:
289+
getQuestionnaireResponseSuccess:
290+
$ref: "./examples/responses/GET_QuestionnaireResponse/success.yaml#/GetQuestionnaireResponseSuccess"
291+
"400":
292+
description: Invalid or missing reference code
293+
content:
294+
application/fhir+json:
295+
schema:
296+
$ref: "#/components/schemas/OperationOutcome"
297+
examples:
298+
missingReferenceCode:
299+
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/missing_reference_code.yaml#/MissingReferenceCode"
300+
invalidReferenceCode:
301+
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/invalid_reference_code.yaml#/InvalidReferenceCode"
302+
"404":
303+
description: Reference code not found
304+
content:
305+
application/fhir+json:
306+
schema:
307+
$ref: "#/components/schemas/OperationOutcome"
308+
examples:
309+
referenceCodeNotFound:
310+
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/reference_code_not_found.yaml#/ReferenceCodeNotFound"
311+
"5XX":
312+
description: Server error
313+
content:
314+
application/fhir+json:
315+
schema:
316+
$ref: "#/components/schemas/OperationOutcome"
317+
examples:
318+
internalServerError:
319+
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
320+
downstreamServiceError:
321+
$ref: "./examples/responses/errors/downstream-service-error.yaml#/DownstreamServiceError"
249322

250323
/RelatedPerson:
251324
get:

0 commit comments

Comments
 (0)