DDMAL / DDMAL/UMIL

Remove local label-alias tracking: determine state at upload to Wikidata

Open
#283 0 comments 0 reactions 1 assignee Claimed by @mailynmailyn View on GitHub
question
Dominant language
Python
Stars
4
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Wikidata instrument names are categorized as either a Label (main name) or Alias (also known as). There is only one label per Wikidata instrument language.

Image

When making a call to the Wikidata RESTAPI when uploading an instrument name, it is necessary that "label" or "alias" is specified in the url.
`url = f"{WIKIDATA_URL}/entities/items/{wikidata_id}/labels/{language}"`
`url = f"{WIKIDATA_URL}/entities/items/{wikidata_id}/aliases/{language}"`

To handle this, we are currently tracking and saving locally the label-alias status of a new instrument name entered to the UMILdb with the boolean flag `umil_label`. When this flag is true, the name is a label.

There are multiple issues with this tracking strategy, and I think that we should shift to identifying the label-alias status right before Wikidata upload.

Issues with the current methodology:
- We assign label-alias status in the database according to the UMILdb and not Wikidata. We check if there is an existing name for that instrument language IN THE UMILDB and if there is nothing there, the new name is a label. This introduces problems of requiring a constant sync of UMILdb to Wikidata.
- Even if we were to reference Wikidata to define the label-alias status, there still exists a period of possible change before batch upload. Further, if a user is adding multiple names at once in the same language, they would all be classified as umil_label = True if there was no current label on Wikidata. We do not live update Wikidata.

We will have to reference Wikidata at some point to determine label-alias status, so it should be done right before upload to achieve the greatest accuracy.

Identifying the label at UMIL level is useful for displaying the main title name for the instrument detail page (in the active language). To solve this there are multiple options:
--> Manual assignment of the umil_label flag by admin
- umil_label is set True for the first instrument name in the language
- unique constraint that there is AT MOST one umil_label=True per instrument language, allowing for label reassignment and raising a database error if an admin attempts to check multiple labels

--> Pulling the label from Wikidata
- What if there is no label in that language on Wikidata ? Hopefully once we upload, the name would appear.

--> Hard code that the instrument detail title is the English label, allowing for the Google translate feature of the website to handle translation

Refer to conversation: https://github.com/DDMAL/UMIL/pull/259#discussion_r2201459212
@dchiller

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.