Skip to content

Commit e052bf0

Browse files
authored
Merge pull request #147 from NHSDigital/feature/syn-928
SYN-928 - add women's health api details
2 parents c8edde6 + 36db61d commit e052bf0

26 files changed

Lines changed: 9172 additions & 1721 deletions

proxies/live/apiproxy/resources/jsc/SearchAndReplaceResponse.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,40 @@ var searchAndReplaceStrings = [
254254
searchForRegex: /href=\\"\/vaccinations\//gm,
255255
replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
256256
},
257+
{
258+
comment1: "=============================================================",
259+
comment2: "Women's health ",
260+
comment3: "=============================================================",
261+
},
262+
{
263+
searchForRegex: /:\s?"https:\/\/api.nhs.uk\/womens-health\//gm,
264+
replaceWithStr:
265+
': "https://' +
266+
requestHostnameEnv +
267+
"/nhs-website-content/womens-health/",
268+
},
269+
{
270+
searchForRegex: /:\s?"https:\/\/www.nhs.uk\/womens-health\//gm,
271+
replaceWithStr:
272+
': "https://' +
273+
requestHostnameEnv +
274+
"/nhs-website-content/womens-health/",
275+
},
276+
{
277+
searchForRegex: /:\s?"\/womens-health\//gm,
278+
replaceWithStr:
279+
': "https://' +
280+
requestHostnameEnv +
281+
"/nhs-website-content/womens-health/",
282+
},
283+
{
284+
searchForRegex: /href=\\"https:\/\/api.nhs.uk\/womens-health\//gm,
285+
replaceWithStr: 'href=\\"https://www.nhs.uk/womens-health/',
286+
},
287+
{
288+
searchForRegex: /href=\\"\/womens-health\//gm,
289+
replaceWithStr: 'href=\\"https://www.nhs.uk/womens-health/',
290+
},
257291
{
258292
comment1: "=============================================================",
259293
comment2: "Manifest pages ",
@@ -264,6 +298,11 @@ var searchAndReplaceStrings = [
264298
replaceWithStr:
265299
': "https://' + requestHostnameEnv + "/nhs-website-content/manifest/",
266300
},
301+
{
302+
comment1: "=============================================================",
303+
comment2: "Webpage hostname ",
304+
comment3: "=============================================================",
305+
},
267306
{
268307
searchForRegex:
269308
/"webpage":\s?"https:\/\/internal-dev.api.service.nhs.uk\/nhs-website-content\//gm,
@@ -284,6 +323,15 @@ var searchAndReplaceStrings = [
284323
/"webpage":\s?"https:\/\/api.service.nhs.uk\/nhs-website-content\//gm,
285324
replaceWithStr: '"webpage": "https://www.nhs.uk/',
286325
},
326+
{
327+
comment1: "=============================================================",
328+
comment2: "Remove data-block-key Attributes from CMS ",
329+
comment3: "=============================================================",
330+
},
331+
{
332+
searchForRegex: /\s+data-block-key=\\"[^"]*\\"/gm,
333+
replaceWithStr: "",
334+
},
287335
];
288336

289337
var responseContent = context.getVariable("response.content");

