codeforIATI / iati-datastore

An open-source datastore for IATI data with RESTful web API providing XML, JSON, CSV plus ETL tools
https://datastore.codeforiati.org
Other
1 stars 1 forks source link

Empty participating organisation narratives #404

Closed markbrough closed 4 months ago

markbrough commented 4 months ago

Describe the bug

Where a participating organisation has an empty narrative, this causes an error:

<participating-org ref="XM-DAC-12000" role="4" type="10">
  <narrative xml:lang="EN"/>
</participating-org>

See for example this Swedish project:

https://d-portal.org/savi/?aid=SE-0-SE-6-SE-0-SE-6-71001016-LAO-21020-1

To Reproduce

Steps to reproduce the behaviour:

  1. Go to Datastore Classic error page for dataset sida-200
  2. See that there are errors with importing data:
    Failed to import a valid participating_orgs in activity SE-0-SE-6-T73-SIDA_ADMIN_2015-1, error was: Missing 'text()' from narrative","traceback":"Traceback (most recent call last):\n  File \"/home/iatidatastoreclassic/iatidatastoreclassic/iati_datastore/iatilib/parse.py\", line 60, in xval\n    val = ele.xpath(xpath)[0]\nIndexError: list index out of range\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/home/iatidatastoreclassic/iatidatastoreclassic/iati_datastore/iatilib/parse.py\", line 618, in activity\n    data[field] = function(xml, resource, major_version)\n  File \"/home/iatidatastoreclassic/iatidatastoreclassic/iati_datastore/iatilib/parse.py\", line 184, in participating_orgs\n    organisation = parse_org(ele, major_version=major_version, default_lang=default_lang)\n  File \"/home/iatidatastoreclassic/iatidatastoreclassic/iati_datastore/iatilib/parse.py\