Closed buren closed 7 years ago
Good point. We should add this functionality.
2 aug. 2017 kl. 13:20 skrev Jacob Burenstam notifications@github.com:
This lib does unfortunately not support coordination number (a.k.a samordningsnummer, a.k.a "temporary personnummer"), causing false negatives for valid inputs.
Coordination numbers have 60 added to the day, see https://sv.wikipedia.org/wiki/Samordningsnummer.
Test case that can be added to test/persnr.test.js:
it('should classify valid coordination numbers (a.k.a samordningsnummer) as valid', function(){ expect((new Pernr('010161-4389')).isValid()).to.equal(true); expect((new Pernr('010161-4405')).isValid()).to.equal(true); expect((new Pernr('010161-4421')).isValid()).to.equal(true); }); โ You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
merged and npm published
Awesome @arokor ๐
@arokor Great that you added support for samordningsnummer! I see that this issue is closed but thought I should ask: how about reservnummer and skyddad identitet?
For "skyddad identitet" it seems like you're given a new, valid, "personnummer". See https://sv.wikipedia.org/wiki/Skyddad_identitet.
I had no idea that "Reservnummer" even existed ๐ certainly makes it an interesting edge case in terms of a library like this. After reading through https://sv.wikipedia.org/wiki/Reservnummer there seems to be no formalized standard just a few recommendations.
In https://sv.wikipedia.org/wiki/Reservnummer#Format they write:
Socialstyrelsen hittade tre olika varianter av reservnummer i patientregistret fรถr 2008 [...] [Roughly translated to] Socialstyrelsen found three variants of "reservnummer" i the patient registry for 2008 [...]
So it seems like there is really no, stable, way of validating that.
Perhaps just mentioning those two cases in the README could reasonable.
no, stable, way of validating [reservnummer]/.../Perhaps just mentioning those two cases in the README could reasonable.
Yeah. That might be nice.
You could be right regarding skyddad identitet although I seem to remember seeing a wierd format on a patient chart like SKYDDAD-IDENTITET-XXXX
although that might be post-processing. Nevermind.
Interesting. I had no idea that "reservnummer" existed. Since by definition a reservnummer isn't a valid personnummer they should be validated as invalid. We could add an isReservnummer method though that would return true if the first 6 chars is a valid date and any of the last 4 chars contain a character which would detect most reservnummer cases but probably not all
Added this to the README of a Ruby implementation that I've contributed to before: https://github.com/c7/personnummer#note-on-reservnummer.
Seemed like the "best" approach. The risk of implementing isReservnummer
is that people might think/believe/hope that it handles all cases (which is clearly impossible, since there are only guidelines/recommendations for the format and no requirements).
That makes sense. Let's add a note to the readme. Do you want to do it or should I?
@arokor, @karlpokus added note to README https://github.com/arokor/pernr/pull/3
This lib does unfortunately not support coordination number (a.k.a samordningsnummer, a.k.a "temporary personnummer"), causing false negatives for valid inputs.
Coordination numbers have 60 added to the day, see https://sv.wikipedia.org/wiki/Samordningsnummer.
Test case that can be added to
test/persnr.test.js
: