Skip to content

Conversation

@CarolineDenis
Copy link
Contributor

@CarolineDenis CarolineDenis commented Apr 18, 2025

Fixes #6294, #7488, #7558

Adds tree/create_default_tree/ endpoint to create or populate a tree with records from a CSV retrived from a URL.
Also fetches and displays a list of available default taxon trees in the Tree Viewer tree creation dialog.

TODO:

  • Make /create_default_tree/ accept a CSV url and discipline name. (Right now the frontend fetches a list of CSV files and sends a filename in the request, then the backend extracts the discipline from the filename, and then the backend chooses a url for the discipline from its own list.)
  • Make the default tree creation progress bar functional
  • Make default tree creation reliable. Retry failed rows? Show detailed errors if something goes wrong?
  • Allow the backend trigger default tree creation (In order to do it within the setup process).
  • Move tree mapping to hosted .json files

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone
  • Add relevant documentation (Tester - Dev)
  • Add automated tests
  • Add a reverse migration if a migration is present in the PR

Testing instructions

  • Go to tree viewer for Taxon
  • Click on the plus button to create a new tree
  • See that a list of default Taxon trees is displayed
  • Click on a default tree and see you get a notification that it is being created.
  • Wait and make sure the default tree is successfully created
  • Refresh the page
  • Create a new empty tree and make sure it is created successfully.
  • Make sure you can start creating a tree and cancel it with the Cancel button in the popup.
  • Make sure you can cancel the tree from the "in progress" notification as well.
  • Create a Geography tree:
    • Go to yourdb.test.specifysystems.org/documentation/api/operations/all/
    • Scroll down to /api/create_default_tree/ under the api section and click on it.
    • Click "Try it out" and type the following (and fill in your collection name):
{
  "url": "https://files.specifysoftware.org/geographyfiles/geonames.csv",
  "mappingUrl": "https://files.specifysoftware.org/treerows/geography.json",
  "disciplineName": "geography",
  "collection": "Your Collection Name",
  "rowCount": 42266
}
    • Click execute and make note of the response you got below.
    • The new secondary Geography tree should be created after a few minutes.
    • You can track the progress by going to yourdb.test.specifysystems.org/api/create_default_tree/status/YOUR_TASK_ID/. You should see your task id in the response you got.
  • Create a Chronostratigraphy tree:
{
  "url": "https://files.specifysoftware.org/chronostratfiles/GeologicTimePeriod.csv",
  "mappingUrl": "https://files.specifysoftware.org/treerows/geologictimeperiod.json",
  "disciplineName": "geologictimeperiod",
  "collection": "Your Collection Name",
  "rowCount": 42266
}
    • Click execute and make note of the response you got below.
    • The new Chronostrat tree should be created after a few minutes.
  • Feedback on the new tree menu is also appreciated.

@CarolineDenis
Copy link
Contributor Author

NOTES:

  • There are no default for geology trees

@CarolineDenis
Copy link
Contributor Author

CarolineDenis commented Sep 2, 2025

TODO:

  • When testing the feature, it fails when running
def create_default_trees_view(request):

because:

logged_in_collection_name = request.user.logincollectionname 

returns None for me

@alesan99
Copy link
Contributor

@emenslin your issues should be addressed now 👍 The tree titles in the previews are now used as the tree names, and the notifications should now show the correct task ID.

Notifications now also have a button to cancel the tree upload as well. Updated the testing instructions

Triggered by d2f110d on branch refs/heads/issue-6294
@alesan99 alesan99 requested a review from emenslin December 22, 2025 16:28
Copy link
Collaborator

@emenslin emenslin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • See that a list of default Taxon trees is displayed
  • Click on a default tree and see you get a notification that it is being created.
  • Wait and make sure the default tree is successfully created
  • Create a new empty tree and make sure it is created successfully.
  • Make sure you can start creating a tree and cancel it with the Cancel button in the popup.
  • Make sure you can cancel the tree from the "in progress" notification as well.
    • The a new secondary Geography tree should be created after a few minutes.

I didn't try every tree so I'm not sure if it's happening everywhere but at least both the ichthyology and entomology trees are missing the kingdom rank, and maybe others, I'm not sure what all ranks should be included.
image

image

Tree Def Items are missing Titles and no ranks are checked as enforced or In full name
image

Ornithology tree failed at the very end of the tree creation process.

After creating the geography tree it did try to create another one right after, however, that could've been an error on my part, I just wanted to mention it in case it might be a bigger problem.

@alesan99
Copy link
Contributor

@emenslin All ranks should now be correctly downloaded 👍
And all ranks should have isInFullName, isEnforced, and fullNameSeparator configured now too.

Updated testing instructions with the new chrono strat tree too

@alesan99 alesan99 requested review from a team and emenslin December 29, 2025 22:03
Copy link
Contributor

@Iwantexpresso Iwantexpresso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • See that a list of default Taxon trees is displayed

  • Click on a default tree and see you get a notification that it is being created.

  • Wait and make sure the default tree is successfully created

  • Create a new empty tree and make sure it is created successfully.

  • Make sure you can start creating a tree and cancel it with the Cancel button in the popup.

  • Make sure you can cancel the tree from the "in progress" notification as well.

    • [] The a new secondary Geography tree should be created after a few minutes.

    whenever i execute the API command I get the following bad request response when trying to create the secondary geography tree

image

which is pointing to the full separator within the geography.json files as being the culprit of this. i am not sure if its intended to be there or if the issue lies elsewhere as running specify through a test panel instance.

This is happening on calvermarinemuseum_2025_09_09 and on bohart_entomology_2025_09_09

@alesan99
Copy link
Contributor

whenever i execute the API command I get the following bad request response when trying to create the secondary geography tree

Whoops, should work now 👍 I gave it a quick test to confirm

Copy link
Collaborator

@emenslin emenslin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • See that a list of default Taxon trees is displayed
  • Click on a default tree and see you get a notification that it is being created.
  • Wait and make sure the default tree is successfully created
  • Create a new empty tree and make sure it is created successfully.
  • Make sure you can start creating a tree and cancel it with the Cancel button in the popup.
  • Make sure you can cancel the tree from the "in progress" notification as well.
    • The new secondary Geography tree should be created after a few minutes.
    • The new Chronostrat tree should be created after a few minutes.

  • I tried uploading all taxon trees, everything uploads successfully except the ornithology tree.
  • The root node for geography is just called 'Root' but should be called 'Earth'
  • The root node for Chronostrat is called 'Root' but should be called 'Time'
  • The chronostratigraphy tree doesn't have an Eon rank. I'm not sure if this is necessary but I wanted to mention it in case it is.
  • The full name separator for the root ranks for both chronostrat and geology are set to but should be set to , .

@alesan99
Copy link
Contributor

  • I tried uploading all taxon trees, everything uploads successfully except the ornithology tree.

Hm not sure why its failing, I increased the re-connection delay, so it might work now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Dev Attention Needed

Development

Successfully merging this pull request may close these issues.

Add default Chronostratigraphy tree Add default Geography tree [Guided Setup] - Add a tool to import a default tree

6 participants