Skip to content

Commit 4b2254b

Browse files
author
Adrian Clay
authored
wiremock: Replace hardcoded NHS numbers in FHIR responses with templates (#599)
This means that if we want to change the test NHS Numbers, we don't need to change it in multiple places. The response will just mirror whatever NHS number was requested by the client.
1 parent f28db27 commit 4b2254b

File tree

40 files changed

+87
-39
lines changed

40 files changed

+87
-39
lines changed

docker/wiremock/README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Patients - `migratestructuredrecord` endpoint
44

5+
Each scenario below can be retrieved by requesting the associated NHS Number specified.
6+
57
### Invalid/error responses
68
- [OperationOutcome - Invalid NHS Number](stubs/__files/operationOutcomeInvalidNHSNumber.json) 123456789, 960000001
79
- [OperationOutcome - Bad Request](stubs/__files/operationOutcomeBadRequest.json) 9600000005
@@ -11,7 +13,7 @@
1113
- [OperationOutcome - Invalid Resource](stubs/__files/operationOutcomeInvalidResource.json) 9600000003
1214
- [OperationOutcome - No Relationship](stubs/__files/operationOutcomeNoRelationship.json) 9600000010
1315
- [Bundle without Patient Resource](stubs/__files/malformedStructuredRecordMissingPatientResource.json) 2906543841
14-
- [OperationOutcome - Not Found](stubs/__files/operationOutcomePatientNotFound.json) 9600000009, also used as a fallback for any unrecognised NHS number.
16+
- [OperationOutcome - Not Found](stubs/__files/operationOutcomePatientNotFound.json) 9600000009
1517

1618
### Valid bundles
1719

@@ -44,4 +46,25 @@
4446
- PWTP7 [EMIS](stubs/__files/EMISPatientStructurede2eResponsePWTP7.json) 9726908744 [TPP](stubs/__files/TPPPatientStructuredRecordE2EPWTP7.json) 9726908833
4547
- PWTP9 [EMIS](stubs/__files/EMISPatientStructurede2eResponsePWTP9.json) 9726908752 [TPP](stubs/__files/TPPPatientStructuredRecordE2EPWTP9.json) 9726908841
4648
- PWTP10 [EMIS](stubs/__files/EMISPatientStructurede2eResponsePWTP10.json) 9726908760 [TPP](stubs/__files/TPPPatientStructuredRecordE2EPWTP10.json) 9726908868
47-
- PWTP11 [EMIS](stubs/__files/EMISPatientStructurede2eResponsePWTP11.json) 9726908779 [TPP](stubs/__files/TPPPatientStructuredRecordE2EPWTP11.json) 9726908876
49+
- PWTP11 [EMIS](stubs/__files/EMISPatientStructurede2eResponsePWTP11.json) 9726908779 [TPP](stubs/__files/TPPPatientStructuredRecordE2EPWTP11.json) 9726908876
50+
51+
52+
## Patients - `migratestructuredrecord` endpoint, unknown patient
53+
54+
The `migratestructuredrecord` endpoint will also respond to unknown NHS Numbers,
55+
by default returning a NOT FOUND response, but can also be set up to reply with
56+
a valid patient record.
57+
58+
### Changing the default record
59+
60+
To change the patient record returned to be [No Documents](stubs/__files/correctPatientNoDocsStructuredRecordResponse.json):
61+
62+
```shell
63+
curl --request PUT --data '{"state": "No Documents"}' http://localhost:8110/__admin/scenarios/migrateStructuredRecord/state
64+
```
65+
66+
To change the patient record returned to be NOT FOUND:
67+
68+
```shell
69+
curl --request PUT --data '{"state": "Started"}' http://localhost:8110/__admin/scenarios/migrateStructuredRecord/state
70+
```

docker/wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP10.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@
11751175
}
11761176
],
11771177
"system": "https://fhir.nhs.uk/Id/nhs-number",
1178-
"value": "9726908760"
1178+
"value": "{{jsonPath request.body '$.parameter[0].valueIdentifier.value'}}"
11791179
}
11801180
],
11811181
"name": [

docker/wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP11.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@
12561256
}
12571257
],
12581258
"system": "https://fhir.nhs.uk/Id/nhs-number",
1259-
"value": "9726908779"
1259+
"value": "{{jsonPath request.body '$.parameter[0].valueIdentifier.value'}}"
12601260
}
12611261
],
12621262
"name": [

docker/wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@
12041204
}
12051205
],
12061206
"system": "https://fhir.nhs.uk/Id/nhs-number",
1207-
"value": "9726908671"
1207+
"value": "{{jsonPath request.body '$.parameter[0].valueIdentifier.value'}}"
12081208
}
12091209
],
12101210
"name": [

docker/wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP3.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@
925925
}
926926
],
927927
"system": "https://fhir.nhs.uk/Id/nhs-number",
928-
"value": "9726908698"
928+
"value": "{{jsonPath request.body '$.parameter[0].valueIdentifier.value'}}"
929929
}
930930
],
931931
"name": [

docker/wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP4.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@
16401640
}
16411641
],
16421642
"system": "https://fhir.nhs.uk/Id/nhs-number",
1643-
"value": "9726908701"
1643+
"value": "{{jsonPath request.body '$.parameter[0].valueIdentifier.value'}}"
16441644
}
16451645
],
16461646
"name": [

docker/wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP5.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@
12211221
}
12221222
],
12231223
"system": "https://fhir.nhs.uk/Id/nhs-number",
1224-
"value": "9726908728"
1224+
"value": "{{jsonPath request.body '$.parameter[0].valueIdentifier.value'}}"
12251225
}
12261226
],
12271227
"name": [

docker/wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP6.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@
14371437
}
14381438
],
14391439
"system": "https://fhir.nhs.uk/Id/nhs-number",
1440-
"value": "9726908736"
1440+
"value": "{{jsonPath request.body '$.parameter[0].valueIdentifier.value'}}"
14411441
}
14421442
],
14431443
"name": [

docker/wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP7.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@
12531253
}
12541254
],
12551255
"system": "https://fhir.nhs.uk/Id/nhs-number",
1256-
"value": "9726908744"
1256+
"value": "{{jsonPath request.body '$.parameter[0].valueIdentifier.value'}}"
12571257
}
12581258
],
12591259
"name": [

docker/wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP9.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,7 @@
20822082
}
20832083
],
20842084
"system": "https://fhir.nhs.uk/Id/nhs-number",
2085-
"value": "9726908752"
2085+
"value": "{{jsonPath request.body '$.parameter[0].valueIdentifier.value'}}"
20862086
}
20872087
],
20882088
"name": [

0 commit comments

Comments
 (0)