This version is DEPRECATED, v2.03 is the latest version
This version is DEPRECATED, v2.03 is the latest version
An IATI Ruleset is a JSON document. The structure is described below.
A JSON schema is availible to test that the structure of a Ruleset is correct.
Each JSON document has the form.:
{
"CONTEXT": {
"RULE_NAME": {
"cases": CASE_DICT_ARRAY
}
}
}
Where CONTEXT
is some xpath expression. This will be used to select the XML elements that the contained rules will be tested against.
RULE_NAME
is one of rule names listed below
CASE_DICT
is a dictionary who’s contents depends on RULE_NAME
CASE_DICT_ARRAY
is an array of case dictionaries. The contents of each dictionary depends on the RULE_NAME
The possible keys in a case dictionary are:
condition
An xpath string. If this evaluates to True, the rule will be ignored.
paths
An array of xpath strings. These are evaluated to give a list of elements that the named rule then operates on.
less
A string containing the xpath of the value that should be smaller
more
A string containing the xpath of the value that should be larger
regex
A string containing a perl style regular expression
sum
A number.
Rule names are listed in bold, along with a description and what keys must be in the case dictionary.
Keys: condition
, paths
There must be no more than one element described by the given paths.
Keys: condition
, paths
There must be at least one element described by the given paths.
Keys: condition
, paths
If one of the provided paths exists, they must all exist.
Keys: condition
, paths
, sum
The numerical sum of the values of elements matched by paths
must match the value for the sum
key
Keys: condition
, less
, more
The date matched by less
must not be after the date matched by more
. If either of these dates is not found, the rule is ignored.
Keys: condition
, paths
, regex
The provided regex
must match the text of all elements matched by paths
Keys: condition
, paths
, regex
The provided regex
must match the text of none of the elements matched by paths
Keys: condition
, paths
, start
The text of the each element matched by paths
must start with the text of the element matched by start
Keys: condition
, paths
The text of each of the elements described by paths
must be unique