Skip to content

Conversation

@alesan99
Copy link
Contributor

@alesan99 alesan99 commented Jan 14, 2026

Fixes #7593, #7641

Changes:

  • Adds preload option to Geography and Taxon trees during setup. This will trigger the background tree creation like normal (for simplicity).
  • Adds rank configuration to setup forms (Ugly, but can be improved)
  • In empty taxon trees (with no root), there is now an import button that allows you to import a populated tree into an existing tree.
  • Fix full name direction not being reverse for new chronostrat trees
  • Fix nested subviews in setup forms
  • Also some helpful refactoring
image

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

  • Guided Setup on a blank database
  • Use a blank DB to test this PR.
  • Configure ranks for the geography.
  • Test the new pre-load tree check box for geography and taxon trees.
  • The pre-load checkbox for taxon trees should only be enabled if your discipline has a default tree (EX: Mammalogy has one, Geology doesn't).
  • 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 not to pre-load the taxon tree, the 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.
  • Pre-loaded trees should have had full names generated. You can check the full name preview on a taxon record for example.
  • 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
  • Tree speedup testing (You may have already done some of these)
  • 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.

@alesan99 alesan99 added this to the 7.12.0 milestone Jan 14, 2026
@github-project-automation github-project-automation bot moved this to 📋Back Log in General Tester Board Jan 14, 2026
@alesan99 alesan99 changed the title [Guided Setup] Create default trees automatically during setup [Guided Setup] Add configuration for default trees in guided setup Jan 14, 2026
@alesan99 alesan99 linked an issue Jan 14, 2026 that may be closed by this pull request
@alesan99 alesan99 changed the base branch from issue-2931-1 to issue-6294 January 14, 2026 17:19
Base automatically changed from issue-6294 to issue-2931-1 January 14, 2026 17:49
@alesan99 alesan99 marked this pull request as ready for review January 15, 2026 18:19
Triggered by ad19264 on branch refs/heads/issue-7593
Improve styling
* optimize tree creation

* Fix duplication

* Renumber tree and set full names

* Lint code with ESLint and Prettier

Triggered by cb60fbc on branch refs/heads/issue-7641-1
Clean up backend code for trees in setup tool
Triggered by a75062b on branch refs/heads/issue-7593
@alesan99
Copy link
Contributor Author

@grantfitzsimmons
Addressed your issues 👍

  • Tree rank configuration now uses a table
image
  • Taxon trees now have a selection menu for choosing a specific tree to import. For code simplicity it doesn't filter by discipline though.
image
  • Tree pre-loading has been reworded a bit.

Not sure why taxon tree configuration was still showing up, that shouldn't be there anymore. So that might be the cause of the crash during setup.


For anyone that tested #7669, that PR has now been merged into this one, so those testing instructions have been added here as well.

@CarolineDenis CarolineDenis changed the title [Guided Setup] Add configuration for default trees in guided setup [Guided Setup + Config Tool] Complete configuration tool + default trees import + guided setup Jan 27, 2026
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.

I get this error when trying to setup a DB UnboundLocalError("cannot access local variable 'rank_data' where it is not associated with a value")

01-27_08.51.mp4

@acwhite211
Copy link
Member

@emenslin Pushed a fix for the UnboundLocalError issue. Good to try it out again.

I noticed that is works with a tree like Mammalogy, but got an error reading the rank data for Herpetology:
image

[27/Jan/2026 12:40:06] [ERROR] [specifyweb.backend.setup_tool.setup_tasks:159] Error setting up database: No default ranks found in the Taxon rank JSON file.
Traceback (most recent call last):
  File "/opt/specify7/specifyweb/backend/setup_tool/api.py", line 411, in create_tree
    treedef = start_default_tree_from_configuration(name, kwargs, ranks)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/specify7/specifyweb/backend/setup_tool/tree_defaults.py", line 54, in start_default_tree_from_configuration
    raise Exception(f'No default ranks found in the {tree_type} rank JSON file.')
Exception: No default ranks found in the Taxon rank JSON file.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/specify7/specifyweb/backend/setup_tool/setup_tasks.py", line 131, in setup_database_task
    taxon_result = api.create_taxon_tree(data['taxontreedef'].copy())
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/specify7/specifyweb/backend/setup_tool/api.py", line 363, in create_taxon_tree
    return create_tree('Taxon', data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/specify7/specifyweb/backend/setup_tool/api.py", line 422, in create_tree
    raise SetupError(e)
specifyweb.backend.setup_tool.api.SetupError: No default ranks found in the Taxon rank JSON file.

Looks like it's caused by the json fields maybe not being correct or missing data?
Are we supported all tree types with this PR?

@kwhuber
Copy link
Contributor

kwhuber commented Jan 27, 2026

I am running to an issue similar to @acwhite211. In my case it was with Ichthyology and with the Storage Tree. I tested by leaving Storage Tree ranks as they appear when entering the form and when editing those ranks through the UI.
Screenshot 2026-01-27 at 12 44 51 PM

@emenslin
Copy link
Collaborator

Ran into the same error as @acwhite211 with botany and ornithology but it worked with invert zoology (unsure about others). I did not attempt any customizations with any of these setups so I am not sure if that would cause any other problems (i.e. the storage tree issue mentioned above). Additionally, upon upload of the invert zoology tree it includes all sub and super ranks even if there are no nodes in them, is this intentional?
image

Link to DB if needed: https://blankdbsetup1elizabeth20260127-issue-7593.test.specifysystems.org/specify/tree/taxon/

@acwhite211
Copy link
Member

@emenslin @kwhuber Pushed a commit that seems to fix the issue with Herpetology, will need to test on other trees as well.

@alesan99
Copy link
Contributor Author

alesan99 commented Jan 28, 2026

After discussing this we decided that the tree default files should all have the same format, so I went ahead and simplified the file loading 👍

I am running to an issue similar to @acwhite211. In my case it was with Ichthyology and with the Storage Tree. I tested by leaving Storage Tree ranks as they appear when entering the form and when editing those ranks through the UI.

@kwhuber I'm not entirely sure how this happened on the Storage tree, but I updated all the tree defaults to use the same format so it should be more reliable now. I tested most disciplines and it seems to work again.

Additionally, upon upload of the invert zoology tree it includes all sub and super ranks even if there are no nodes in them, is this intentional?

This is expected behavior for now since the rank configuration was removed (So it always uses the default configuration, which includes those ranks).

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.

Tested on Ichthyology with pre-loaded taxon tree.
Tested on Vertebrate Paleontology without pre-loaded taxon tree.

Most the of tests ran successfully! However, I ran into issue with the Geography tree (see below).

  • Configure ranks for the geography.
  • Test the new pre-load tree check box for geography and taxon trees.
  • The pre-load checkbox for taxon trees should only be enabled if your discipline has a default tree (EX: Mammalogy has one, Geology doesn't).
  • After the setup, make sure the default tree creation process started for the trees you selected to pre-load. (You will see notifications)
    • Notifications appeared correct, however the Geography tree failed to load after creation:
      Screenshot 2026-01-28 at 8 36 12 AM
    • If you chose a paleo/geo database then a chronostrat tree should also be imported automatically.
      • Verified with Vertebrate Paleontology
  • If you chose not to pre-load the taxon tree, the 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.
  • Pre-loaded trees should have had full names generated. You can check the full name preview on a taxon record for example.
  • Configuration tool and existing trees
    • Creating a new discipline with the configuration tool should create an empty taxon tree.
      • Tested with Entomology and ranks matched that discipline
    • An empty taxon tree should have an import button
    • Make sure you can import a taxon tree into the existing empty tree
      • Completed in ~25 seconds
    • Make sure you can still create a new populated tree
  • Tree speedup testing (You may have already done some of these)
    • 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.

@alesan99
Copy link
Contributor Author

  • After the setup, make sure the default tree creation process started for the trees you selected to pre-load. (You will see notifications)

I believe its just a loading error since all the states were moved to the same parent.
To be addressed in #6671

Merging now but all issues will be addressed in the main PR

@alesan99 alesan99 merged commit be389c3 into issue-2931-1 Jan 28, 2026
13 checks passed
@alesan99 alesan99 deleted the issue-7593 branch January 28, 2026 15:44
@github-project-automation github-project-automation bot moved this from Dev Attention Needed to ✅Done in General Tester Board Jan 28, 2026
@alesan99 alesan99 mentioned this pull request Jan 28, 2026
68 tasks
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] Add configuration for default trees to guided setup

7 participants