OpenDataServices / cove

CoVE is an web application to Convert, Validate and Explore data following certain open data standards - including 360Giving, Open Contracting Data Standard, IATI and the Beneficial Ownership Data Standard
http://cove.opendataservices.coop
Other
43 stars 11 forks source link

[IATI] schema error on ordering with org file - document-link/recipient-org #1366

Closed stevieflow closed 2 years ago

stevieflow commented 2 years ago

This example validates - the document-link includes a recipient-country (as is permitted in the org standard):

https://docs.google.com/spreadsheets/d/1MXjepDgfzKw0ULUWzKmXVS0Al6rMhMHlgN-ZF6hLc70/edit#gid=1064738356

The XML in this conversion is:

<document-link format="application/pdf" url="http://example.org/document.pdf">
<title>
<narrative xml:lang="en">Example Org document</narrative>
</title>
<category code="B02"/>
<language code="en"/>
<document-date iso-date="2018-01-01"/>
<recipient-country code="SS"/>
</document-link>

This matches the ordering of elements in the IATI documentation:

https://iatistandard.org/en/iati-standard/203/organisation-standard/iati-organisations/iati-organisation/document-link/

 <document-link format="application/vnd.oasis.opendocument.text" url="http://www.example.org/docs/report_en.odt">
  <title>
   <narrative>Annual Report 2013</narrative>
  </title>
  <category code="B01" />
  <language code="en" />
  <document-date iso-date="2014-02-05" />
  <recipient-country code="AF" />
 </document-link>

========

However, if you change the ordering of the data columns in the CoVE spreadsheet:

https://docs.google.com/spreadsheets/d/1oqS_eHZ0DqJYx3HZlmohcSqV42uqCyLqR5p40BZB_KM/edit#gid=1064738356

.. the conversion is invalid:

'recipient-country': This element is not expected. Expected is one of ( description, category.

<document-link format="application/pdf" url="http://example.org/document.pdf">
<title>
<narrative xml:lang="en">Example Org document</narrative>
</title>
<recipient-country code="SS"/>
<category code="B02"/>
<language code="en"/>
<document-date iso-date="2018-01-01"/>
</document-link>
</iati-organisation>

It appears that in this one instance, CoVE seems to convert the data columns in order - whereas for everything else they are converted to the ordering given in the standard, regardless of how they are presented in the data.

Note - there is a weird discrepancy in the actual standard, whereby the recipient-country element is presented as the first sub-element in both the navigation and standard-summary table, yet as the last element in the code example... I'm not sure this is related or coincidental ...

document-link-iatistandard-org

Organisation-Standard-Summary-Table-iatistandard-org

vs

document-link-iatistandard-org (1)

Bjwebb commented 2 years ago

Note - there is a weird discrepancy in the actual standard, whereby the recipient-country element is presented as the first sub-element in both the navigation and standard-summary table, yet as the last element in the code example... I'm not sure this is related or coincidental ...

Yes, I think this is the same problem.

The latest schema includes an xsd:extension, which the docs code, and flatten-tool's sorting code don't know how to handle correctly.

stevieflow commented 2 years ago

Thanks @Bjwebb. I know @akmiller01 has a PR ready https://github.com/IATI/IATI-Standard-SSOT/pull/388/files (via https://github.com/IATI/IATI-Extra-Documentation/issues/618). Would this then resolve our issue?

Bjwebb commented 2 years ago

flatten-tool has it's own copy of code to do this, so that PR won't fix it directly, but will be helpful for making the same change for flatten-tool.

Bjwebb commented 2 years ago

This should be fixed now on https://iati.cove.opendataservices.coop/