django-daiquiri / daiquiri

A framework for the publication of scientific databases
https://escience.aip.de/daiquiri
Apache License 2.0
26 stars 8 forks source link

IMPROVEMENT: add 'size` to the oai metadata created from the datalink table #175

Open kimakan opened 1 year ago

kimakan commented 1 year ago

In order to provide the size of the downloadable file linked in the datalink table, we could add the Size entry into the oai metadata created from the datalink table. For now, the size is not provided at all, although it's already contained in the datalink table as content_length. https://github.com/django-daiquiri/daiquiri/blob/f6f352ac46c877209bb176d391f97079326e01f5/daiquiri/oai/adapter.py#L248-L254

Possible solution:

            elif semantics == '#this':
                datalink['formats'].append(content_type)
                datalink['size'].append(f"{content_length} bytes")
                datalink['related_identifiers'].append({
                    'related_identifier': access_url,
                    'related_identifier_type': 'URL',
                    'relation_type': 'IsDescribedBy'
                })

A problem arises if there are more than one entry with the semantic #this for the same ID in the datalink table. It's a very common scenario where the object is represented by several files. It's still not clear how to handle this.