Use inbox label as default author ID in auto-curate #64

Merged
cmo merged 1 commit from issue-54 into master 2026-10-15 03:18:22 +00:00

View file

@ -112,7 +112,7 @@ stl_info = False
) )
@click.option( @click.option(
'--add-annotations', '--add-annotations',
help='add annotations when posting a change set via `--post-change-set`. By default the annotations will not be added to the records that are posted. If --post-change-set is not provided, this flag is ignored', help='add annotations when posting a change set via `--post-change-set`. By default the annotations will not be added to the records that are posted. If --post-change-set is not provided, this flag is ignored.',
default=False, default=False,
is_flag=True, is_flag=True,
) )
@ -120,22 +120,22 @@ stl_info = False
'--author_id', '--author_id',
metavar='AUTHOR_ID', metavar='AUTHOR_ID',
default=None, default=None,
help='specify an author ID that will be stored in the audit log (AUTHOR_ID must not contain whitespace).', help='overwrite the default author ID with AUTHOR_ID (AUTHOR_ID must not contain whitespace).',
) )
@click.option( @click.option(
'--pid', '-p', '--pid', '-p',
metavar='PID', metavar='PID',
help='if provided, process only records that match the given PIDs. NOTE: matching does not involve CURIE-resolution', help='if provided, process only records that match the given PIDs. NOTE: matching does not involve CURIE-resolution.',
) )
@click.option( @click.option(
'--list-labels', '-l', '--list-labels', '-l',
help='list the inbox labels of the given source collection, do not perform any curation', help='list the inbox labels of the given source collection, do not perform any curation.',
default=False, default=False,
is_flag=True, is_flag=True,
) )
@click.option( @click.option(
'--list-records', '-r', '--list-records', '-r',
help='list records in the given inboxes, do not perform any curation', help='list records in the given inboxes, do not perform any curation.',
default=False, default=False,
is_flag=True, is_flag=True,
) )
@ -164,7 +164,7 @@ stl_info = False
) )
@click.option( @click.option(
'--dry-run', '-d', '--dry-run', '-d',
help='if provided, do not alter any data, instead print what would be done', help='if provided, do not alter any data, instead print what would be done.',
default=False, default=False,
is_flag=True, is_flag=True,
) )
@ -355,6 +355,7 @@ def auto_curate(
else: else:
console.print(f'[yellow]Warning[/yellow]: inbox `{label}` not in collection.') console.print(f'[yellow]Warning[/yellow]: inbox `{label}` not in collection.')
author_id = author_id or label
# Get the records from the service, or from a change set that should # Get the records from the service, or from a change set that should
# be posted. # be posted.
if post_change_set: if post_change_set:
@ -515,7 +516,7 @@ def _curate_records(
continue continue
if dry_run: if dry_run:
console.print(f'[DRY_RUN]:WRITE record [green]"{record["pid"]}"[/green] of class "{class_name}" to collection "{destination_collection}" on "{destination_service_url}"') console.print(f'[DRY_RUN]:WRITE record [green]"{record["pid"]}"[/green] of class "{class_name}" to collection "{destination_collection}" on "{destination_service_url}" with author_id "{author_id}"')
else: else:
# Store record in destination collection # Store record in destination collection
try: try:
@ -787,7 +788,7 @@ def _post_change_set(
continue continue
if dry_run: if dry_run:
console.print(f'[DRY_RUN]:WRITE record [green]"{record["pid"]}"[/green] of class "{class_name}" to collection "{destination_collection}" on "{destination_service_url}"') console.print(f'[DRY_RUN]:WRITE record [green]"{record["pid"]}"[/green] of class "{class_name}" to collection "{destination_collection}" on "{destination_service_url}" with author_id "{author_id}"')
continue continue
# Store record in destination collection # Store record in destination collection