Skip to content

Commit 87a158f

Browse files
committed
eli-173 adding simple container based approach to converting the specification to a postman collection
1 parent 6d10721 commit 87a158f

File tree

3 files changed

+233
-46
lines changed

3 files changed

+233
-46
lines changed

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ dependencies: # Install dependencies needed to build and test the project @Pipel
4848
build: # Build lambda in dist
4949
poetry build-lambda -vv
5050

51-
publish: # Publish the project artefact @Pipeline
52-
# TODO: Implement the artefact publishing step
53-
5451
deploy: # Deploy the project artefact to the target environment @Pipeline
5552
# TODO: Implement the artefact deployment step
5653

@@ -61,6 +58,13 @@ config:: # Configure development environment (main) @Configuration
6158
precommit: test-unit build test-integration lint ## Pre-commit tasks
6259
python -m this
6360

61+
SPEC_DIR := $(CURDIR)/specification
62+
POSTMAN_DIR := $(SPEC_DIR)/postman
63+
64+
convert-postman:
65+
docker build -t portman-converter -f $(POSTMAN_DIR)/Dockerfile $(SPEC_DIR)
66+
docker run --rm -v $(SPEC_DIR):/app portman-converter \
67+
portman -l /app/eligibility-signposting-api.yaml -o /app/postman/collection.json
6468
# ==============================================================================
6569

