Skip to content

Incertae sedis placement - #337

Open
vangberg wants to merge 12 commits into
mainfrom
incertae-sedis-placement
Open

vangberg wants to merge 12 commits into
mainfrom
incertae-sedis-placement

Conversation

@vangberg

@vangberg vangberg commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Needs #333 to be merged first.

Screenshots

CleanShot-2026-09-03-13-30-25 CleanShot-2026-09-03-13-30-37

Video walk-through

CleanShot-2026-09-03-13-22-23.mp4

@vangberg vangberg self-assigned this Sep 3, 2026
Comment thread app/models/name/quality_checks.rb Outdated
Comment thread app/models/name.rb Outdated
Comment thread app/models/placement.rb
)
belongs_to(:publication, optional: true)
validates(:name, presence: true)
validates(:parent, presence: true, unless: :incertae_sedis?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This removes the ability to have incertae sedis without a parent. There are almost no cases of that. Wouldn't at least a domain placement always be possible?

Comment thread app/models/placement.rb Outdated
"<i>incertae sedis</i>#{qualifier}".html_safe
end

def incertae_sedis_parent_rank

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

More like minimum_incertae_sedis_parent_rank?

@vangberg
vangberg force-pushed the incertae-sedis-placement branch from ddc7646 to 62b0b5a Compare September 3, 2026 11:57
@vangberg
vangberg force-pushed the remove-legacy-incertae-sedis branch 2 times, most recently from bf35ee5 to a537e97 Compare September 3, 2026 12:12
@vangberg
vangberg force-pushed the incertae-sedis-placement branch from 62b0b5a to 0340bcf Compare September 3, 2026 12:12
@vangberg
vangberg force-pushed the remove-legacy-incertae-sedis branch from a537e97 to 308f14d Compare September 3, 2026 12:30
@vangberg
vangberg force-pushed the incertae-sedis-placement branch from 0340bcf to ef9da4a Compare September 3, 2026 12:30
@vangberg
vangberg force-pushed the remove-legacy-incertae-sedis branch from 308f14d to 5630d05 Compare September 3, 2026 12:43
@vangberg
vangberg force-pushed the remove-legacy-incertae-sedis branch from 5630d05 to 73966e2 Compare September 3, 2026 12:46
@vangberg
vangberg force-pushed the incertae-sedis-placement branch from ef9da4a to 86c44cb Compare September 3, 2026 12:46
Comment thread app/models/tutorial/batch.rb Outdated

private

def save_batch_placement(name, attributes)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I need to see if we can re-use existing paths for this logic.

@vangberg
vangberg force-pushed the incertae-sedis-placement branch from f15f0f4 to 86c44cb Compare September 8, 2026 09:01
@vangberg
vangberg force-pushed the incertae-sedis-placement branch from 50ee332 to 33154e7 Compare September 8, 2026 09:31

@vangberg vangberg left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@lmrodriguezr Ready for review

We have 7 names with incertae sedis without clarifying if they are bacteria or archaea. I think we will just have to manually go through them.

irb(main):023> Placement.where(incertae_sedis: "Incertae sedis").map(&:name)

incertae_sedis_text: par['description']
}
name = Name.find_by_variants(par['name'])
placement = name.placements.find_or_initialize_by(parent: parent)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Duplication. I wanna tackle this in another PR as previously discussed.

Comment thread app/models/name.rb Outdated
message: 'can only contain letters, dashes, dots, and apostrophe'
}
)
validates(:incertae_sedis, inclusion: { in: [true, false] }, allow_nil: true)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is gone when rebased against main.

# GET /names/autocomplete.json?q=Allo&rank=genus
# GET /names/autocomplete.json?q=Pseu&minimum_rank=class
# GET /names/autocomplete.json?q=Allo&ranks=genus
# GET /names/autocomplete.json?q=Pseu&ranks=domain,phylum,class

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've combined these two params into a single param. So you just specify a list of ranks that are allowed. For known placements that list is just ["genus"] if name is a species etc.

},
failure: ->(_w, n) {
n.class.ranks.index(n.rank) != n.class.ranks.index(n.parent.rank) + 1
!n.placement.allowed_parent_ranks.include?(n.placement.parent.rank)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In a previous version of this pull req I added a new quality check for the incertae sedis rank. WIth the new Placement#allowed_parent_ranks method they can easily be combined in a single quality check. @lmrodriguezr Please double check that this is OK :)

@vangberg
vangberg marked this pull request as ready for review September 8, 2026 09:33
Base automatically changed from remove-legacy-incertae-sedis to main September 8, 2026 14:07
@lmrodriguezr

Copy link
Copy Markdown
Member

@lmrodriguezr Ready for review

We have 7 names with incertae sedis without clarifying if they are bacteria or archaea. I think we will just have to manually go through them.

irb(main):023> Placement.where(incertae_sedis: "Incertae sedis").map(&:name)
irb(main):002> Placement.where(incertae_sedis: "Incertae sedis").map(&:name).pluck(:name)
=> ["Adamsella", "Nitrosotaleales", "Endohaliclona", "Syntrophaliphaticia", "Acidifodinimicrobiaceae", "Hakubellales", "Chazhemtonibacteriaceae"]

Comment thread app/models/placement.rb Fixed
@vangberg

vangberg commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@lmrodriguezr Ready to review/merge

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants