Coder Social home page Coder Social logo

iati / iati-schemas Goto Github PK

View Code? Open in Web Editor NEW
15.0 16.0 9.0 1.77 MB

Schema development for the International Aid Transparency Initiative.

License: Other

Shell 26.62% XSLT 42.62% Python 30.76%
iati standard standards schema xml-schema opendata xslt

iati-schemas's Introduction

International Aid Transparency Initiative (IATI) XML Schemas

IATI Support <[email protected]>
Release 2.03, Unreleased

This directory contains version 2.03 of the IATI XML schemas. More information about these schemas is available at http://iatistandard.org

This directory contains the following files:

File Description
README.rst This file.
CHANGES.txt Change log.
iati-activities-schema.xsd XML Schema for describing aid activities (e.g. projects).
iati-organisations-schema.xsd XML schema for describing aid organisations and their budgets.
iati-common.xsd A supplementary schema with common IATI markup. Must be in the same directory as the above.
xml.xsd A supplementary schema that must be in the same directory as the above.
iati-registry-record-schema.xsd An application-specific extension schema for importing documents into the IATI registry.
tests/ Unit tests for the schemas.

Dev Installation

# Create and start a virtual environment
$ python3 -m venv pyenv
$ source pyenv/bin/activate

# Install Python package dependencies
$ pip install -r requirements-dev.txt

Tests

There are two types of tests:

Legacy tests

A series of short XML documents are included in the tests/**/should-pass and tests/**/should-fail directories (and sub-directories). These files test elements and attributes added pre-version 2.03 and offer a simple pass/fail check when parsed against the schemas in this distribution.

These tests can be run using:

$ xmllint --schema http://www.w3.org/2001/XMLSchema.xsd --noout *.xsd
$ ./tests/run-tests.sh

Tests for elements/attributes added in v2.03

A new test structure was added at version 2.03, with additional test cases added to tests/should-pass and tests/should-fail directories (and sub-directories). Directory structure is based upon the schema. Each element has a folder based on its name and is nested accordingly. Attributes also have folders but their folder names are prepended by an underscore.

All XML test cases in the should-fail directory are tested to be valid XML but invalid against the distributed IATI schemas. The expected reason for failure (for example, a missing required attribute) in each test case is asserted.

We use pytest as a test runner to check the validity of these files against the defined schema.

$ pytest

Test file naming syntax

should-fail test file names should begin with one of the following strings, depending on the expected failure type:

  • err-not-iati-xml-missing-required-element
  • err-not-iati-xml-missing-attribute
  • err-not-iati-xml-forbidden-attribute
  • err-not-iati-xml-incorrect-datatype

Additional test descriptions may be added to the file name following an underscore, like so:

err-not-iati-xml-missing-required-element_document-link-with-multiple-description-elements.xml

The files are now parsed with etree.fromstring. If an XMLSchemaError is raised during the parsing, the beginning of the file name is compared against Regex for the four possible error types above. For example, the error raised from err-not-iati-xml-missing-required-element_document-link-with-multiple-description-elements.xml is expected to match the Regex:

