Skip to content

Commit 633838e

Browse files
authored
Update import format help documentation (#3251)
This updates the help documentation shown when importing a file to make sure it's up to date and accurate with the validation that exists as it is currently in the service.
2 parents 8004e36 + 9132768 commit 633838e

File tree

1 file changed

+81
-77
lines changed

1 file changed

+81
-77
lines changed

app/components/app_import_format_details_component.rb

Lines changed: 81 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def immunisation_import_columns
6868
{
6969
name: "ORGANISATION_CODE",
7070
notes:
71-
"Optional, must be a valid #{link_to("ODS code", "https://odsportal.digital.nhs.uk/")}"
71+
"Optional, must be a valid #{link_to("ODS code", "https://odsportal.digital.nhs.uk/")}."
7272
},
7373
{
7474
name: "SCHOOL_URN",
@@ -79,80 +79,47 @@ def immunisation_import_columns
7979
},
8080
{
8181
name: "SCHOOL_NAME",
82-
notes: "Required if #{tag.i("SCHOOL_URN")} is #{tag.i("888888")}"
82+
notes: "Required if #{tag.code("SCHOOL_URN")} is #{tag.i("888888")}."
8383
},
84-
{ name: "NHS_NUMBER", notes: "Optional, must be 10 digits and numeric" },
84+
{ name: "NHS_NUMBER", notes: "Optional, must be 10 digits and numeric." },
8585
{ name: "PERSON_FORENAME", notes: tag.strong("Required") },
8686
{ name: "PERSON_SURNAME", notes: tag.strong("Required") },
8787
{
8888
name: "PERSON_DOB",
8989
notes:
9090
"#{tag.strong("Required")}, must use either #{tag.i("YYYYMMDD")} or " \
91-
"#{tag.i("DD/MM/YYYY")} format"
91+
"#{tag.i("DD/MM/YYYY")} format."
9292
},
9393
{
9494
name: "PERSON_GENDER_CODE",
9595
notes:
9696
"#{tag.strong("Required")}, must be #{tag.i("Not known")}, " \
97-
"#{tag.i("Male")}, #{tag.i("Female")}, #{tag.i("Not specified")}"
97+
"#{tag.i("Male")}, #{tag.i("Female")}, #{tag.i("Not specified")}."
9898
},
9999
{
100100
name: "PERSON_POSTCODE",
101101
notes:
102-
"#{tag.strong("Required")}, must be formatted as a valid postcode"
102+
"#{tag.strong("Required")}, must be formatted as a valid postcode."
103103
},
104104
{
105105
name: "DATE_OF_VACCINATION",
106106
notes:
107107
"#{tag.strong("Required")}, must use either #{tag.i("YYYYMMDD")} or " \
108-
"#{tag.i("DD/MM/YYYY")} format"
108+
"#{tag.i("DD/MM/YYYY")} format."
109109
},
110110
{
111111
name: "TIME_OF_VACCINATION",
112-
notes: "Optional, must use #{tag.i("HH:MM:SS")} format"
113-
},
114-
{
115-
name: "PROGRAMME",
116-
notes:
117-
"#{tag.strong("Required")}, must be " +
118-
organisation
119-
.programmes
120-
.flat_map(&:import_names)
121-
.map { tag.i(it) }
122-
.to_sentence(
123-
last_word_connector: ", or ",
124-
two_words_connector: " or "
125-
)
126-
},
127-
{
128-
name: "VACCINE_GIVEN",
129-
notes:
130-
"Optional, must be #{
131-
organisation
132-
.vaccines
133-
.pluck(:nivs_name)
134-
.map { tag.i(it) }
135-
.to_sentence(
136-
last_word_connector: ", or ",
137-
two_words_connector: " or "
138-
)
139-
}"
140-
},
141-
{ name: "BATCH_NUMBER", notes: "Optional" },
142-
{
143-
name: "BATCH_EXPIRY_DATE",
144-
notes:
145-
"Optional, must use " \
146-
"either #{tag.i("YYYYMMDD")} or #{tag.i("DD/MM/YYYY")} format"
112+
notes: "Optional, must use #{tag.i("HH:MM:SS")} format."
147113
},
148114
{
149115
name: "VACCINATED",
150116
notes:
151-
"Optional, must be #{tag.i("Y")} or #{tag.i("N")}. If omitted, " \
152-
"#{tag.i("Y")} is assumed."
117+
"Required, must be #{tag.i("Y")} or #{tag.i("N")}. " \
118+
"Can be omitted if #{tag.code("VACCINE_GIVEN")} is provided."
153119
}
154-
] + anatomical_site + reason_not_vaccinated_and_notes + dose_sequence +
155-
care_setting + performing_professional
120+
] + vaccine_and_batch + programme + anatomical_site +
121+
reason_not_vaccinated_and_notes + dose_sequence + care_setting +
122+
performing_professional
156123
end
157124

