Skip to content

csv-to-babeltests: --update-stale-curies mode #79

Description

@gaurav

Summary

CURIEs in a CSV go stale over time — an identifier that resolved correctly when the sheet was first filled in may no longer be canonical in NodeNorm. This mode detects those cases and suggests replacements by looking up the label via NameRes.

Proposed interface

csv-to-babeltests input.csv \
  --curie-column OutputID \
  --label-column Label \
  --update-stale-curies \
  --target dev \
  > updated.csv

For each row:

  1. Call CachedNodeNorm.normalize_curies([curie]).
  2. If the CURIE resolves and is already the preferred ID → keep it.
  3. If the CURIE resolves but the preferred ID differs → replace the CURIE with the preferred ID and emit a # was: <old> comment or stderr note.
  4. If the CURIE does not resolve at all → call CachedNameRes.lookup(label, limit=1) and substitute the top-result CURIE (with a # resolved from label note); warn if no result.

Output could be a rewritten CSV (stdout) or the usual BabelTests YAML block with updated CURIEs and provenance comments.

Implementation notes

  • Both CachedNodeNorm and CachedNameRes are already available in the tool.
  • The --update-stale-curies flag is a natural companion to --resolve-from-label (issue csv-to-babeltests: --resolve-from-label (NameRes-assisted CURIE population) #78) — both need the NameResURL from targets.ini, so extending load_nodenorm_url to return both URLs is a prerequisite shared by both issues.
  • Consider adding a --dry-run sub-flag that prints a diff to stderr without modifying the output.

Related

This tool is being developed at #77

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions