bdq icon indicating copy to clipboard operation
bdq copied to clipboard

TG2-VALIDATION_COORDINATESCOUNTRYCODE_CONSISTENT

Open iDigBioBot opened this issue 7 years ago • 31 comments

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
  • ISO (n.dat.) ISO 3166 Country Codes. https://www.iso.org/iso-3166-country-codes.html
  • Wikipedia (2020) ISO 3166-1 alpha-2. https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
  • Flanders Marine Institute (2023) Maritime Boundaries Geodatabase, version 12. Available online at https://www.marineregions.org/. https://doi.org/10.14284/628
  • Kelso NV and Patterson T (2010) Introducing Natural Earth data—Naturalearthdata.com. Geographica Technica. Special issue, 2010 pp 82–89. https://technicalgeography.org/pdf/sp_i_2010/12_introducing_natural_earth_data__naturaleart.pdf
  • Natural Earth (2022) Natural Earth Free vector and raster map data at 1:10m, 1:50m, and 1:110m scales. v5.1.2. https://www.naturalearthdata.com/, https://github.com/nvkelso/natural-earth-vector/releases/tag/v5.1.2.
  • Natural Earth (2022) Admin 1 – States, provinces. v5.1.1 2022-05-12. https://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-1-states-provinces/
  • Chapman AD and Wieczorek JR (2020) Georeferencing Best Practices. Copenhagen: GBIF Secretariat. https://doi.org/10.15468/doc-gg7h-s853
  • Dooley, JF Jnr. (2005) An inventory and comparison of globally consistent geospatial databases and libraries. Rome: FAO. http://www.fao.org/3/a0118e/a0118e00.htm#Contents
Example Implementations (Mechanisms) Kurator:geo_ref_qc
Link to Specification Source Code https://github.com/FilteredPush/geo_ref_qc/blob/master/src/main/java/org/filteredpush/qc/georeference/DwCGeoRefDQ.java#L80
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 avatar Jan 05 '18 15:01 iDigBioBot

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

iDigBioBot avatar Jan 12 '18 16:01 iDigBioBot

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 avatar Jan 12 '18 16:01 iDigBioBot

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.

iDigBioBot avatar Jan 12 '18 16:01 iDigBioBot

@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?

ArthurChapman avatar Sep 02 '18 00:09 ArthurChapman

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

tucotuco avatar Sep 02 '18 23:09 tucotuco

OK - I will fix to be consistent with #48

ArthurChapman avatar Sep 03 '18 00:09 ArthurChapman

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

ArthurChapman avatar May 01 '20 01:05 ArthurChapman

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 avatar May 21 '20 21:05 chicoreus

"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;"

chicoreus avatar May 21 '20 21:05 chicoreus

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?'

tucotuco avatar Mar 30 '22 23:03 tucotuco

I am working through the test data and wondering if we need something more explicit (and consistent across tests) with the "interpreted" bit in the Expected Response:

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;

Should this be something more like

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 as a valid numeric value;

?

Tasilee avatar Jan 26 '23 21:01 Tasilee

@Tasilee To me that wording suggests that dwc:countryCode should be a numerical value. How about,

"INTERNAL_PREREQUISITES_NOT_MET if one or more of the values of dwc:decimalLatitude, dwc:decimalLongitude, or dwc:countryCode are EMPTY or invalid."

tucotuco avatar Jan 26 '23 22:01 tucotuco

I like that wording. If we agree to this, it will propagate to many other Expected Responses 🙄

Tasilee avatar Jan 26 '23 23:01 Tasilee

See my comment of 14 February 2023 under test #56

ArthurChapman avatar Feb 13 '23 21:02 ArthurChapman

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.

Tasilee avatar Feb 26 '23 22:02 Tasilee

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"]

ArthurChapman avatar Feb 26 '23 23:02 ArthurChapman

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

tucotuco avatar Feb 26 '23 23:02 tucotuco

Agree @Tasilee

ArthurChapman avatar Feb 26 '23 23:02 ArthurChapman

Edited accordingly, with typo fix.

Tasilee avatar Feb 27 '23 00:02 Tasilee

Restructured Parameter(s) and Source authority entries

Tasilee avatar Jun 13 '23 00:06 Tasilee

@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

ArthurChapman avatar Jun 28 '23 01:06 ArthurChapman

@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

chicoreus avatar Jun 28 '23 18:06 chicoreus

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

ArthurChapman avatar Jun 28 '23 23:06 ArthurChapman

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]}

Tasilee avatar Jul 11 '23 00:07 Tasilee

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]}

chicoreus avatar Jul 22 '23 01:07 chicoreus

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.

Tasilee avatar Jul 31 '23 00:07 Tasilee

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

tucotuco avatar Jul 31 '23 00:07 tucotuco

The Source Authority issue seems to have been addressed.

Tasilee avatar Mar 25 '24 23:03 Tasilee