Understanding issues

A short description about the Issue class that contains any problems found in your metadata when using check() on a datapackage.json file.

The Issue class

One Issue corresponds to one failed check on one field in the properties. An Issue has attributes that provide information about the failed check, which are described in more detail in the Issue documentation.

The explain() function

The explain() function provides a more verbose and user-friendly description of a list of Issues. If you have package properties that looks like the below, with the missing resources field (that we remove here to demonstrate the explain() function):

import check_datapackage as cdp
from rich import print as rprint
package_properties = cdp.example_package_properties()
del package_properties["resources"]
package_properties
{
    'name': 'woolly-dormice',
    'title': 'Hibernation Physiology of the Woolly Dormouse: A Scoping Review.',
    'description': '\nThis scoping review explores the hibernation physiology of the\nwoolly dormouse, drawing on data collected over a 10-year period\nalong the Taurus Mountain range in Turkey.\n',
    'id': '123-abc-123',
    'created': '2014-05-14T05:00:01+00:00',
    'version': '1.0.0',
    'licenses': [{'name': 'odc-pddl'}]
}

You can give the issues found by check() to explain() to get a more human-friendly version of the problems (using rich for pretty-printing):

issues = cdp.check(properties=package_properties)
rprint(cdp.explain(issues))
1 issue was found in your datapackage.json:

At resources:
|
| resources: {'name': 'woolly-dormice', 'title': 'Hibernation Physiology of the Woolly Dormouse: A Scoping 
Review.', 'description': '\nThis scoping review explores the hibernation physiology of the\nwoolly dormouse, 
drawing on data collected over a 10-year period\nalong the Taurus Mountain range in Turkey.\n', 'id': 
'123-abc-123', 'created': '2014-05-14T05:00:01+00:00', 'version': '1.0.0', 'licenses': [{'name': 'odc-pddl'}]}
|            
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'resources' is a required property

When setting error=True in check(), error messages will be generated by the explain() function.