Skip to content

Commit 76790cf

Browse files
committed
Update mesh docs with more testing details
1 parent 4f71a3f commit 76790cf

File tree

1 file changed

+68
-5
lines changed

1 file changed

+68
-5
lines changed

docs/mesh.md

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,70 @@ bin/rails mesh:validate_mailbox # Validate MESH mailbox to let MESH know Ma
139139
## DPS (Data Processing Service) Export
140140

141141
Upstream reporting to other NHSE services is done by sending vaccination events
142-
to DPS via MESH. Here's an example of testing the MESH integration using the DPS
143-
export functionality:
142+
to DPS via MESH. Here's an example of testing the MESH integration by triggering
143+
the jobs manually:
144+
145+
1. Clear out any existing DPSExports for the campaign you want to test with:
146+
```
147+
[1] pry(main)> Campaign.find(1).dps_exports.destroy_all
148+
```
149+
2. Trigger the job to send vaccination exports to DPS:
150+
```
151+
[2] pry(main)> DPSExportJob.perform_now
152+
Performing DPSExportJob (Job ID: 15ff78e8-3d8e-42c8-af1a-086ab4e77ff7) from GoodJob(default)
153+
...
154+
DPS export (17) for campaign (1) sent: 202 - {"message_id":"3F5A532496B341798B698FD44A0155F7"}
155+
Performed DPSExportJob (Job ID: 15ff78e8-3d8e-42c8-af1a-086ab4e77ff7) from GoodJob(default) in 332.56ms
156+
```
157+
3. Confirm a DPSExport record was created:
158+
```
159+
[3] pry(main)> Campaign.find(1).dps_exports
160+
=> [#<DPSExport:0x000000014d37cd20
161+
id: 17,
162+
message_id: "3F5A532496B341798B698FD44A0155F7",
163+
status: "accepted",
164+
filename: "Vaccinations-HPV-2024-08-23.csv",
165+
sent_at: nil,
166+
campaign_id: 1,
167+
created_at: Fri, 23 Aug 2024 16:42:29.679686000 BST +01:00,
168+
updated_at: Fri, 23 Aug 2024 16:42:29.742197000 BST +01:00>]
169+
```
170+
4. Confirm the message has arrived using a Rake task:
171+
```
172+
$ MAVIS__MESH__MAILBOX=X26ABC3 MAVIS__MESH__PASSWORD=password rails mesh:check_inbox
173+
{"messages":["3F5A532496B341798B698FD44A0155F7"],"links":{"self":"/messageexchange/X26ABC3/inbox"},"approx_inbox_count":1}
174+
```
175+
5. (Optional) Confirm the export file's contents:
176+
```
177+
$ MAVIS__MESH__MAILBOX=X26ABC3 MAVIS__MESH__PASSWORD=password rails mesh:check_inbox
178+
"NHS_NUMBER"|"PERSON_FORENAME"|"PERSON_SURNAME"|"PERSON_DOB"|"PERSON_GENDER_CODE"|"PERSON_POSTCODE"|"DATE_AND_TIME"|"SITE_CODE"|"SITE_CODE_TYPE_URI"|"UNIQUE_ID"|"UNIQUE_ID_URI"|"ACTION_FLAG"|"PERFORMING_PROFESSIONAL_FORENAME"|"PERFORMING_PROFESSIONAL_SURNAME"|"RECORDED_DATE"|"PRIMARY_SOURCE"|"VACCINATION_PROCEDURE_CODE"|"VACCINATION_PROCEDURE_TERM"|"DOSE_SEQUENCE"|"VACCINE_PRODUCT_CODE"|"VACCINE_PRODUCT_TERM"|"VACCINE_MANUFACTURER"|"BATCH_NUMBER"|"EXPIRY_DATE"|"SITE_OF_VACCINATION_CODE"|"SITE_OF_VACCINATION_TERM"|"ROUTE_OF_VACCINATION_CODE"|"ROUTE_OF_VACCINATION_TERM"|"DOSE_AMOUNT"|"DOSE_UNIT_CODE"|"DOSE_UNIT_TERM"|"INDICATION_CODE"|"LOCATION_CODE"|"LOCATION_CODE_TYPE_URI"
179+
"9992686766"|"Brenton"|"Waters"|"20120818"|"0"|"UC0W 0JL"|"20230609T00000000"|"U1"|"https://fhir.nhs.uk/Id/ods-organization-code"|"496e37d8-d1ab-4e12-a3a3-9c2e136a0504"|"https://manage-vaccinations-in-schools.nhs.uk/vaccination-records"|"new"|""|""|"20240821"|"TRUE"|"761841000"|"Administration of vaccine product containing only Human papillomavirus antigen (procedure)"|"1"|"33493111000001108"|"Gardasil 9 vaccine suspension for injection 0.5ml pre-filled syringes (Merck Sharp & Dohme (UK) Ltd) (product)"|"Merck Sharp & Dohme"|"CD5472"|"20240930"|"368208006"|"Structure of left upper arm (body structure)"|"78421000"|"Intramuscular route (qualifier value)"|"0.5"|"258773002"|"Milliliter (qualifier value)"|""|"123456"|"https://fhir.hl7.org.uk/Id/urn-school-number"
180+
...
181+
```
182+
6. Acknowledeg the message using a Rake task:
183+
```
184+
$ MAVIS__MESH__MAILBOX=X26ABC3 MAVIS__MESH__PASSWORD=password rails mesh:ack_message[3F5A532496B341798B698FD44A0155F7]
185+
200 - Message acknowledged
186+
```
187+
7. Trigger the track message job, and note that the DPSExport's status is changed:
188+
```
189+
[4] pry(main)> MESHTrackDPSExportsJob.perform_now
190+
Performing MESHTrackDPSExportsJob (Job ID: c7d99e05-1f67-4e76-8140-473a38a79090) from GoodJob(mesh)
191+
...
192+
Performed MESHTrackDPSExportsJob (Job ID: c7d99e05-1f67-4e76-8140-473a38a79090) from GoodJob(mesh) in 50.97ms
193+
↳ (pry):3:in `__pry__'
194+
=> [#<DPSExport:0x000000014d2b0158
195+
id: 17,
196+
message_id: "3F5A532496B341798B698FD44A0155F7",
197+
status: "acknowledged",
198+
filename: "Vaccinations-HPV-2024-08-23.csv",
199+
sent_at: nil,
200+
campaign_id: 1,
201+
created_at: Fri, 23 Aug 2024 16:42:29.679686000 BST +01:00,
202+
updated_at: Fri, 23 Aug 2024 16:48:54.371976000 BST +01:00>]
203+
```
204+
205+
This can also be tested directly from the cmdline:
144206

145207
```
146208
$ rails mesh:dps_export
@@ -157,14 +219,15 @@ $ MAVIS__MESH__MAILBOX=X26ABC3 MAVIS__MESH__PASSWORD=password rails mesh:check_i
157219
$ MAVIS__MESH__MAILBOX=X26ABC3 MAVIS__MESH__PASSWORD=password rails mesh:get_message[B18FA3D33F994615988FE5AFA20143D7]
158220
"NHS_NUMBER"|"PERSON_FORENAME"|"PERSON_SURNAME"|"PERSON_DOB"|"PERSON_GENDER_CODE"|"PERSON_POSTCODE"|"DATE_AND_TIME"|"SITE_CODE"|"SITE_CODE_TYPE_URI"|"UNIQUE_ID"|"UNIQUE_ID_URI"|"ACTION_FLAG"|"PERFORMING_PROFESSIONAL_FORENAME"|"PERFORMING_PROFESSIONAL_SURNAME"|"RECORDED_DATE"|"PRIMARY_SOURCE"|"VACCINATION_PROCEDURE_CODE"|"VACCINATION_PROCEDURE_TERM"|"DOSE_SEQUENCE"|"VACCINE_PRODUCT_CODE"|"VACCINE_PRODUCT_TERM"|"VACCINE_MANUFACTURER"|"BATCH_NUMBER"|"EXPIRY_DATE"|"SITE_OF_VACCINATION_CODE"|"SITE_OF_VACCINATION_TERM"|"ROUTE_OF_VACCINATION_CODE"|"ROUTE_OF_VACCINATION_TERM"|"DOSE_AMOUNT"|"DOSE_UNIT_CODE"|"DOSE_UNIT_TERM"|"INDICATION_CODE"|"LOCATION_CODE"|"LOCATION_CODE_TYPE_URI"
159221
"9992686766"|"Brenton"|"Waters"|"20120818"|"0"|"UC0W 0JL"|"20230609T00000000"|"U1"|"https://fhir.nhs.uk/Id/ods-organization-code"|"496e37d8-d1ab-4e12-a3a3-9c2e136a0504"|"https://manage-vaccinations-in-schools.nhs.uk/vaccination-records"|"new"|""|""|"20240821"|"TRUE"|"761841000"|"Administration of vaccine product containing only Human papillomavirus antigen (procedure)"|"1"|"33493111000001108"|"Gardasil 9 vaccine suspension for injection 0.5ml pre-filled syringes (Merck Sharp & Dohme (UK) Ltd) (product)"|"Merck Sharp & Dohme"|"CD5472"|"20240930"|"368208006"|"Structure of left upper arm (body structure)"|"78421000"|"Intramuscular route (qualifier value)"|"0.5"|"258773002"|"Milliliter (qualifier value)"|""|"123456"|"https://fhir.hl7.org.uk/Id/urn-school-number"
160-
"9993218626"|"Cameron"|"Hauck"|"20120107"|"0"|"H3A 7BX"|"20230609T00000000"|"U1"|"https://fhir.nhs.uk/Id/ods-organization-code"|"d7199929-9af5-4b37-b2ba-831da7680d30"|"https://manage-vaccinations-in-schools.nhs.uk/vaccination-records"|"new"|""|""|"20240821"|"TRUE"|"761841000"|"Administration of vaccine product containing only Human papillomavirus antigen (procedure)"|"1"|"33493111000001108"|"Gardasil 9 vaccine suspension for injection 0.5ml pre-filled syringes (Merck Sharp & Dohme (UK) Ltd) (product)"|"Merck Sharp & Dohme"|"CD5472"|"20240930"|"368208006"|"Structure of left upper arm (body structure)"|"78421000"|"Intramuscular route (qualifier value)"|"0.5"|"258773002"|"Milliliter (qualifier value)"|""|"123456"|"https://fhir.hl7.org.uk/Id/urn-school-number"
161-
"9996745082"|"Lenard"|"Monahan"|"20120211"|"0"|"NA4 3AJ"|"20230609T00000000"|"U1"|"https://fhir.nhs.uk/Id/ods-organization-code"|"2004af84-c9e3-47e2-819f-b4010ddc7649"|"https://manage-vaccinations-in-schools.nhs.uk/vaccination-records"|"new"|""|""|"20240821"|"TRUE"|"761841000"|"Administration of vaccine product containing only Human papillomavirus antigen (procedure)"|"1"|"33493111000001108"|"Gardasil 9 vaccine suspension for injection 0.5ml pre-filled syringes (Merck Sharp & Dohme (UK) Ltd) (product)"|"Merck Sharp & Dohme"|"CD5472"|"20240930"|"368208006"|"Structure of left upper arm (body structure)"|"78421000"|"Intramuscular route (qualifier value)"|"0.5"|"258773002"|"Milliliter (qualifier value)"|""|"123456"|"https://fhir.hl7.org.uk/Id/urn-school-number"
162-
"9994219804"|"Dion"|"Collins"|"20120109"|"0"|"IT9 4ZN"|"20230609T00000000"|"U1"|"https://fhir.nhs.uk/Id/ods-organization-code"|"d19166d5-d150-4a57-89b1-5e7bc4658776"|"https://manage-vaccinations-in-schools.nhs.uk/vaccination-records"|"new"|""|""|"20240821"|"TRUE"|"761841000"|"Administration of vaccine product containing only Human papillomavirus antigen (procedure)"|"1"|"33493111000001108"|"Gardasil 9 vaccine suspension for injection 0.5ml pre-filled syringes (Merck Sharp & Dohme (UK) Ltd) (product)"|"Merck Sharp & Dohme"|"CD5472"|"20240930"|"368208006"|"Structure of left upper arm (body structure)"|"78421000"|"Intramuscular route (qualifier value)"|"0.5"|"258773002"|"Milliliter (qualifier value)"|""|"123456"|"https://fhir.hl7.org.uk/Id/urn-school-number"
222+
...
163223
164224
# Acknowledge the message to remove it from the inbox
165225
$ MAVIS__MESH__MAILBOX=X26ABC3 MAVIS__MESH__PASSWORD=password rails mesh:ack_message[B18FA3D33F994615988FE5AFA20143D7]
166226
```
167227

228+
Mavis' code paths can also be tested by running the jobs through the console:
229+
230+
168231
## Additional resources
169232

170233
- [Message Exchange for Social Care and Health (MESH) API - NHS England Digital](https://digital.nhs.uk/developer/api-catalogue/message-exchange-for-social-care-and-health-api#overview--end-to-end-process-to-integrate-with-mesh-api)

0 commit comments

Comments
 (0)