alphagov / govuk-design-system-backlog

GOV.UK Design System Community Backlog
31 stars 2 forks source link

National Insurance numbers #54

Open govuk-design-system opened 6 years ago

govuk-design-system commented 6 years ago

Use this issue to discuss this pattern in the GOV.UK Design System.

DavDoh commented 3 years ago
National Insurance number feedback

Research indicated that some users were unsure of their National Insurance numbers. They liked the subtle addition of a Details component stating: "If you are unable to locate your National Insurance number, please refer to find your National Insurance number"

jeanesims commented 2 years ago

To improve the quality of data collected (but only if services have a user need for it...) is there any guidance that could be added to this pattern to help/encourage teams to also use back-end validation for NI numbers at the point they are collected, ie the service does a look up in the background to check an NI number is real, in addition to the existing on-screen validation? Also could this pattern be expanded (where there is a user need for it, and data protection allows it) to show teams why they might want to ask for an additional identifier so their service can do a back-end check to make sure an NI number is real and belongs to that person, ie DOB and NI number, or NI number and name? It might not mean they store that additional data, eg DOB, once the check has been done?

quantuminformation commented 1 year ago

It would be great to have a JavaScript regex for the following:

The NI Number must be 9 characters long with no spaces The first two characters must be alphabetical Characters three to eight must be numeric Character nine must be A, B, C, D, or a space ** The first character must not be D, F, I, Q, U, or V The second character must not be D, F, I, O, Q, U, or V The first two characters must not be combinations of GB, NK, TN, or ZZ (this includes the reverse of each combination, so BG, KN, and NT are also not valid) ex: AA123456A```

wilsond-gds commented 1 year ago

Someone has posted what seems to be a working regex for National Insurance numbers on stack overflow. Remove the JavaScript specific start and end characters, and

(?!BG)(?!GB)(?!NK)(?!KN)(?!TN)(?!NT)(?!ZZ)(?:[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z])(?:\s*\d\s*){6}([A-D]|\s)

works when tested against real NI numbers at regexr.com

joelanman commented 1 year ago

visualised: https://regexper.com/#%28%3F!BG%29%28%3F!GB%29%28%3F!NK%29%28%3F!KN%29%28%3F!TN%29%28%3F!NT%29%28%3F!ZZ%29%28%3F%3A%5BA-CEGHJ-PR-TW-Z%5D%5BA-CEGHJ-NPR-TW-Z%5D%29%28%3F%3A%5Cs*%5Cd%5Cs*%29%7B6%7D%28%5BA-D%5D%7C%5Cs%29

edwardhorsford commented 1 year ago

One from Alphagov, via @joelanman

object NinoValidator {

  final val ninoRegex = "^[A-CEGHJ-PR-TW-Za-ceghj-pr-tw-z]{1}[A-CEGHJ-NPR-TW-Za-ceghj-npr-tw-z]{1}[0-9]{6}[A-DFMa-dfm]{0,1}$"

  def isValid(nino:String) = {
    nino.toUpperCase.replaceAll("[\\s|\\-]", "").matches(ninoRegex)
  }
}

This is doing nice things like pre-normalising for casing and common punctuation.

jeanesims commented 1 year ago

Hi - it's quick and easy for a user to find their National Insurance number by using the HMRC app or by going into their Personal Tax Account. Not all users will want to look for it offline. Could the hint text for this pattern be updated to signpost people to the app, for example?

image

![Uploading image.png…]()

abbott567 commented 4 months ago
image

Off the back of observing help text breaking a NINO over two lines in the design system, I'm wondering if when referencing NINOs there should be a recommendation to use a non breaking space so the entire NINO wraps as a single line item, as some people with cognitive impairments can struggle to recognise patterns and word shapes when they're broken over multiple lines, making comparisons difficult.

In the example it shows the NINO as:

QQ 12 34
56 C

But in reality, it would always be printed on documents on a single line. Like:

QQ 12 34 56 C

It would be achievable in digital services using a non-breaking-space, like:

QQ 12 34 56 C

It could even be supported with a Nunjucks filter or something similar to make it easier for teams. Something like:

{{ data.nino | formatNino }}

Wondering if this has came up before or discussed?