Skip to content

Add API endpoint to rebuild fullName fields in a tree #7138

@grantfitzsimmons

Description

@grantfitzsimmons

Problem

Currently, there is no straightforward way to rebuild the fullName fields for our trees (taxon, geography, storage, tectonicunit, geologictimeperiod, and lithostrat).

This was most recently requested by Philippe Verley at IRD on the Speciforum, but we have been asked by users for quite some time for a more straightforward approach to rebuilding names.

Describe the solution you'd like
I would like a new API endpoint that allows a user to trigger a rebuild of the fullName field for all nodes within a specified tree. This endpoint should be flexible enough to handle all supported tree types in Specify.

The endpoint should accept arguments to specify which tree to rebuild.

  • It must support the following tree types: taxon, geography, storage, tectonicunit, geologictimeperiod, and lithostrat.
  • The user must provide the specific id for the tree that needs rebuilding.
  • By default, the operation should only rebuild the fullName for preferred nodes (isPreferred = true).
  • An optional boolean argument, such as rebuild_synonyms, should be included. When set to true, it would rebuild the fullName for all nodes in the tree, including synonyms.

We should be able to build an interface for this when #6124 comes along.

The API calls might look like this:

Rebuilding preferred names for a taxon tree:

POST /api/specify/trees/taxon/2/rebuild-full-name

Rebuilding all names (including synonyms) for a geography tree:

POST /api/specify/trees/geography/4/rebuild-full-name?rebuild_synonyms=true

Describe alternatives you've considered
The main alternative is the current method of running a SQL script directly on the database or making a modification to the tree definition items and reverting it afterwards. This is not a good long-term solution, and there is no option now to rebuild names for synonyms beyond unsynonymizing them temporarily.

Reported By
IRD (Institut de Recherche pour le Développement)

Additional context
This feature was most recently requested by Philippe Verley at IRD on the Speciforum

Metadata

Metadata

Assignees

No one assigned

    Labels

    2 - TreesIssues that are related to the tree system and related functionalities.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions