{"id":"uk-nhs-number-validate","version":"1.0.0","description":"Validate a 10-digit NHS number's modulus 11 check digit (NHS Data Dictionary); 11 minus remainder = 10 is never valid.","supported_operations":["validate an nhs number","check digit for a uk nhs number","is this nhs number valid","verify a patient's nhs number modulus 11","nhs number checksum check","בדיקת מספר NHS בריטי"],"unsupported_operations":["a live Personal Demographics Service (PDS) lookup","validating a Community Health Index (CHI) or Health and Care Number (H&C number), the Scottish/Welsh schemes","stripping hyphens or other separators (only U+0020 spaces are removed)"],"semantics":["normalized = nhs_number with every U+0020 SPACE removed (the conventional 3-3-4 grouping); no other characters are stripped. normalized.length != 10 returns reason wrong_length; length 10 but not all-digit returns reason invalid_character; both leave normalized/check_digit null.","check_digit = normalized[9], populated once length and charset pass.","Weighted sum over the first 9 digits: weight = [10, 9, 8, 7, 6, 5, 4, 3, 2]. remainder = sum mod 11; total = 11 - remainder.","If total == 11, expected check digit is 0. If total == 10, the number can never be valid: reason check_digit_invalid, regardless of the actual tenth digit (distinct from an ordinary mismatch, per the NHS Data Dictionary's own rule). Otherwise expected is total, compared to check_digit for reason check_digit_mismatch."],"limits":{"max_nhs_number_bytes":24},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["nhs_number"],"properties":{"nhs_number":{"type":"string","minLength":1,"maxLength":24}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","normalized","check_digit"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"wrong_length","invalid_character","check_digit_invalid","check_digit_mismatch"]},"normalized":{"type":["string","null"],"pattern":"^[0-9]{10}$"},"check_digit":{"type":["string","null"],"pattern":"^[0-9]$"}}},"examples":[{"input":{"nhs_number":"943 476 5919"},"output":{"valid":true,"reason":null,"normalized":"9434765919","check_digit":"9"}},{"input":{"nhs_number":"9434765960"},"output":{"valid":false,"reason":"check_digit_invalid","normalized":"9434765960","check_digit":"0"}},{"input":{"nhs_number":"943476591"},"output":{"valid":false,"reason":"wrong_length","normalized":null,"check_digit":null}}],"execute_url":"/v1/tools/uk-nhs-number-validate/versions/1.0.0/execute"}