HEPData / hepdata

Repository for main HEPData web application
https://hepdata.net
GNU General Public License v2.0
40 stars 11 forks source link

records: avoid creating self-referring `RelatedTable` and `RelatedRecid` objects #765

Closed GraemeWatt closed 3 months ago

GraemeWatt commented 4 months ago

By inspecting the database, I found entries like:

hepdata=> select * from relatedtable order by id;
 id |           table_doi            |          related_doi           
----+--------------------------------+--------------------------------
 61 | 10.17182/hepdata.146013.v1/t1  | 10.17182/hepdata.146013.v1/t1
 62 | 10.17182/hepdata.146013.v1/t2  | 10.17182/hepdata.146013.v1/t2
 63 | 10.17182/hepdata.146013.v1/t3  | 10.17182/hepdata.146013.v1/t3
 64 | 10.17182/hepdata.146013.v1/t4  | 10.17182/hepdata.146013.v1/t4
 65 | 10.17182/hepdata.146013.v1/t5  | 10.17182/hepdata.146013.v1/t5

where the table_doi and related_doi are identical. Although this situation arises from a misunderstanding by the submitter, the submission code should not create a new RelatedTable object if table_doi = related_doi. Similarly, a new RelatedRecid object should not be created if this_recid = related_recid.

The hepdata-submission and hepdata_lib documentation should also be updated to mention that self-referring related_to_table_dois and related_to_hepdata_records fields should not be used.