Skip to content

Conversation

@alesan99
Copy link
Contributor

@alesan99 alesan99 commented Jan 19, 2026

Fixes #7641

Speeds up default tree creation significantly.

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 pr to documentation list
  • Add automated tests
  • Add a reverse migration if a migration is present in the PR

Testing instructions

  • Test with the setup page
    • Use a blank database
    • Pre-load all the trees you can and complete the setup
    • Make sure the trees were pre-loaded correctly.
  • Test in the taxon tree viewer
    • Add a new taxon tree and choose to import a populated one.
    • Make sure the tree was created correctly. An easy way to check is to compare it with the same tree created before the speed ups.

Testing instructions from the issue-7593 PR to check:

  • Guided Setup on a blank database
  • Use a blank DB to test this PR.
  • Configure ranks for the geography and taxon trees.
  • Test the new pre-load tree check box for geography and taxon trees.
  • After the setup, make sure the default tree creation process started for the trees you selected to pre-load. (You will see notifications)
    • If you chose a paleo/geo database then a chronostrat tree should also be imported automatically.
    • Note: A taxon tree will only be preloaded if defaults exist. If there exists no default tree, it will do nothing.
  • If you chose to -not- pre-load the taxon tree, the taxon tree that was created should not have a root node.
  • After the setup, check all the new trees, make sure the ranks respect your configuration.
  • Configuration tool and existing trees
  • Creating a new discipline with the configuration tool should create an empty taxon tree.
  • An empty taxon tree should have an import button
  • Make sure you can import a taxon tree into the existing empty tree
  • Make sure you can still create a new populated tree

@github-project-automation github-project-automation bot moved this to 📋Back Log in General Tester Board Jan 19, 2026
@alesan99 alesan99 changed the base branch from main to issue-7593 January 19, 2026 19:34
@alesan99 alesan99 changed the title Optimize default tree creation [Guided Setup] Optimize default tree creation Jan 21, 2026
@alesan99 alesan99 marked this pull request as ready for review January 21, 2026 15:50
@alesan99 alesan99 requested review from a team January 21, 2026 15:50
@CarolineDenis
Copy link
Contributor

CarolineDenis commented Jan 21, 2026

  • When uploading the tree, the nodes are being uploaded several times:
Screenshot 2026-01-21 at 1 13 49 PM
  • I'm able to delete rank in the Taxon Tree Definition edit form but not directly on the rank edit form
    Issue comes from:
if not allow_root_del and self.__class__.objects.get(id=self.id).parent is None:
            raise TreeBusinessRuleException(
                "cannot delete root level tree definition item",
                {"tree": self.__class__.__name__,
                 "localizationKey": 'deletingTreeRoot',
                 "node": {
                     "id": self.id
                 }})

Seems that the new trees getting created all have tree ranks with null parents

@acwhite211
Copy link
Member

There's an issue is that the new trees getting created all have tree ranks with null parents. This is what is causing the error to occur when trying to delete a empty tree rank.
image

@acwhite211
Copy link
Member

Fixed the delete empty rank issue by adjusting the code in the new tree creation code to make sure parent ranks are correctly set.

@acwhite211
Copy link
Member

All of the taxon appear in the UI to be under the root rank, but it seems the data is correct in the database.
image

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.

  • Make sure the trees were pre-loaded correctly.
  • Make sure the tree was created correctly. An easy way to check is to compare it with the same tree created before the speed ups.

Testing instructions from the issue-7593 PR to check:

  • Configure ranks for the geography and taxon trees.
  • After the setup, make sure the default tree creation process started for the trees you selected to pre-load. (You will see notifications)
    • If you chose a paleo/geo database then a chronostrat tree should also be imported automatically.
  • If you chose to -not- pre-load the taxon tree, the taxon tree that was created should not have a root node.
  • After the setup, check all the new trees, make sure the ranks respect your configuration.
  • Creating a new discipline with the configuration tool should create an empty taxon tree.
  • An empty taxon tree should have an import button
  • Make sure you can import a taxon tree into the existing empty tree
  • Make sure you can still create a new populated tree

Pre-loading geography trees and adding existing taxon through the taxon tree is much faster (~1-3 minutes depending on the tree) so that part looks good!

There's no option to pre-load taxon trees but it is included in the testing instructions so what is the plan for that? If it's not included in this PR that's fine but the testing instructions need to be updated. Also by default taxon tree has Subspecies checked as "in full name" but not included, was that intentional?

Storage tree separator default should be set to , but is currently set to . Also nothing is marked as "In full name" not sure if it's needed or not so I wanted to point it out in case.
image

Nothing is checked as "in full name" for Geography either.
image

All tree nodes are added under the root rank and duplicated
image

image image

Taxon tree does not respect any customizations made on the setup page. During setup I included some ranks that were not included by default and when I opened the taxon tree after setup they weren't there.

I tested the setup twice and one of the times when I pressed the create button after set up it did the loading thing and then sent me back to the last setup page. Since it didn't happen both times I'm not sure if it's important or not but I wanted to make note of it.

@github-project-automation github-project-automation bot moved this from 📋Back Log to Dev Attention Needed in General Tester Board Jan 22, 2026
@acwhite211
Copy link
Member

acwhite211 commented Jan 22, 2026

Got a fix for the taxon rank issue in the batched generated tree. The generated trees should appear correct in the tree viewer now.

Looks like this PR just adds the Geography preloads in the in the guided setup. The taxon trees can be generated/imported through the tree viewer.

@acwhite211 acwhite211 added this to the 7.12.0 milestone Jan 22, 2026
@github-project-automation github-project-automation bot moved this from Dev Attention Needed to ✅Done in General Tester Board Jan 23, 2026
Copy link
Contributor

@kwhuber kwhuber left a comment

Choose a reason for hiding this comment

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

  • Test with the setup page

    • Use a blank database

    • Pre-load all the trees you can and complete the setup

    • Make sure the trees were pre-loaded correctly.

    • I ran into an error when during the last step (I received this message when adjusting various ranks and when leaving the ranks as default):

      Screenshot 2026-01-23 at 10 28 01 AM
  • Test in the taxon tree viewer

    • Add a new taxon tree and choose to import a populated one.
    • Make sure the tree was created correctly. An easy way to check is to compare it with the same tree created before the speed ups.
      • The speed performance of this is much improved!

@alesan99
Copy link
Contributor Author

Some of my changes weren't pushed initially leading to this PR being more broken than it should be. Closed in favor of #7669 (All additional fixes were ported over too).

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Guided Setup] : Speed up default tree creation

6 participants