countries-states-cities-database icon indicating copy to clipboard operation
countries-states-cities-database copied to clipboard

Incorrect ISO 3166-2 format of state codes

Open jigar-dhulla opened this issue 2 years ago • 4 comments

Correct ISO format: <CountryCode>-<Code>. E.g. IN-MH

Format Stored: <Code>. E.g. MH

Correct format is referenced from here: https://www.iso.org/obp/ui/#iso:code:3166:IN https://www.iso.org/obp/ui/#iso:code:3166:GB https://www.iso.org/obp/ui/#iso:code:3166:UG

When the State Code is Numeric it may conflict with the Primary ID when searching for a state by ID or Code. For e.g. Uganda: https://www.iso.org/obp/ui/#iso:code:3166:UG

jigar-dhulla avatar Apr 20 '22 07:04 jigar-dhulla

@jigarakatidus Thanks for reporting. 🎉

I agree with you, Will fix them ASAP.

dr5hn avatar Apr 21 '22 07:04 dr5hn

@jigarakatidus Thanks for reporting. 🎉

I agree with you, Will fix them ASAP.

This might be breaking change for those consuming APIs, so take care. :)

Keep up the good work. Thanks.

jigar-dhulla avatar Apr 21 '22 08:04 jigar-dhulla

@jigarakatidus Thanks for the heads up!

Indeed a breaking change, but I was thinking of just adding another column of data for this. For those who want to consume this way.

dr5hn avatar Apr 21 '22 08:04 dr5hn

@jigarakatidus Thanks for the heads up!

Indeed a breaking change, but I was thinking of just adding another column of data for this. For those who want to consume this way.

That also works. But I would suggest to keep file size low and avoid duplication as this is getting distributed. :)

Currently, we are consuming the data only from CSV. So before adding to our DB, we just concatenate CountryCode-StateCode. This works for us. This issue is not burning in a way.

So probably, a newer major version can be released with a breaking change. Just to be in sync with the standard.

jigar-dhulla avatar Apr 21 '22 08:04 jigar-dhulla