-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate that country code is an ISO_3166-2 2-Digit country code #272
Comments
This has been moved from the (internal ODSC) issue at http://bods.opendataservices.coop/redmine/issues/310 |
FWIW, the register uses option 3 and this ruby gem to provide the external source, which eventually traces back to this Debian package and specifically these files: ISO3166-1, ISO3166-2 From finding that, I got confused as to whether it should be The reference for I think the docs for jurisdiction are slightly mistaken, it should be either an Tightening up both the docs and the validation gets a 👍 from me. |
I had a look into what we do for OCDS, but we just don't use country codes at the moment! There's also a list of ISO 3166-1 alpha-2 codes on datahub (which seems to have some relation to Open Knowledge): https://datahub.io/core/country-list |
In terms of tidying up the docs to clear up @stevenday Q that sounds good. In terms of validation, I'm not sure. Don't all 3 suggestions in the first post basically mean we are setting the list into the standard? What happens if then the list changes - a country is created or removed - should we then technically be releasing another version of the standard just to add a codelist entry? Would it be better if we tighten up the docs to be clear but leave the technical schema as "min and max length are set to 2" only? Then other software like CoVE and it's lib can download the list from an official source and check against that. (like the register currently does) Tho, potentially do we have to worry about issues in historical data? If "Landy McLand Face" joins with it's neighbour and stops being a country in 2020, but we have historical immutable statements sitting around from 2019 with country.code = LL , would any validator have to know how to handle that? |
Thanks @odscjames, these are great points! I agree that we can't set the list into the standard, so it would have to be additional validation provided by cove, etc not a codelist.
It was news to me that ISO 3166 has an issue of code re-use, as well as deletion! It makes sense if you think of it solely as a standard for current countries I suppose. I guess we have three options:
I'd probably err on the side of doing 1 and 3. |
FYI, as far as updating the list of ISO 3166-1 alpha-2 codes, we use this script to update directly from ISO. (Rubygems, Debian, Open Knowledge, etc. are not always up-to-date.) There are some manual steps, but it's fairly quick: https://github.com/open-contracting-extensions/ocds_countryCode_extension/tree/master/script |
On the tightening up the docs side of things. I can see various places that we need to work on. Here are my suggestions:
SecuritiesListing.stockExchangeJurisdiction Edit description to say "The 2-digit country code (ISO 3166-1), or the subdivision code (ISO 3166-2) for the jurisdiction under which the exchange, market or trading platform is regulated."
On those 3 options on the validation side of things, @odscjames is working on validation issues at the moment and may have thoughts. I suggest spinning up a ticket in lib-cove or lib-cove-bods and taking this discussion there. This ticket will then solely relate to the standard changes. |
A digit is 0-9. Please use "2-letter" :) |
Merged to master |
Sorry - leaving open for the other part of this - validation in Cove & other places |
@odscjames - are you happy to do that cove thinking too & add any related ticket to a cove library? (Then we can close this issue.) |
openownership/cove-bods#78 created, closing this |
At the moment the schema only states in the description that a country code should be an ISO_3166-2 2-Digit country code. Both min and max length are set to 2, but there is no explicit check that the two digits published are valid.
We have had an internal discussion about creating an enum that can be checked. Three options have been suggested:
Pinging @kd-ods and @Bjwebb to check that I have captured the options correctly.
The text was updated successfully, but these errors were encountered: