Skip to content
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

TG2-VALIDATION_COORDINATESCOUNTRYCODE_CONSISTENT #50

Open
iDigBioBot opened this issue Jan 5, 2018 · 31 comments
Open

TG2-VALIDATION_COORDINATESCOUNTRYCODE_CONSISTENT #50

iDigBioBot opened this issue Jan 5, 2018 · 31 comments
Labels
CODED Consistency CORE TG2 CORE tests ISO/DCMI STANDARD Parameterized Test requires a parameter SPACE Test Tests created by TG2, either CORE, Supplementary or DO NOT IMPLEMENT TG2 Validation VOCABULARY

Comments

@iDigBioBot
Copy link
Collaborator

iDigBioBot commented Jan 5, 2018

TestField Value
GUID adb27d29-9f0d-4d52-b760-a77ba57a69c9
Label VALIDATION_COORDINATESCOUNTRYCODE_CONSISTENT
Description Do the geographic coordinates fall on or within the boundaries of the territory given in dwc:countryCode or its Exclusive Economic Zone?
TestType Validation
Darwin Core Class dcterms:Location
Information Elements ActedUpon dwc:countryCode
dwc:decimalLatitude
dwc:decimalLongitude
Information Elements Consulted
Expected Response EXTERNAL_PREREQUISITES_NOT_MET if the bdq:sourceAuthority is not available; INTERNAL_PREREQUISITES_NOT_MET if one or more of dwc:decimalLatitude, dwc:decimalLongitude, or dwc:countryCode are bdq:Empty or invalid; COMPLIANT if the geographic coordinates fall on or within the boundary defined by the union of the boundary of the country from dwc:countryCode plus it's Exclusive Economic Zone as found in the bdq:sourceAuthority, if any, plus an exterior buffer given by bdq:spatialBufferInMeters; otherwise NOT_COMPLIANT
Data Quality Dimension Consistency
Term-Actions COORDINATESCOUNTRYCODE_CONSISTENT
Parameter(s) bdq:sourceAuthority
bdq:spatialBufferInMeters
Source Authority bdq:sourceAuthority default = "10m-admin-1 boundaries UNION with Exclusive Economic Zones" {[https://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-1-states-provinces/] spatial UNION [https://www.marineregions.org/downloads.php#marbound]}
bdq:spatialBufferInMeters default = "3000"
Specification Last Updated 2024-08-30
Examples [dwc:countryCode="AR", dwc:decimalLatitude="-41.0525925872862", dwc:decimalLongitude="-71.5310546742521": Response.status=RUN_HAS_RESULT, Response.result=COMPLIANT, Response.comment="Coordinates match dwc:countryCode"]
[dwc:countryCode="CL", dwc:decimalLatitude="-41.0525925872862", dwc:decimalLongitude="-71.5310546742521": Response.status=RUN_HAS_RESULT, Response.result=NOT_COMPLIANT, Response.comment="Coordinates are in Argentina, not Chile"]
[dwc:countryCode="ZX", dwc:decimalLatitude="-41.0525925872862", dwc:decimalLongitude="-71.5310546742521": Response.status=INTERNAL_PREREQUISTES_NOT_MET, Response.comment="Input field contains invalid values - ZX is not a valid ISO 3166-1-alpha-2 country code"]
Source ALA, GBIF, iDigBio
References
Example Implementations (Mechanisms) Kurator/FilteredPush geo_ref_qc Library DOI: 10.5281/zenodo.14064324
Link to Specification Source Code https://github.com/FilteredPush/geo_ref_qc/blob/v2.0.1/src/main/java/org/filteredpush/qc/georeference/DwCGeoRefDQ.java#L1005
Notes dwc:coordinatePrecicision and dwc:coordinateUncertaintyInMeters (if present) imply a potential displacement of the provided coordinates. These two terms can be considered spatial buffers. Likewise, country polygons cannot be 100% accurate at all scales (Dooley 2005), so a spatial buffer of the country boundaries is justified. When dwc:countryCode=XZ (for High Seas), the coordinate should fall into a marine region out side of the EEZ of any country. Taking the spatial buffers into account does however greatly complicate both the logic and the implementation of such tests. The same applies to potential conversion of the Spatial Reference System (SRS) of dwc:decimalLatitude and dwc:decimalLongitude to the SRS used in the bdq:sourceAuthority.
@iDigBioBot
Copy link
Collaborator Author

Comment by Paula Zermoglio (@pzermoglio) migrated from spreadsheet:
Given that the country was not inferred from the coordinates to begin with.

@iDigBioBot
Copy link
Collaborator Author

Comment by Paul Morris (@chicoreus) migrated from spreadsheet:
@pz: again think of a sequence of pre-amendment, amendment, and post-amendment. The expectation in the case you describe in the pre-amememennt phase is that this valiation would return a result status of INTERNAL_PREREQUISITES_NOT_MET (no value of country to compare with coordinates), and that in the post-amendment phase would return the result of COMPLIANT

@iDigBioBot
Copy link
Collaborator Author

Comment by Paula Zermoglio (@pzermoglio) migrated from spreadsheet:
Get it. Will we then define different profiles for pre- and post-? and sth like a route-plan? I think that's what's maybe missing for me, a graphical schema relating the tests over time, with multiple arrows showing what's next if pass or fail.

@tucotuco tucotuco changed the title TG2-VALIDATION_COORDINATES_COUNTRY_INCONSISTENT TG2-VALIDATION_COORDINATES_COUNTRYCODE_INCONSISTENT Jan 16, 2018
@ArthurChapman ArthurChapman added the Test Tests created by TG2, either CORE, Supplementary or DO NOT IMPLEMENT label Jan 16, 2018
@ArthurChapman
Copy link
Collaborator

@tucotuco Why aren't we citing (ISO 3166-1-alpha-2 country codes) in this test like we have #48 - rather than say a specified target source authority?

@tucotuco
Copy link
Member

tucotuco commented Sep 2, 2018

@ArthurChapman No good reason I can think of. ISO 3166-alpha-2 seems exactly right to me.

@ArthurChapman
Copy link
Collaborator

OK - I will fix to be consistent with #48

@ArthurChapman
Copy link
Collaborator

@Tasilee is correct - we probably need to add the 3km buffer here in this one and add a note similar to #73.

@chicoreus
Copy link
Collaborator

INTERNAL_PREREQUISITES_NOT_MET if dwc:decimalLatitude, dwc:decimalLongitude, and dwc:countryCode are EMPTY;

should be if any of are empty, e.g.

"INTERNAL_PREREQUISITES_NOT_MET if one or more of dwc:decimalLatitude, dwc:decimalLongitude, or dwc:countryCode are EMPTY;"

@chicoreus
Copy link
Collaborator

"INTERNAL_PREREQUISITES_NOT_MET if one or more of dwc:decimalLatitude, dwc:decimalLongitude, or dwc:countryCode are EMPTY or contain values that cannot be interpreted;"

@Tasilee Tasilee changed the title TG2-VALIDATION_COORDINATES_COUNTRYCODE_INCONSISTENT TG2-VALIDATION_COORDINATES_COUNTRYCODE_CONSISTENT Mar 22, 2022
@tucotuco
Copy link
Member

I suggest the Description:

'Do the geographic coordinates fall on or within the boundaries of the territory given in dwc:countryCode or its Exclusive Economic Zone?'

in place of:

'Do the geographic coordinates fall on or within the boundaries of the country (from dwc:countryCode ) plus its Exclusive Economic Zone?'

@ArthurChapman
Copy link
Collaborator

See my comment of 14 February 2023 under test #56

@Tasilee
Copy link
Collaborator

Tasilee commented Feb 26, 2023

I like @tucotuco 's use of "invalid" and given related discussions (no anomalies) about redundancy of checks for invalidity or similar, I have edited the Expected Response. We will need to check all Expected Responses accordingly.

@ArthurChapman
Copy link
Collaborator

As in #56, I think this one where a third example would be valuable - i.e. where countryCode in invalid which creates a response of "Response.status=INTERNAL_PREREQUISTES_NOT_MET, Response.comment="Input field contain invalid values""

e.g.

[dwc:countryCode="ZX", dwc:decimalLatitude="-41.0525925872862", dwc:decimalLongitude="-71.5310546742521": Response.status=INTERNAL_PREREQUISTES_NOT_MET, Response.comment="Input field contain invalid values - ZX is not a valid country code"]

@tucotuco
Copy link
Member

@ArthurChapman I agree, except I would be more explicit and say "- ZX is not a valid ISO 3166-1-alpha-2 country code".

@ArthurChapman
Copy link
Collaborator

Agree @Tasilee

@Tasilee
Copy link
Collaborator

Tasilee commented Feb 27, 2023

Edited accordingly, with typo fix.

@Tasilee
Copy link
Collaborator

Tasilee commented Jun 13, 2023

Restructured Parameter(s) and Source authority entries

@ArthurChapman
Copy link
Collaborator

@Tasilee @chicoreus We don't mention bdq:sourceAuthority in the Expected Response although we do in the Description and Parameter(s) - do we need to fix Expected Response or delete reference to the bdq:sourceAuthority

Should Expected Response read

EXTERNAL_PREREQUISITES_NOT_MET if the bdq:sourceAuthority is not available; INTERNAL_PREREQUISITES_NOT_MET if one or more of dwc:decimalLatitude, dwc:decimalLongitude, or dwc:countryCode are EMPTY or invalid; COMPLIANT if the geographic coordinates fall on or within the boundary defined by the union of the boundary of the country from dwc:countryCode plus it's Exclusive Economic Zone as defined by the bdq:sourceAuthority, if any, plus an exterior buffer given by bdq:spatialBufferInMeters; otherwise NOT_COMPLIANT

@chicoreus
Copy link
Collaborator

@ArthurChapman That sounds almost right, but as marineregions.org doesn't actually define the EEZ regions, but provides a shapefile describing them, we should probably use slightly different language:

EXTERNAL_PREREQUISITES_NOT_MET if the bdq:sourceAuthority is not available; INTERNAL_PREREQUISITES_NOT_MET if one or more of dwc:decimalLatitude, dwc:decimalLongitude, or dwc:countryCode are EMPTY or invalid; COMPLIANT if the geographic coordinates fall on or within the boundary defined by the union of the boundary of the country from dwc:countryCode plus it's Exclusive Economic Zone as found in the bdq:sourceAuthority, if any, plus an exterior buffer given by bdq:spatialBufferInMeters; otherwise NOT_COMPLIANT

@ArthurChapman
Copy link
Collaborator

Updated Expected Response as per last comment and updated Specification Last Updated

@Tasilee
Copy link
Collaborator

Tasilee commented Jul 11, 2023

Post Zoom 11/7/2023, I have aligned the Source Authority with the suggested syntax:

bdq:sourceAuthority default = "ADM1 boundaries" {[https://gadm.org] spatial UNION with "Exclusive Economic Zones" [https://marineregions.org]}

chicoreus added a commit to FilteredPush/geo_ref_qc that referenced this issue Jul 20, 2023
…TES_COUNTRYCODE_CONSISTENT proof of concept using EEZ files from the marine boundaries geodatabase, performance is too slow.
chicoreus added a commit to FilteredPush/geo_ref_qc that referenced this issue Jul 21, 2023
…TES_COUNTRYCODE_CONSISTENT improved performance proof of concept using merge of simplified EEZ file from the marine boundaries geodatabase with natural earth country data.
chicoreus added a commit to FilteredPush/geo_ref_qc that referenced this issue Jul 22, 2023
…TES_COUNTRYCODE_CONSISTENT adding missing parameter and providing default method without parameters.
@chicoreus
Copy link
Collaborator

Since the sourceAuthority is a single parameter, not two, we need a single text string value as the default.

Something along the line of:

bdq:sourceAuthority default = "ADM1 boundaries UNION EEZ" {[https://gadm.org] spatial UNION [https://marineregions.org]}

@Tasilee
Copy link
Collaborator

Tasilee commented Jul 31, 2023

Sounds logical to me @chicoreus. How would you render it @tucotuco ? I think there is another one like this somewhere...and I'll chase that down next.

@tucotuco
Copy link
Member

No matter the rendering, it will have to be explained. The suggestion by @chicoreus seems complete and logically consistent to me.

@chicoreus chicoreus added the CORE TG2 CORE tests label Sep 18, 2023
@Tasilee
Copy link
Collaborator

Tasilee commented Mar 25, 2024

The Source Authority issue seems to have been addressed.

chicoreus added a commit to FilteredPush/geo_ref_qc that referenced this issue Jul 23, 2024
… handling source authority, adding method to get tdwg/bdq#50 to pass all validation tests.  Work in progress attempting to get datum transformations returning correct results for NAD27.
@chicoreus chicoreus changed the title TG2-VALIDATION_COORDINATES_COUNTRYCODE_CONSISTENT TG2-VALIDATION_COORDINATESCOUNTRYCODE_CONSISTENT Aug 30, 2024
@chicoreus
Copy link
Collaborator

Updated naming/labeling to make term in term-action a single word.

@ArthurChapman
Copy link
Collaborator

See comments under #98 and #62 on XZ and Country Codes. I am not sure we can do much with this test wrt to 'XZ' and High Seas.

@Tasilee
Copy link
Collaborator

Tasilee commented Sep 26, 2024

Unlike #98 and #42, this test is ok for 'high seas' in the sense of a bdq:Empty for dwc:countryCode will trigger INTERNAL_PREREQUISITES_NOT_MET - which is appropriate. Unlike #98 and #42, we asserting the test can't be run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CODED Consistency CORE TG2 CORE tests ISO/DCMI STANDARD Parameterized Test requires a parameter SPACE Test Tests created by TG2, either CORE, Supplementary or DO NOT IMPLEMENT TG2 Validation VOCABULARY
Projects
None yet
Development

No branches or pull requests

5 participants