openknowledge-archive / dpr-api

DEPRECATED - Data Package Registry API and Frontend
http://frictionlessdata.io/
MIT License
7 stars 6 forks source link

Geo data packages are throwing 500 Internal Server Error #335

Closed zelima closed 7 years ago

zelima commented 7 years ago

Following packages have problems after publishing:

https://staging.datapackaged.com/core/geo-nuts-administrative-boundaries | status code: 500 https://staging.datapackaged.com/core/geo-countries | status code: 500 https://staging.datapackaged.com/core/geo-admin1-us | status code: 500 https://staging.datapackaged.com/core/geo-ne-admin1 | status code: 500

heroku logs

For full logs see heroku logs

2017-04-10T05:56:56.804332+00:00 app[web.1]: Traceback (most recent call last):
...

...
2017-04-10T05:56:56.804362+00:00 app[web.1]:   File "/app/app/templates/_snippets.html", line 55, in template
2017-04-10T05:56:56.804364+00:00 app[web.1]:     <i class="icon-legal"></i> <a href="{{dataset.licenses[0].url}}" title="Available under the following License">{{dataset.licenses[0].name or dataset.licenses[0].id}}</a>
2017-04-10T05:56:56.804365+00:00 app[web.1]:     return getattr(obj, attribute)
2017-04-10T05:56:56.804364+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 430, in getattr
2017-04-10T05:56:56.804365+00:00 app[web.1]: UndefinedError: dict object has no element 0

Acceptance criteria

Tasks

Analysis

Exploring the code further discovered that all 4 Data Packages have common issue:

Inside datapackage.json all of them have property licenses that are set as objects Eg https://github.com/datasets/geo-nuts-administrative-boundaries/blob/master/datapackage.json#L20

"licenses": {
    "type": "ODC-PDDL",
    "url": "http://opendatacommons.org/licenses/pddl/1.0/"
  },

Following the https://specs.frictionlessdata.io description of required and optional properties for a Data Package descriptor https://specs.frictionlessdata.io/data-package/#properties property licenses should be list of objects

licenses The license(s) under which the resource is published. This property is not legally binding and does not guarantee that the package is licensed under the terms defined herein. Items Each item in the Licenses array is a License object. The uri property is required, and other defined properties are optional.

We have several options:

As a quick and simple solution for this 4 packages we decided to manually update datapckage.json and rise pull requests

Pull requests:

rufuspollock commented 7 years ago

@zelima what about our discussion about the fact this was causing a 500 error. Whilst we can fix this immediate issue by fixing the data packages what about similar issues in future. We need to think about where in the system we handle "bad" data packages.

zelima commented 7 years ago

FIXED all 4 Data Packages are live and working fine