Skip to content

Issue 3724 2 - #8437

Open
CarolineDenis wants to merge 7 commits into
issue-3724from
issue-3724-2
Open

Issue 3724 2#8437
CarolineDenis wants to merge 7 commits into
issue-3724from
issue-3724-2

Conversation

@CarolineDenis

@CarolineDenis CarolineDenis commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #3724

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
  • Add migration function to
    def fix_schema_config(stdout: WriteToStdOut | None = None):

Testing instructions

Summary by CodeRabbit

  • New Features
    • Taxon tree statistics can now include counts from synonymized descendants.
    • Added preferences to display synonym counts and choose the taxon query field.
    • Synonym-aware usage details and tooltips are shown for tree and leaf nodes.
  • Bug Fixes
    • Synonym-only nodes remain visible when empty nodes are hidden.
  • Localization
    • Added English labels and descriptions for synonym counts and taxon query settings.
  • Tests
    • Added coverage for tree statistics with and without synonym counts.

@github-actions

Copy link
Copy Markdown

Warning

One or more dependencies are approaching or past End-of-Life.
Please plan upgrades accordingly.

STATUS=WARNING
NODE_VERSION=20
NODE_CYCLE=20
EOL_DATE=2026-04-30
DAYS_REMAINING=-116

--- Node.js ---
Version: 20
EOL: 2026-04-30
Status: WARNING

STATUS=OK
PYTHON_VERSION=3.12
PYTHON_CYCLE=3.12
EOL_DATE=2028-10-31
DAYS_REMAINING=799

--- Python ---
Version: 3.12
EOL: 2028-10-31
Status: OK

STATUS=WARNING
DJANGO_VERSION=4.2
DJANGO_CYCLE=4.2
EOL_DATE=2026-04-07
DAYS_REMAINING=-139

--- Django ---
Version: 4.2
EOL: 2026-04-07
Status: WARNING


@CarolineDenis
CarolineDenis changed the base branch from main to issue-3724 August 24, 2026 13:11
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d674583-0559-46f3-8186-3732343c7421

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b6c1606b-9f57-4372-8b71-a2c66e9372d9

📥 Commits

Reviewing files that changed from the base of the PR and between b8d2595 and a129ea0.

📒 Files selected for processing (10)
  • specifyweb/backend/trees/stats.py
  • specifyweb/backend/trees/views.py
  • specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx
  • specifyweb/frontend/js_src/lib/components/QueryBuilder/fromTree.ts
  • specifyweb/frontend/js_src/lib/components/TreeView/Row.tsx
  • specifyweb/frontend/js_src/lib/components/TreeView/Tree.tsx
  • specifyweb/frontend/js_src/lib/components/TreeView/__tests__/formatTreeStats.test.ts
  • specifyweb/frontend/js_src/lib/components/TreeView/helpers.ts
  • specifyweb/frontend/js_src/lib/localization/preferences.ts
  • specifyweb/frontend/js_src/lib/localization/tree.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Taxon tree statistics can now include counts for synonymized determinations. New preferences select synonym display and the Taxon query field. Tree rendering, empty-node handling, localization, and formatting tests support the new counts.

Changes

Taxon synonym count support

Layer / File(s) Summary
Backend synonym statistics
specifyweb/backend/trees/stats.py, specifyweb/backend/trees/views.py
The statistics endpoint accepts includeSynonymCount. When enabled, it aggregates synonymized determination counts across each child subtree.
Taxon query preferences
specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx, specifyweb/frontend/js_src/lib/components/QueryBuilder/fromTree.ts
The Taxon tree editor adds showSynonymCounts and queryField preferences. Taxon queries use the selected preferredTaxon or taxon field.
Tree statistics display and validation
specifyweb/frontend/js_src/lib/components/TreeView/Tree.tsx, specifyweb/frontend/js_src/lib/components/TreeView/helpers.ts, specifyweb/frontend/js_src/lib/components/TreeView/Row.tsx, specifyweb/frontend/js_src/lib/components/TreeView/__tests__/formatTreeStats.test.ts, specifyweb/frontend/js_src/lib/localization/*.ts
The tree requests, parses, and displays synonym counts. Synonym-only nodes remain visible, and formatting tests cover leaf and internal nodes.

Sequence Diagram(s)

sequenceDiagram
  participant Tree
  participant tree_stats
  participant get_tree_stats
  participant get_synonym_counts
  Tree->>tree_stats: Request taxon stats with includeSynonymCount=true
  tree_stats->>get_tree_stats: Pass include_synonym_count=true
  get_tree_stats->>get_synonym_counts: Aggregate synonym counts by child subtree
  get_synonym_counts-->>get_tree_stats: Return counts keyed by child ID
  get_tree_stats-->>Tree: Return statistics with synonym counts
Loading

Suggested reviewers: grantfitzsimmons

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Testing Instructions ⚠️ Warning The PR's Testing instructions section contains only template comments; it gives no steps for the changed stats endpoint, preferences, query behavior, or taxon-tree display. Add reproducible setup and verification steps for the Taxon tree, both preference modes, synonym counts, query-field selection, and the added frontend test command.
Title check ❓ Inconclusive The title references issue #3724 but does not describe the synonym count changes. Replace it with a concise summary such as "Add synonym counts to the taxon tree".
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The changes implement accurate synonymized-node and preferred-term record counts in the taxon tree as required by [#3724].
Out of Scope Changes check ✅ Passed All changes support synonym-aware taxon tree counts, query selection, display, endpoint behavior, or related tests for [#3724].
Automatic Tests ✅ Passed The PR adds formatTreeStats.test.ts with five Jest cases for leaf/internal synonym counts and tooltips; Jest testMatch discovers this tests/*.test.ts file.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-3724-2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@grantfitzsimmons
grantfitzsimmons self-requested a review August 24, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋Back Log

Development

Successfully merging this pull request may close these issues.

Synonymized nodes are not counted in the tree

1 participant