You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the disambiguation command only supports triggering the disambiguation task using a uuid. To enhance functionality, we need to add support for control_number as an alternative identifier. This will allow users to trigger disambiguation using either uuid or control_number.
Update the disambiguate_record_by_uuid function to:
Accept a new option --control_number (-cn) alongside the existing --uuid option.
Ensure that at least one identifier (uuid or control_number) is provided, making both options individually optional but collectively required.
Fetch the record based on the provided identifier (uuid or control_number).
Trigger the disambiguation task using the appropriate record identifier.
Implement the necessary logic to fetch records by control_number. Ensure that:
Use LiteratureRecord.get_record_by_control_number
Update error handling to provide appropriate messages when:
Neither uuid nor control_number is provided.
The record cannot be found for the provided identifier.
Example implementaion:
@disambiguation.command(name="record")@with_appcontext@click.option("-id", "--uuid", type=str, required=False, help="UUID of the record")@click.option("-cn", "--control_number", type=int, required=False, help="Control number of the record")defdisambiguate_record_by_identifier(uuid, control_number):
"""
if not uuid and not control_number:
click.echo("Error: Either UUID or control_number must be provided.", err=True)
return
if uuid:
record = LiteratureRecord.get_record(uuid)
elif control_number:
record = LiteratureRecord.get_record_by_control_number(control_number)
if not record:
click.echo(f"Error: Record not found for UUID: {uuid} or Control Number: {control_number}", err=True)
return# Trigger disambiguation taskdisambiguate_authors.delay(
record.id,
record.model.version_id,
disambiguate_all_not_disambiguated=True
)
The text was updated successfully, but these errors were encountered:
Currently, the disambiguation command only supports triggering the disambiguation task using a uuid. To enhance functionality, we need to add support for control_number as an alternative identifier. This will allow users to trigger disambiguation using either uuid or control_number.
https://github.com/inspirehep/inspirehep/blob/8a8a92c9adb8a3dd9af82c6b6ebcc9b8ebe4a9be/backend/inspirehep/disambiguation/cli.py#L211
TECH NOTES:
Update the disambiguate_record_by_uuid function to:
Implement the necessary logic to fetch records by control_number. Ensure that:
LiteratureRecord.get_record_by_control_number
Update error handling to provide appropriate messages when:
Example implementaion:
The text was updated successfully, but these errors were encountered: