rOpenGov / sweidnumbr

R package for Structural handling of identity numbers used in the swedish administration such as personal identity numbers (personnummer) and organizational identity numbers (organisationsnummer).
https://ropengov.github.io/sweidnumbr/
Other
8 stars 3 forks source link

Samordningsnummer/PIN for foreigners? #120

Closed k8oylos closed 3 years ago

k8oylos commented 3 years ago

Hi! I am trying to access a list of PIN numbers that include foreigners. So the list includes number of the type 19541111-111K All these are read as NA in sweidnumbr.

a <- c ("19541111-111K","19541111-1112" ) example_pin <- a example_pin <- as.pin(example_pin) Warning message: In as.pin.character(example_pin) : Erroneous pin(s) (set to NA).

example_pin [1] NA "195411111112" Personal identity number(s)>

MansMeg commented 3 years ago

Ok. It looks strange to me (the use of K). It might be a new thing. Do you have a reference on how this is used somewher so it can be included as a correct format?

eribul commented 3 years ago

Are sure those are "samordningsnummer" and not "reservnummer" as used in health care (https://sv.wikipedia.org/wiki/Reservnummer)? The problem with reservnummer is that they are totally non-standardized. To use a real birth date and a character (such as K) in the last position is recommended by the IRS. This is only a recommendation, however, and there is really no limit to the immigration of what numbers people can assign in practice. Also, the same individual might have multiple reservnummer and the same reservnummer might be used by multiple individuals.

It would be interesting to hear more about your use case, since this is a problem where I work as well (where we build IT-systems for patient data). It is an ongoing debate here how to handle those numbers (exclude them for practical reasons or include somehow in order not to risk any discrimination). It seems those numbers are used for example in the Swedish National Patient Register (which is a mandatory register, which can not exclude any patients). I am not sure how those are later used in research, however. I suspect they are just excluded since they can not be used for data linkage to other sources etc (and that seems to be the only reason why you would need those numbers to begin with).

MansMeg commented 3 years ago

No, this cannot be "samordningsnummer", they do not add letters as the last character. The just add 60 to the date.

k8oylos commented 3 years ago

Thank you for your quick reply

i guess you are actually right, didn't know about reserve numbers.

This is a list of some thousand patients treated at a hospital, whereas half are coming for a specific treatment from Norway or elsewhere. I have treated them assuming that the first 6 digits represent birth dates (they seem to be give correct resuts in the meaning that ages for disease onset for example are as expected, even if i can not check exact dates) but i had no idea that they can be random numbers. I came upon your library when trying to extract birth dates/gender from the list, and then i came with the NAs. So there is no correlation with sex and country of origin, in the same way a persnonnummer can show sex and landstig?

MansMeg commented 3 years ago

I close this issue since it does not seem to be an error in the sweidnmbr package. Although, thanks for raising the issue. Hopefully this discussion might help someone else!