Ranking ID

Help, problems, suggestions about Waterski Scoring software
villep
Posts: 50
Joined: Mon May 23, 2005 10:04 pm
Location: Sweden
Contact:

Ranking ID

Post by villep »

What is the algorithm used for the check digit of the ranking id?

In Sweden we are planning to generate new ids based on our old 4 digit licence code.
If I understand right the format of the ranking id is
* Country code
* Gender 1/2 (M/F)
* Year of birth (2 digit)
* National number4 or 5 digits
* Check digit

Example of code for a male born 1942 and national code 4711.
SWE1424711X
where X is tha check digit.
Is this correct? Are there any recomendation on making tha national code 4 of 5 digist?

Bast regards and thanks for reopening the forum.
Vilhelm Persson
emmanuel
Site Admin
Posts: 273
Joined: Fri May 20, 2005 8:34 am
Contact:

Re: Ranking ID

Post by emmanuel »

villep wrote:What is the algorithm used for the check digit of the ranking id?

In Sweden we are planning to generate new ids based on our old 4 digit licence code.
If I understand right the format of the ranking id is
* Country code
* Gender 1/2 (M/F)
* Year of birth (2 digit)
* National number4 or 5 digits
* Check digit

Example of code for a male born 1942 and national code 4711.
SWE1424711X
where X is tha check digit.
Is this correct? Are there any recomendation on making tha national code 4 of 5 digist?

Bast regards and thanks for reopening the forum.
Vilhelm Persson
Hello Vilhelm,

you got it right :

format: cccgyynnnnv
ccc = IOC country code on 3 chars
g = gender (1=M, 2=F)
yy = year of birth on 2 digits
nnnn = unique number on 4 digits (eventually completed with leading 0)
v = validation key (1 digit)

the validation key (v) is calculated with the EAN8 algorithm (used for bar codes).

Here is the routine (in Pascal) to calculate v, given the first 10 chars:

function GetEan8Key(const IdStr: string): integer;
// return the Ean8 check key, based on EAN8 algorithm. -1 indicate an error, 0..9 is the result
var i, Number, SumEven, SumOdd: integer;
begin
SumOdd := 0;
SumEven := 0;
Number:=0;

for i := 1 to Length(IdStr) do begin
case IdStr of
'0'..'9' : Number:=Ord(IdStr)-Ord('0'); // '0' = 0, '1' = 1 ...
'A'..'Z' : Number:=Ord(IdStr)-Ord('A')+10; // A = 10, B = 11 ...
'a'..'z' : Number:=Ord(IdStr)-Ord('a')+10; // a = 10, b = 11 ...
else begin Result:=-1; exit; end; // wrong character: indicate error and exit proc
end;
if Odd(i) then inc(SumOdd, Number) else inc(SumEven, Number);
end;

Result := (10 - (SumEven + 3 * SumOdd) mod 10) mod 10;
end;

I hope this will help.

Emmanuel
villep
Posts: 50
Joined: Mon May 23, 2005 10:04 pm
Location: Sweden
Contact:

Re: Ranking ID

Post by villep »

Hi again
I see that all skiers that have a year of birth in the Skiers Database have a ranking ID. Even for the skiers in Sweden where we have not created a national ID for them.
How have these IDs been created? Should we try to implement them in our country or can we implement other numbers?

In Sweden we currently have a 4 digit number (license) that we want to use as a base for the ranking ID. Is this to late or shall we for example put a 1 before the license number and make the nation number part 5 digit long to not have a conflict with the existing generated numbers?
So instead of having SWE15006347 as planned we would generate SWE150106340. (Currently he has number SWE15000015 as ranking ID in the EAME database)

On the other hand since the birth year is a part of the ranking id and the currently automatically generated IDs are quite low there is no risk of conflict if the automatically generation is changed.

I would suggest that the automatically assigning of ranking IDs is removed OR replaced by a generation that generates a 5 digit national code starting by a 9 (SWE15090001? in the example). By doing this there will be no conflict with national generated numbers in the future, but still a better tracking for countries not implementing a national ranking ID.

Does this make sense?

Best regards
Vilhelm Persson
emmanuel
Site Admin
Posts: 273
Joined: Fri May 20, 2005 8:34 am
Contact:

Re: Ranking ID

Post by emmanuel »

Hello Vilhelm,
villep wrote:Hi again
I see that all skiers that have a year of birth in the Skiers Database have a ranking ID. Even for the skiers in Sweden where we have not created a national ID for them.
How have these IDs been created?
I created them.
villep wrote:Should we try to implement them in our country or can we implement other numbers?
You can have your own numbers. There is a "National/License ID box" to input them.
villep wrote:In Sweden we currently have a 4 digit number (license) that we want to use as a base for the ranking ID. Is this to late or shall we for example put a 1 before the license number and make the nation number part 5 digit long to not have a conflict with the existing generated numbers?
So instead of having SWE15006347 as planned we would generate SWE150106340. (Currently he has number SWE15000015 as ranking ID in the EAME database)
Well, the problem is the maintenance of this database.
There is no web service to allow federations to enter new skiers in a web database to get new IDs. that way, I could get them automatically.
This is why I created those IDs.
villep wrote:On the other hand since the birth year is a part of the ranking id and the currently automatically generated IDs are quite low there is no risk of conflict if the automatically generation is changed.

I would suggest that the automatically assigning of ranking IDs is removed OR replaced by a generation that generates a 5 digit national code starting by a 9 (SWE15090001? in the example). By doing this there will be no conflict with national generated numbers in the future, but still a better tracking for countries not implementing a national ranking ID.
If you could provide me with a file with names and IDs, I could change all IDs in my database.
Also, I don't know how to get new ID from you in the future...
If a new skier appers first in a swedish competition and have the new ranking ID set, that would be fine.

regards,

Emmanuel
Post Reply