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 a 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.
  • 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

@github-project-automation github-project-automation bot moved this from 📋Back Log to Dev Attention Needed in General Tester Board Dec 9, 2025
@alesan99
Copy link
Contributor

  • Wait and make sure the default tree is successfully created
    • The a new secondary Geography tree should be created after a few minutes.

@emenslin It looks like the collection is being completely ignored when the request is sent, I think I know how to properly fix it.
There should also be a progress bar, it looks like something is really broken.

Pushed some changes but I will do some extensive testing on different databases to make sure it actually works, then I'll re-request your review 👍

@alesan99 alesan99 linked an issue Dec 16, 2025 that may be closed by this pull request
@alesan99 alesan99 requested review from a team and emenslin December 16, 2025 21:06
Triggered by 43368ed on branch refs/heads/issue-6294
@alesan99 alesan99 linked an issue Dec 17, 2025 that may be closed by this pull request
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.
    • The a new secondary Geography tree should be created after a few minutes.

Geography tree creation notification doesn't include correct task ID.
image

image

Naming convention for the trees are not consistent (i.e. herpetology tree is named 'herpetology' but mammalogy tree is named 'mammal', all tree names should match the source names.
image
image

@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.

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

5 participants