proxies/sandbox/apiproxy/resources/jsc/SearchAndReplaceResponse.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,78 @@
205205
// searchForRegex: /href=\\"\/vaccinations\//gm,
206206
// replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
207207
// },
208+
// {
209+
// comment1: "=============================================================",
210+
// comment2: "Women's health ",
211+
// comment3: "=============================================================",
212+
// },
213+
// {
214+
// searchForRegex: /:\s?"https:\/\/api.nhs.uk\/womens-health\//gm,
215+
// replaceWithStr:
216+
// ': "https://' + requestHostnameEnv + "/nhs-website-content/womens-health/",
217+
// },
218+
// {
219+
// searchForRegex: /:\s?"https:\/\/www.nhs.uk\/womens-health\//gm,
220+
// replaceWithStr:
221+
// ': "https://' + requestHostnameEnv + "/nhs-website-content/womens-health/",
222+
// },
223+
// {
224+
// searchForRegex: /:\s?"\/womens-health\//gm,
225+
// replaceWithStr:
226+
// ': "https://' + requestHostnameEnv + "/nhs-website-content/womens-health/",
227+
// },
228+
// {
229+
// searchForRegex: /href=\\"https:\/\/api.nhs.uk\/womens-health\//gm,
230+
// replaceWithStr: 'href=\\"https://www.nhs.uk/womens-health/',
231+
// },
232+
// {
233+
// searchForRegex: /href=\\"\/womens-health\//gm,
234+
// replaceWithStr: 'href=\\"https://www.nhs.uk/womens-health/',
235+
// },
236+
// {
237+
// comment1: "=============================================================",
238+
// comment2: "Manifest pages ",
239+
// comment3: "=============================================================",
240+
// },
241+
// {
242+
// searchForRegex: /:\s?"https:\/\/www.nhs.uk\/content-api\/manifest\//gm,
243+
// replaceWithStr:
244+
// ': "https://' + requestHostnameEnv + "/nhs-website-content/manifest/",
245+
// },
246+
// {
247+
// comment1: "=============================================================",
248+
// comment2: "Webpage hostname ",
249+
// comment3: "=============================================================",
250+
// },
251+
// {
252+
// searchForRegex:
253+
// /"webpage":\s?"https:\/\/internal-dev.api.service.nhs.uk\/nhs-website-content\//gm,
254+
// replaceWithStr: '"webpage": "https://www.nhs.uk/',
255+
// },
256+
// {
257+
// searchForRegex:
258+
// /"webpage":\s?"https:\/\/internal-qa.api.service.nhs.uk\/nhs-website-content\//gm,
259+
// replaceWithStr: '"webpage": "https://www.nhs.uk/',
260+
// },
261+
// {
262+
// searchForRegex:
263+
// /"webpage":\s?"https:\/\/int.api.service.nhs.uk\/nhs-website-content\//gm,
264+
// replaceWithStr: '"webpage": "https://www.nhs.uk/',
265+
// },
266+
// {
267+
// searchForRegex:
268+
// /"webpage":\s?"https:\/\/api.service.nhs.uk\/nhs-website-content\//gm,
269+
// replaceWithStr: '"webpage": "https://www.nhs.uk/',
270+
// },
271+
// {
272+
// comment1: "=============================================================",
273+
// comment2: "Remove data-block-key Attributes from CMS ",
274+
// comment3: "=============================================================",
275+
// },
276+
// {
277+
// searchForRegex: /\s+data-block-key=\\"[^"]*\\"/gm,
278+
// replaceWithStr: "",
279+
// },
208280
// ];
209281

210282
var responseContent = context.getVariable("response.content");

