ckan / ideas

[DEPRECATED] Use the main CKAN repo Discussions instead:
https://github.com/ckan/ckan/discussions
40 stars 2 forks source link

Store license list in database #130

Open davidread opened 9 years ago

davidread commented 9 years ago

It would be useful to add licenses using an API call - this is not currently possible.

The use case I have is: data.gov.uk harvests lots of datasets from ISO19139 format which contains the license expressed in free text. It would be useful to add these as ckan licenses at the harvest. What we've ended up doing is storing the licence in an extra field, which is a bit non-standard and means we have to customize everything that touches licences (e.g. testing for openness), let alone end-users using this via the API, sometimes in comparison with other CKANs.

A second use case is that a sysadmin can change the list of licences by using the web interface, rather than the command-line.

Currently the list of licenses is initialized from either a json file or a basic list, stored in code. https://github.com/ckan/ckan/blob/master/ckan/model/license.py#L43-68

Details of proposal:

iaroslav13 commented 9 years ago

I am working on this changes now.

Basically I’ve already implemented changes described in issue description. But there are some things I am not sure about:

In my opinion we need to keep almost the same structure that was hardcoded licenses but to drop info about family, maintainer, status, osi_compliance as suggested

I am proposing the following structure that I already implemented: id text NOT NULL, title text NOT NULL, is_okd_compliant boolean, is_generic boolean, url text, home_url text, status license_status NOT NULL id should be unique 'license_status' type possible values are ‘active' and ‘deleted'

In my opinion changes described in the description are really important and therefore I’d like to get responses to my questions from dev team. Also if it is possible I’d like to add these changes to upcoming 2.4 release.

You can find my changes here: https://github.com/iaroslav13/ckan/commit/a06742fbf5ae39496283a9feece847fb3dfe39e8

wardi commented 9 years ago

When specifying licenses in a json file we can add arbitrary extra fields the the licenses object. We use this to store translations of some of the core fields.

I ask that we add a place for extras in the database and have them populate the license returned similar to how it's done in resources (all extras at the same level as the core fields)

iaroslav13 commented 9 years ago

I made changes so that custom fields can be added to license records via API. See my pull request: https://github.com/ckan/ckan/pull/2452