Element '[a-z-]*?': ((Missing child element\(s\)\.)|(This element is not expected\.)) Expected is( one of)? \( [#\*a-z-\s,]*? \)\.

Acknowlegements

David Megginson <[email protected]> for his original work on the IATI Schemas and continued support and involvement.

iati-schemas's People

Contributors

akmiller01 avatar allthatilk avatar amy-silcock avatar andylolz avatar bill-anderson avatar bjwebb avatar caprenter avatar dalepotter avatar davidmegginson avatar dependabot[bot] avatar hayfield avatar nosvalds avatar ocre42 avatar petyakangalova avatar rolfkleef avatar rorads avatar stevieflow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iati-schemas's Issues

Enhance Description of Transaction Type Disbursement

Raised from Zendesk ticket #1047. It is currently not clear what is meant by the text in brackets that describes the Transaction Type of Disbursement on the Transaction Type Codelist. Please could this be clarified

reporting-org description text

The description text for this element is currently:

The organisation issuing a report (not necessarily involved in the organisation or activity being described). May be a donor, fund, agency, etc. Specifying the @Identifier and @ROLE attributes is strongly recommended. May contain the organisation name as content. For the value of the @type attribute, see http://iatistandard.org/codelists/organisation-type For the value of the @ref attribute, see the list of officially-registered organizations at http://iatistandard.org/codelists/organisation

Changes

1 - @Identifier is not an attribute - change to @ref

2 - The last sentence should be revised to point people to the guidance:

So - new text proposal:

The organisation issuing a report (not necessarily involved in the organisation or activity being described). May be a donor, fund, agency, etc. Specifying the @ref and @ROLE attributes is strongly recommended. May contain the organisation name as content. For the value of the @type attribute, see http://iatistandard.org/codelists/organisation-type For guidance on constructing the value of the @ref attribute, see http://iatistandard.org/org-ref

@version attribute description

The description of @Version is different between iati-activities and iati-activity:

iati-activities

A number indicating the IATI specification version in use.

iati-activity

A number indicating the IATI specification version in use. Defaults to "1.0" if not specified. It is required to specify this attribute if the document is using features specific to an IATI specification other than the initial 1.0 version.

Should we:

a - align the description around the latter
b - add to iati-activity that the @Version here can differ from at iati-activities (or not?)

Introduce a New Transaction Type For Internally Sourced Funds

Raised from Zendesk ticket #1047. Currently, it is not necessary for organisations to report or include funding that comes from their own fundraising ( or similar internal) sources. Therefore should such funding be reported on (and do we perhaps need a new transaction type called locally raised funds, or something)

Better Describe the Roles of Organisations Publishing On Behalf Of Others

This issue has been raised from zendesk ticket 18. See https://iati.zendesk.com/agent/#/tickets/18

We need to include additional fields within the schema to better describe the role of a publisher who is publishing data on behalf of others. The Activity files needs to support secondary publishers. There are three scenarios that need to be covered:

  1. Aggregator publishes a donor activity that it has imported (unchanged) from another aggregator
  2. Aggregator publishes a donor activity that it has imported (unchanged) from the donor
  3. Aggregator publishes a donor activity that it has imported and modified

Splling mistake on xsd - activity-scope

iati-activities-schema.xsd

<xsd:element name="activity-scope" type="codeType">
xsd:annotation
<xsd:documentation xml:lang="en">
What geographical area does the activity encompass? eg. Global, Regional, Multi-National, National, Multiple (sub-national) aministrateive areas, etc
/xsd:documentation
/xsd:annotation
/xsd:element

"aministrateive areas, etc" should be "administrative areas, etc"

Contact Details - missing elements.

In the forum post on this we have:

We have added the following:

Contact Type (with an associated code list)
Job Title
Website
The ability to report multiple languages has been added to:

Organisation Name
Person Name
Job Title
Mailing Address

.....

Looking at the 1.03 dev schema it looks to me as though:

  1. Job title has been added, but Contact Type and Website have not

Also it seems that the elements are all of 'plainType' I think they should have been changed to 'textType' to enable multiple languages to be used as discussed above.

However, something I'm not clear on is the multilingual changes needed - is it
just changing the 'type=' bit?

common schema - percentage

Description for percentage in common schema states:

The percentage of the budget allocated to this item. Content
must be a positive real number between 0 and 100, with no
percentage sign.

I think this has to be updated to reflect the changelog in 1.03:

Where used, the @percentage attribute is now designated as a decimal value and no longer as a positive Integer

Activity Date explanation

Currently the text within the activity-schema for activity-date is:
Planned starting date for the activity in ISO 8601 date
format, e.g. "2010-10-01". For the value of the @type
attribute, see
http://iatistandard.org/codelists/activity_date_type

The text content may contain a general date text (e.g. 2011Q1)
for recording less specific dates such as month, quarter, or
year.

I don't think that makes sense (activity dates are not just planned starting dates).
The text in the spreadsheet on line 40 doesn't help (I think this is about changing the final line):
https://docs.google.com/spreadsheet/ccc?key=0AnWngmdQt3stdDcwRHJxaXgtLWVoY2N5VWt4ck1oeGc#gid=1

Bill - can you check pls.

fss not in schema CHANGES.txt

It looks like the addition of the new optional element fss is not in the CHANGES.txt - maybe on the assumption that is it a child element of crs-add?

Description For Transcation Type Incoming Funds Is Incorrect

Raised from Zendesk ticket #1047. Currently the description for Incoming Funds on the codelist for Transaction Type states that IF transations only relate to 'external' funds. This is apprantly not the case and IF transactions can be used to describe transfers between accounts or projects within a single organisation

country-budget-items allows a mix of text and iati sub elements

In the new schema, XML like this is valid:

<country-budget-items vocabulary="1">
   IATI
  <budget-item code="1.3.3" percentage="100">
    Accountability - planning
    <description>Accountability - planning</description>
  </budget-item>
</country-budget-items>

This is because country-budget-items has mixed="true". This is different to most other elements that have subelements in the schema. Is this a bug?

country-budget-items/budget-item@percentage

This attribute expects percentage, even when there is only one in use.

This should act in the same way as country and sector, in that percentage is only expected when there are multiples of the element within the activity

@version attribute on iati-activity

        A number indicating the IATI specification version in use.
        Defaults to "1.0" if not specified.  It is required to
        specify this attribute if the document is using features
        specific to an IATI specification other than the initial
        1.0 version.

Should this be on both iati-activities and iati-activity. The behaviour if one is defined and the other isn't is not well defined. Moreover, it is not clear if documents with iati-activity elements with different version attributes are permitted, since the documentation says iati-activity@version refers to whether the document uses certain features.

Additionally, the documentation says that it defaults to '1.0'. This version of the schema is not available online.

Should crs-add/fss/forecast have a value date?

Every other use of a monetary amount with a @Currency code includes a value date, but the standard doesn't require one for crs-add/fss/forecast (line 339ff). Can you find out if we should include it here as well? I won't implement it right now in #4 , but can add it if Bill would like to include it.

New git branches

David: I've created two new git branches:

  • relaxng - my old work in progress on switching to RelaxNG (saved for future use)
  • pre-version1.03 - branch for our work getting ready for version1.03 (rather than using master)

Are these OK with you? Please feel free to rename them, if not.

Some notes and questions on the 1.04 schema changes

Country, adm1, adm2 descriptions. These are different in the spreadsheet to those currently in the schema. Given that we are deprecating these attributes, do we want to alter the text to the text that is in the spreadsheet?

Point is marked up as 'point' in the schema instead of 'Point' as specified in the spreadsheet. Is that ok?
point has no description in the spreadsheet, should it have?

Have added 'Deprecated in 1.04' to descriptions of elements and attributes that
are now deprecated, but there is no other indication. Should we add a deprecated="true/false" attribute to attributes/elements?

Push version numbers in files that have not changed

Should we change the revision metadata in schema files that have not changed:
iati-organisations-schema.xsd has not changed but the iati-common.xsd it relies on has.

Similarly the registry-record schema has not changed.

@type description

The @type description, via the common/xsd is:

Free text describing the type of thing being referenced.

However, for instances such as organisation type or document type, we do wish that the code list is utilised. Is this description therefore in need of a fix?

Review and update schema text

Specifically, the text that is used for SSOT documentation.

Ensure this is precise and concise

Remove links to codelists - see: #53

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.