sandbox/Sandbox endpoints - localhost.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,11 @@
138138
[6-in-1 vaccine](http://localhost:9000/vaccinations/6-in-1-vaccine/)
139139

140140
[Available travel vaccines](http://localhost:9000/vaccinations/travel-vaccinations/available-travel-vaccines/)
141+
142+
## Women's health
143+
144+
[Women's health Root](http://localhost:9000/womens-health/)
145+
146+
[Periods](http://localhost:9000/womens-health/periods/)
147+
148+
[Anaemia](http://localhost:9000/womens-health/anaemia/)

sandbox/app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ app.all('/vaccinations/nhs-vaccinations-and-when-to-have-them/', handlers.vaccin
208208
app.all('/vaccinations/6-in-1-vaccine/', handlers.vaccinations6in1Vaccine)
209209
app.all('/vaccinations/travel-vaccinations/available-travel-vaccines/', handlers.vaccinationsAvailableTravelVaccines)
210210

211+
// ******************************************************************
212+
// ** Women's health pages
213+
// ******************************************************************
214+
app.all('/womens-health/', handlers.womensHealthRoot)
215+
app.all('/womens-health/periods/', handlers.womensHealthPeriods)
216+
app.all('/womens-health/anaemia/', handlers.womensHealthAnaemia)
217+
211218
app.use((req, res, next) => {
212219
res.status(404).json(errorResourceNotFoundResponse)
213220
})

sandbox/handlers.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ const vaccinationsNhsVaccinationsAndWhenToHaveThemResponse = require('./response
8181
const vaccinations6in1VaccineResponse = require('./responses/vaccinations-6-in-1-vaccine-no-params.json')
8282
const vaccinationsAvailableTravelVaccinesResponse = require('./responses/vaccinations-available-travel-vaccines-no-params.json')
8383

84+
// Women's health - Responses
85+
const womensHealthRootResponse = require('./responses/womens-health-root-no-params.json')
86+
const womensHealthPeriodsResponse = require('./responses/womens-health-periods-no-params.json')
87+
const womensHealthAnaemiaResponse = require('./responses/womens-health-anaemia-no-params.json')
88+
8489
// ******************************************************************
8590
// ** Root page
8691
// ******************************************************************
@@ -1039,6 +1044,70 @@ async function vaccinationsAvailableTravelVaccines(req, res, next) {
10391044
next()
10401045
}
10411046

1047+
// ******************************************************************
1048+
// ** Women's health pages
1049+
// ******************************************************************
1050+
1051+
// Live website URL
1052+
// https://www.nhs.uk/womens-health/
1053+
// This sandbox on localhost
1054+
// http://localhost:9000/womens-health/
1055+
// API on Azure API Management
1056+
// https://api.nhs.uk/womens-health/
1057+
// Wagtail (Python) Application (no auth key required)
1058+
// https://www.nhs.uk/content-api/womens-health/
1059+
// Apigee Sandbox environment (no auth key required)
1060+
// https://sandbox.api.service.nhs.uk/nhs-website-content/womens-health/
1061+
// Apigee Integration environment ('apikey' required in Header)
1062+
// https://int.api.service.nhs.uk/nhs-website-content/womens-health/
1063+
// Apigee Production environment ('apikey' required in Header)
1064+
// https://api.service.nhs.uk/nhs-website-content/womens-health/
1065+
async function womensHealthRoot(req, res, next) {
1066+
res.status(200).json(womensHealthRootResponse)
1067+
res.end()
1068+
next()
1069+
}
1070+
1071+
// Live website URL
1072+
// https://www.nhs.uk/womens-health/periods/
1073+
// This sandbox on localhost
1074+
// http://localhost:9000/womens-health/periods/
1075+
// API on Azure API Management
1076+
// https://api.nhs.uk/womens-health/periods/
1077+
// Wagtail (Python) Application (no auth key required)
1078+
// https://www.nhs.uk/content-api/womens-health/periods/
1079+
// Apigee Sandbox environment (no auth key required)
1080+
// https://sandbox.api.service.nhs.uk/nhs-website-content/womens-health/periods/
1081+
// Apigee Integration environment ('apikey' required in Header)
1082+
// https://int.api.service.nhs.uk/nhs-website-content/womens-health/periods/
1083+
// Apigee Production environment ('apikey' required in Header)
1084+
// https://api.service.nhs.uk/nhs-website-content/womens-health/periods/
1085+
async function womensHealthPeriods(req, res, next) {
1086+
res.status(200).json(womensHealthPeriodsResponse)
1087+
res.end()
1088+
next()
1089+
}
1090+
1091+
// Live website URL
1092+
// https://www.nhs.uk/womens-health/anaemia/
1093+
// This sandbox on localhost
1094+
// http://localhost:9000/womens-health/anaemia/
1095+
// API on Azure API Management
1096+
// https://api.nhs.uk/womens-health/anaemia/
1097+
// Wagtail (Python) Application (no auth key required)
1098+
// https://www.nhs.uk/content-api/womens-health/anaemia/
1099+
// Apigee Sandbox environment (no auth key required)
1100+
// https://sandbox.api.service.nhs.uk/nhs-website-content/womens-health/anaemia/
1101+
// Apigee Integration environment ('apikey' required in Header)
1102+
// https://int.api.service.nhs.uk/nhs-website-content/womens-health/anaemia/
1103+
// Apigee Production environment ('apikey' required in Header)
1104+
// https://api.service.nhs.uk/nhs-website-content/womens-health/anaemia/
1105+
async function womensHealthAnaemia(req, res, next) {
1106+
res.status(200).json(womensHealthAnaemiaResponse)
1107+
res.end()
1108+
next()
1109+
}
1110+
10421111
// ******************************************************************
10431112
// ** Status
10441113
// ******************************************************************
@@ -1095,4 +1164,7 @@ module.exports = {
10951164
vaccinationsAvailableTravelVaccines,
10961165
vaccinationsNhsVaccinationsAndWhenToHaveThem,
10971166
vaccinationsRoot,
1167+
womensHealthAnaemia,
1168+
womensHealthPeriods,
1169+
womensHealthRoot,
10981170
}

sandbox/responses/_curl-commands.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ curl -X GET 'https://api.service.nhs.uk/nhs-website-content/contraception/' -H '
1818

1919
curl -X GET 'https://api.service.nhs.uk/nhs-website-content/vaccinations/' -H 'apikey: Oq5LuCPc5X69KFlIw6P7TVYrrJHSceX8' >> ./responses/vaccinations-root-no-params.json
2020

21+
curl -X GET 'https://api.service.nhs.uk/nhs-website-content/womens-health/' -H 'apikey: Oq5LuCPc5X69KFlIw6P7TVYrrJHSceX8' >> ./responses/womens-health-root-no-params.json
22+
2123

2224
*****************************************************************************************************************
2325
** Manifest pages **
@@ -152,3 +154,12 @@ curl -X GET 'https://api.service.nhs.uk/nhs-website-content/vaccinations/nhs-vac
152154
curl -X GET 'https://api.service.nhs.uk/nhs-website-content/vaccinations/6-in-1-vaccine/' -H 'apikey: Oq5LuCPc5X69KFlIw6P7TVYrrJHSceX8' >> ./responses/vaccinations-6-in-1-vaccine-no-params.json
153155

154156
curl -X GET 'https://api.service.nhs.uk/nhs-website-content/vaccinations/travel-vaccinations/available-travel-vaccines/' -H 'apikey: Oq5LuCPc5X69KFlIw6P7TVYrrJHSceX8' >> ./responses/vaccinations-available-travel-vaccines-no-params.json
157+
158+
159+
*****************************************************************************************************************
160+
** Women's health pages **
161+
*****************************************************************************************************************
162+
163+
curl -X GET 'https://api.service.nhs.uk/nhs-website-content/womens-health/periods/' -H 'apikey: Oq5LuCPc5X69KFlIw6P7TVYrrJHSceX8' >> ./responses/womens-health-periods-no-params.json
164+
165+
curl -X GET 'https://api.service.nhs.uk/nhs-website-content/womens-health/aneamia/' -H 'apikey: Oq5LuCPc5X69KFlIw6P7TVYrrJHSceX8' >> ./responses/womens-health-anaemia-no-params.json

sandbox/responses/conditions-acne-modules-true.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"url": "https://assets.nhs.uk/nhsuk-cms/images/S_0917_acne_M1080444.max-600x600.jpg",
2828
"caption": "",
2929
"provider": "Science Photo Library",
30-
"license": "<p data-block-key=\"hdfnr\">DR P. MARAZZI/SCIENCE PHOTO LIBRARY https://www.sciencephoto.com/media/250116/view</p>",
30+
"license": "<p>DR P. MARAZZI/SCIENCE PHOTO LIBRARY https://www.sciencephoto.com/media/250116/view</p>",
3131
"datePublished": "2017-09-21T10:41:58+00:00",
3232
"keywords": [
3333
"Skin",

sandbox/responses/conditions-acne-no-params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"url": "https://assets.nhs.uk/nhsuk-cms/images/S_0917_acne_M1080444.max-600x600.jpg",
6262
"caption": "",
6363
"provider": "Science Photo Library",
64-
"license": "<p data-block-key=\"hdfnr\">DR P. MARAZZI/SCIENCE PHOTO LIBRARY https://www.sciencephoto.com/media/250116/view</p>",
64+
"license": "<p>DR P. MARAZZI/SCIENCE PHOTO LIBRARY https://www.sciencephoto.com/media/250116/view</p>",
6565
"datePublished": "2017-09-21T10:41:58+00:00",
6666
"keywords": [
6767
"Skin",

sandbox/responses/contraception-condoms-no-params.json

Lines changed: 464 additions & 1 deletion
Large diffs are not rendered by default.

sandbox/responses/contraception-methods-of-contraception-no-params.json

Lines changed: 1864 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)