ThreeSixtyGiving / datastore

A Data Store application for 360Giving
GNU Affero General Public License v3.0
0 stars 1 forks source link

Add grant and additional_data licence data #213

Open michaelwood opened 1 month ago

michaelwood commented 1 month ago

When a user downstream downloads/consumes a grant from any of the tools we need to be able to show what fields are under what licence on a per-grant basis (this is because it's possible to construct queries that mix and match grants from different datasets, or consume single grants at a time).

Tasks for this

The licence information for a grant can be found following the relations in the data model fields grant->(foreign key)source_file->data->licence_name. A new datastore additional_data source

We could either join the field in the ORM i.e.on the database query for export and merge in the field, or do a lookup per grant (with a cache), this would be a new datastore additional_data module called "grant_metadata" (trying to future proof this for more future fields such as #157).

For example in https://github.com/ThreeSixtyGiving/datastore/blob/live/datastore/additional_data/sources/find_that_charity.py in update_additional_data function we need to do something like


class FindThatCharitySource(object):

#....

    LICENCE =  "whatever-it-is-v2"

#....

    def update_additional_data(self, grant, additional_data)
...

        additional_data[f"{self.ADDITIONAL_DATA_KEY}_LICENCE"] = LICENCE

The task after this is to make sure the tools include the new fields in the download/api/etc.

rhiaro commented 1 month ago

(might be a better name than grant_licence)

publisher_licence or source_licence ?