158125
def child_columns
@@ -164,7 +131,7 @@ def child_columns
164131
{
165132
name: "CHILD_DATE_OF_BIRTH",
166133
notes:
167-
"#{tag.strong("Required")}, must use #{tag.i("DD/MM/YYYY")} or #{tag.i("YYYY-MM-DD")} format"
134+
"#{tag.strong("Required")}, must use #{tag.i("DD/MM/YYYY")} or #{tag.i("YYYY-MM-DD")} format."
168135
},
169136
{
170137
name: "CHILD_YEAR_GROUP",
@@ -176,17 +143,17 @@ def child_columns
176143
{
177144
name: "CHILD_REGISTRATION",
178145
notes:
179-
"Optional, the child’s registration group, for example #{tag.i("8T5")}"
146+
"Optional, the child’s registration group, for example #{tag.i("8T5")}."
180147
},
181148
{
182149
name: "CHILD_NHS_NUMBER",
183-
notes: "Optional, must be 10 digits and numeric"
150+
notes: "Optional, must be 10 digits and numeric."
184151
},
185152
{
186153
name: "CHILD_GENDER",
187154
notes:
188155
"Optional, must be one of: #{tag.i("Male")}, #{tag.i("Female")}, " \
189-
"#{tag.i("Not known")} or #{tag.i("Not specified")}"
156+
"#{tag.i("Not known")} or #{tag.i("Not specified")}."
190157
},
191158
{ name: "CHILD_ADDRESS_LINE_1", notes: "Optional" },
192159
{ name: "CHILD_ADDRESS_LINE_2", notes: "Optional" },
@@ -202,7 +169,7 @@ def parent_columns
202169
name: "#{prefix}_RELATIONSHIP",
203170
notes:
204171
"Optional, must be one of: #{tag.i("Mum")}, #{tag.i("Dad")} or " \
205-
"#{tag.i("Guardian")}"
172+
"#{tag.i("Guardian")}."
206173
},
207174
{
208175
name: "#{prefix}_EMAIL",
@@ -216,21 +183,48 @@ def parent_columns
216183
end
217184
end
218185

219-
def reason_not_vaccinated_and_notes
220-
reasons = ImmunisationImportRow::REASONS.keys.sort.map { tag.i(_1) }
221-
reasons_sentence =
222-
reasons.to_sentence(
223-
last_word_connector: " or ",
186+
def programme
187+
programmes =
188+
organisation.programmes.flat_map(&:import_names).map { tag.i(it) }
189+
190+
programmes_sentence =
191+
programmes.to_sentence(
192+
last_word_connector: ", or ",
224193
two_words_connector: " or "
225194
)
226195

227196
[
228197
{
229-
name: "REASON_NOT_VACCINATED",
230-
notes:
231-
"Required if #{tag.code("VACCINATED")} is #{tag.i("N")}, must be #{reasons_sentence}"
198+
name: "PROGRAMME",
199+
notes: "#{tag.strong("Required")}, must be #{programmes_sentence}."
200+
}
201+
]
202+
end
203+
204+
def vaccine_and_batch
205+
vaccines = organisation.vaccines.pluck(:nivs_name).map { tag.i(it) }
206+
207+
vaccines_sentence =
208+
vaccines.to_sentence(
209+
last_word_connector: ", or ",
210+
two_words_connector: " or "
211+
)
212+
213+
[
214+
{
215+
name: "VACCINE_GIVEN",
216+
notes: "Optional, must be #{vaccines_sentence}."
232217
},
233-
{ name: "NOTES", notes: "Optional" }
218+
{
219+
name: "BATCH_NUMBER",
220+
notes: "Required if #{tag.code("BATCH_EXPIRY_DATE")} is provided."
221+
},
222+
{
223+
name: "BATCH_EXPIRY_DATE",
224+
notes:
225+
"Required if #{tag.code("BATCH_NUMBER")} is provided, must use " \
226+
"either #{tag.i("YYYYMMDD")} or #{tag.i("DD/MM/YYYY")} format."
227+
}
234228
]
235229
end
236230

@@ -247,13 +241,30 @@ def anatomical_site
247241
{
248242
name: "ANATOMICAL_SITE",
249243
notes:
250-
"Required if #{tag.code("VACCINATED")} is #{tag.i("Y")}. It must be " \
251-
"appropriate for the vaccine delivery method and be one of: " \
252-
"#{site_sentence}"
244+
"Optional, if provided must be appropriate for the vaccine delivery method " \
245+
"and be one of: #{site_sentence}."
253246
}
254247
]
255248
end
256249

250+
def reason_not_vaccinated_and_notes
251+
reasons = ImmunisationImportRow::REASONS.keys.sort.map { tag.i(_1) }
252+
reasons_sentence =
253+
reasons.to_sentence(
254+
last_word_connector: " or ",
255+
two_words_connector: " or "
256+
)
257+
258+
[
259+
{
260+
name: "REASON_NOT_VACCINATED",
261+
notes:
262+
"Required if #{tag.code("VACCINATED")} is #{tag.i("N")}, must be #{reasons_sentence}."
263+
},
264+
{ name: "NOTES", notes: "Optional" }
265+
]
266+
end
267+
257268
def dose_sequence
258269
special_values =
259270
ImmunisationImportRow::DOSE_SEQUENCES
@@ -272,7 +283,7 @@ def dose_sequence
272283
[
273284
{
274285
name: "DOSE_SEQUENCE",
275-
notes: "Optional, must be a number or #{special_values_sentence}"
286+
notes: "Optional, must be a number or #{special_values_sentence}."
276287
}
277288
]
278289
end
@@ -282,32 +293,25 @@ def care_setting
282293
{
283294
name: "CARE_SETTING",
284295
notes:
285-
"Optional, must be #{tag.i("1")} (school) or #{tag.i("2")} (clinic)"
296+
"Optional, must be #{tag.i("1")} (school) or #{tag.i("2")} (clinic)."
286297
},
287298
{
288299
name: "CLINIC_NAME",
289300
notes:
290301
"Required if #{tag.code("CARE_SETTING")} is #{tag.i("2")}, must be " \
291-
"the name of a community clinic location"
302+
"the name of a community clinic location."
292303
}
293304
]
294305
end
295306

296307
def performing_professional
297308
[
298-
{ name: "PERFORMING_PROFESSIONAL_EMAIL", notes: tag.strong("Required") },
299309
{
300-
name: "PERFORMING_PROFESSIONAL_FORENAME",
301-
notes:
302-
"Required for uploading historical vaccination records unless " \
303-
"#{tag.code("PERFORMING_PROFESSIONAL_EMAIL")} is provided"
310+
name: "PERFORMING_PROFESSIONAL_EMAIL",
311+
notes: "Required if uploading offline vaccination records."
304312
},
305-
{
306-
name: "PERFORMING_PROFESSIONAL_SURNAME",
307-
notes:
308-
"Required for uploading historical vaccination records unless " \
309-
"#{tag.code("PERFORMING_PROFESSIONAL_EMAIL")} is provided"
310-
}
313+
{ name: "PERFORMING_PROFESSIONAL_FORENAME", notes: "Optional" },
314+
{ name: "PERFORMING_PROFESSIONAL_SURNAME", notes: "Optional" }
311315
]
312316
end
313317
end

0 commit comments

Comments
 (0)