6670
${VERBOSE}.SILENT: \
Lines changed: 217 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,220 @@
1-
# This is an OpenAPI Specification (https://swagger.io/specification/)
2-
# for eligibility-signposting-api owned by NHS Digital (https://digital.nhs.uk/)
3-
openapi: '3.0.0'
1+
openapi: 3.0.1
42
info:
5-
title: 'eligibility-signposting-api'
6-
version: 'Computed and injected at build time by `scripts/set_version.py`'
7-
description: |
8-
## Overview
9-
Add a fully fledged description here with markdown syntax.
10-
For help completing the content of your API spec, see [our guidance](https://nhsd-confluence.digital.nhs.uk/display/APM/Documenting+your+API).
11-
You should also base your content on our exemplar API - [PDS FHIR](https://digital.nhs.uk/developer/api-catalogue/personal-demographics-service-fhir).
12-
## Who can use this API
13-
To be completed.
14-
## Related APIs
15-
To be completed.
16-
## API status and roadmap
17-
To be completed.
18-
## Service level
19-
To be completed.
20-
## Technology
21-
To be completed.
22-
## Network access
23-
To be completed.
24-
## Security and authorisation
25-
To be completed.
26-
## Errors
27-
To be completed.
28-
### Open source
29-
To be completed.
30-
## Environments and testing
31-
To be completed.
32-
## Onboarding
33-
To be completed.
34-
3+
title: Eligibility Signposting API
4+
version: 1.0.0-alpha
5+
description: API to assess eligibility based on category, condition and NHS number.
356
contact:
36-
name: 'eligibility-signposting-api API Support'
37-
url: 'https://digital.nhs.uk/developer/help-and-support'
38-
7+
url: https://developer.nhs.uk/apis/eligibility-signposting-api
8+
termsOfService: https://developer.nhs.uk/apis/eligibility-signposting-api
9+
tags:
10+
- name: Eligibility
11+
- name: Signposting
12+
- name: NextActions
3913
servers:
40-
- url: 'https://sandbox.api.service.nhs.uk/eligibility-signposting-api'
41-
description: Sandbox environment.
42-
- url: 'https://int.api.service.nhs.uk/eligibility-signposting-api'
43-
description: Integration test environment.
44-
- url: 'https://api.service.nhs.uk/eligibility-signposting-api'
45-
description: Production environment.
46-
paths: {}
14+
- url: https://sandbox.api.service.nhs.uk/eligibility-signposting
15+
description: Sandbox Server
16+
- url: https://int.api.service.nhs.uk/eligibility-signposting
17+
description: Integration Server
18+
- url: https://api.service.nhs.uk/eligibility-signposting
19+
description: Production Server
20+
security:
21+
- OAuth_Token: []
22+
paths:
23+
/eligibility:
24+
get:
25+
summary: Check Eligibility
26+
description: >-
27+
Determines which suggestions a person is eligible for and which they are
28+
not, including reasons and next steps.
29+
operationId: checkEligibility
30+
parameters:
31+
- name: patient
32+
in: query
33+
required: true
34+
schema:
35+
type: string
36+
example: '9876543210'
37+
description: The NHS number of the person.
38+
- name: category
39+
in: query
40+
required: false
41+
schema:
42+
type: string
43+
example: VACCINATIONS
44+
default: ALL
45+
description: >-
46+
The category for which the caller is checking eligibility
47+
suggestions. If not provided, eligibility for all supported
48+
categories will be checked.
49+
- name: conditions
50+
in: query
51+
required: false
52+
schema:
53+
type: string
54+
example: FLU,RSV
55+
default: ALL
56+
description: >-
57+
The diseases or conditions for which the caller is checking
58+
eligibility suggestions in a comma separated list. If not provided, eligibility for all
59+
supported diseases will be checked.
60+
responses:
61+
'200':
62+
description: Eligibility response.
63+
content:
64+
application/json:
65+
schema:
66+
type: object
67+
properties:
68+
responseId:
69+
type: guid
70+
description: GUID assigned when the decisioning evaluation is carried out. This will be useful if you ever need to request support for a particular request. This will not change if you receive a cached response.
71+
example: 1a233ba5-e1eb-4080-a086-2962f6fc3473
72+
processedDateTime:
73+
type: string
74+
description: Timestamp of when the decisioning evaluation is carried out. This will not change if you receive a cached response.
75+
example: '2025-02-12T16:11:22Z'
76+
processedSuggestions:
77+
type: array
78+
description: List of suggestions the person is eligible for.
79+
items:
80+
type: object
81+
properties:
82+
condition:
83+
type: string
84+
example: FLU
85+
status:
86+
type: string
87+
example: Bookable
88+
reasons:
89+
type: array
90+
description: Reasons that the status returned was returned.
91+
items:
92+
type: object
93+
properties:
94+
reasonCode:
95+
type: string
96+
reasonText:
97+
type: string
98+
example:
99+
- reasonCode: 'flu_coded_eligibility'
100+
reasonText: Our records indicate that you might be at a higher risk of illness if you were to catch Flu.
101+
- reasonCode: 'flu_65+_autumnwinter2023'
102+
reasonText: Our records indicate you are over 65
103+
nextSteps:
104+
type: array
105+
description: List of next steps for the person.
106+
items:
107+
type: object
108+
properties:
109+
actionType:
110+
type: string
111+
description: >-
112+
The type of step (e.g., information, link,
113+
button).
114+
actionCode:
115+
type: string
116+
description: Code representing the action to be taken
117+
description:
118+
type: string
119+
description: A brief description of the step.
120+
markdownText:
121+
type: string
122+
description: Additional information in markdown format.
123+
htmlText:
124+
type: string
125+
description: Additional information in HTML format.
126+
actionDate:
127+
type: string
128+
description: Optional date by which this action should be undertaken
129+
example:
130+
- actionType: "Link"
131+
actionCode: "BOOK"
132+
description: "Book an appointment here"
133+
markdownText: >-
134+
[Click here](https://www.nhs.uk/nhs-services/pharmacies/book-flu-vaccination/) to book your
135+
appointment.
136+
actionDate: "2025-03-31"
137+
- actionType: "INFO"
138+
actionCode: "NHS"
139+
description: "Visit the NHS website for more details."
140+
markdownText: "[Click here](https://www.nhs.uk/vaccinations/flu-vaccine/) to get more information"
141+
htmlText: "<a href='https://www.nhs.uk/vaccinations/flu-vaccine/'>Click here</a> to get more information."
142+
examples:
143+
example1:
144+
summary: Example 1
145+
value:
146+
responseId: 1a233ba5-e1eb-4080-a086-2962f6fc3473
147+
processedDateTime: '2025-02-12T16:11:22Z'
148+
processedSuggestions:
149+
- condition: FLU
150+
status: Bookable
151+
reasons:
152+
- reasonCode: 'flu_coded_eligibility'
153+
reasonText: Our records indicate that you might be at a higher risk of illness if you were to catch Flu.
154+
- reasonCode: 'flu_65+_autumnwinter2023'
155+
reasonText: Our records indicate you are over 65
156+
nextSteps:
157+
- actionType: "Link"
158+
actionCode: "BOOK"
159+
description: "Book an appointment here"
160+
markdownText: >-
161+
[Click here](https://www.nhs.uk/nhs-services/pharmacies/book-flu-vaccination/) to book your
162+
appointment.
163+
actionDate: "2025-03-31"
164+
- actionType: "INFO"
165+
actionCode: "NHS"
166+
description: "Visit the NHS website for more details."
167+
markdownText: "[Click here](https://www.nhs.uk/vaccinations/flu-vaccine/) to get more information"
168+
htmlText: "<a href='https://www.nhs.uk/vaccinations/flu-vaccine/'>Click here</a> to get more information."
169+
example2:
170+
summary: Example 2
171+
value:
172+
responseId: 2b344cb6-f2fc-5091-b197-4073f7fd4584
173+
processedDateTime: '2025-03-15T10:22:33Z'
174+
processedSuggestions:
175+
- condition: RSV
176+
status: Not Bookable
177+
reasons:
178+
- reasonCode: 'rsv_coded_eligibility'
179+
reasonText: Our records indicate that you might be at a higher risk of illness if you were to catch RSV.
180+
- reasonCode: 'rsv_65+_autumnwinter2023'
181+
reasonText: Our records indicate you are over 65
182+
nextSteps:
183+
- actionType: "Link"
184+
actionCode: "INFO"
185+
description: "Visit the NHS website for more details."
186+
markdownText: "[Click here](https://www.nhs.uk/vaccinations/rsv-vaccine/) to get more information"
187+
htmlText: "<a href='https://www.nhs.uk/vaccinations/rsv-vaccine/'>Click here</a> to get more information."
188+
'400':
189+
description: Invalid input data.
190+
content:
191+
application/json:
192+
schema:
193+
type: object
194+
properties:
195+
error:
196+
type: string
197+
example:
198+
- The values submitted in your request were not valid.
199+
- The condition list was badly formatted or contained unrecognised conditions.
200+
- The category contained an unrecognised value.
201+
'404':
202+
description: Person not found.
203+
content:
204+
application/json:
205+
schema:
206+
type: object
207+
properties:
208+
error:
209+
type: string
210+
example: >-
211+
The given NHS number was not found in our datasets. This
212+
could be because the number is incorrect or some other
213+
reason we cannot process that number.
214+
'500':
215+
description: Internal server error.
216+
components:
217+
securitySchemes:
218+
OAuth_Token:
219+
type: http
220+
scheme: bearer

specification/postman/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:18-alpine
2+
3+
RUN npm install -g @apideck/portman
4+
5+
WORKDIR /app
6+
7+
COPY ../eligibility-signposting-api.yaml .
8+
9+
CMD ["portman", "-l", "eligibility-signposting-api.yaml", "-o", "collection.json"]

0 commit comments

Comments
 (0)