Skip to content

Accept South Korean RRNs given out since October 2020 - #530

Open
wonjangcloud9 wants to merge 1 commit into
arthurdejong:masterfrom
wonjangcloud9:kr-rrn-random-digits
Open

wonjangcloud9 wants to merge 1 commit into
arthurdejong:masterfrom
wonjangcloud9:kr-rrn-random-digits

Conversation

@wonjangcloud9

Copy link
Copy Markdown

Since 2020-10-05, a newly assigned resident registration number (a newborn's, or one changed after a leak) has six random digits after the seventh digit: the place of birth, serial number and check digit were dropped (Seoul Shinmun, reporting the Ministry of the Interior and Safety plan; the Enforcement Rule of the Resident Registration Act was amended on 2020-10-05; the Wikipedia article also notes that these digits are random after October 2020). kr.rrn.validate() still requires the place of birth to be at most 96 and the check digit to match, so it rejects most numbers of children born since then. Out of 100,000 numbers built that way for birth dates in 2021-2025, 9.7% pass on master (87.3% InvalidChecksum, 3.0% InvalidComponent).

The number itself does not say when it was given out. This skips the place of birth and check digit checks for dates of birth from 2020-09-05 on, since a birth has to be reported within a month. Older numbers are validated as before. Numbers changed after 2020-10-05 for people born earlier also have random digits and are still rejected; I left those out because accepting them would mean dropping the check digit for everyone.

New doctests cover a 2021 number with a "place of birth" of 99 and a wrong check digit, the 2020-09-05 boundary on both sides, and an invalid 2021 date of birth.

The full test suite passes with 100% coverage.

🤖 Generated with Claude Code

Since 2020-10-05 newly assigned resident registration numbers have six
random digits after the seventh digit instead of a place of birth,
serial number and check digit. The place of birth and check digit
checks rejected about 90% of the numbers of children born since then.

The number does not say when it was given out, so skip these checks
for dates of birth from 2020-09-05 on (a birth has to be reported
within a month).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant