Class: Autoselect::Otu::Levels::ColValidName
- Includes:
- Levels::ColResolvedName
- Defined in:
- lib/autoselect/otu/levels/col_valid_name.rb
Overview
Delegates to the TaxonName ColValidName level (which resolves the term through Catalogue of Life synonymy to its accepted name) — e.g. a label was transcribed with an outdated/synonymized name, and the curator wants the OTU CoL now recognizes.
Wraps TaxonName::ColValidName#resolve_targets' pseudo-records (flagged
with resolved_from:) with the OTU creation hook. The one thing with
no TaxonName-level equivalent: the hook carries the resolved name's
existing Otu, if any (see Autoselect::Otu::ColExistingOtu).
Constant Summary
Constants included from Levels::ColSourceMark
Levels::ColSourceMark::COL_ICON, Levels::ColSourceMark::TW_ICON
Constants inherited from Level
Level::DEFAULT_FUSE_MS, Level::EXTERNAL_FUSE_MS, Level::MINIMUM_RESULTS
Instance Method Summary collapse
-
#call(term:, operator: nil, project_id: nil, user_id: nil, dataset_id: nil, **_kwargs) ⇒ Array<OpenStruct>
A CoL result per resolved valid name, whose hook carries the name's existing Otu, if any.
- #description ⇒ Object
- #external? ⇒ Boolean
-
#is_default ⇒ Object
Opt-in only — see the class comment above.
- #key ⇒ Object
- #label ⇒ Object
-
#options_level ⇒ Object
Searches with the CoL dataset chosen for the catalogue_of_life level.
- #record_label(record) ⇒ Object
- #record_label_html(record, term = nil) ⇒ Object
Methods included from Levels::ColResolvedName
#col_resolved_badges, #record_info, #record_info_html, #resolved_from, #resolved_synonym
Methods included from Levels::ColSourceMark
#col_existing_record?, #col_source_icon, #col_source_tag
Methods inherited from Level
#fuse_ms, #metadata, #minimum_results, #model_key, #record_info, #record_info_html
Instance Method Details
#call(term:, operator: nil, project_id: nil, user_id: nil, dataset_id: nil, **_kwargs) ⇒ Array<OpenStruct>
Returns a CoL result per resolved valid name, whose hook carries the name's existing Otu, if any.
63 64 65 66 67 68 69 70 71 |
# File 'lib/autoselect/otu/levels/col_valid_name.rb', line 63 def call( term:, operator: nil, project_id: nil, user_id: nil, dataset_id: nil, **_kwargs ) targets = ::Autoselect::TaxonName::Levels::ColValidName.new .resolve_targets(term, project_id:, dataset_id:) ::Autoselect::Otu::ColExistingOtu.wrap(targets, project_id:) end |
#description ⇒ Object
27 28 29 |
# File 'lib/autoselect/otu/levels/col_valid_name.rb', line 27 def description 'Resolve the term through Catalogue of Life synonymy to its accepted name, then match an existing OTU by that name — offering to create it if none exists yet.' end |
#external? ⇒ Boolean
31 32 33 |
# File 'lib/autoselect/otu/levels/col_valid_name.rb', line 31 def external? true end |
#is_default ⇒ Object
Opt-in only — see the class comment above.
41 42 43 |
# File 'lib/autoselect/otu/levels/col_valid_name.rb', line 41 def is_default false end |
#key ⇒ Object
19 20 21 |
# File 'lib/autoselect/otu/levels/col_valid_name.rb', line 19 def key :col_valid_name end |
#label ⇒ Object
23 24 25 |
# File 'lib/autoselect/otu/levels/col_valid_name.rb', line 23 def label 'CoL Valid Name' end |
#options_level ⇒ Object
Searches with the CoL dataset chosen for the catalogue_of_life level.
36 37 38 |
# File 'lib/autoselect/otu/levels/col_valid_name.rb', line 36 def :catalogue_of_life end |
#record_label(record) ⇒ Object
45 46 47 48 |
# File 'lib/autoselect/otu/levels/col_valid_name.rb', line 45 def record_label(record) return record.name.to_s if record.respond_to?(:_col_extension) super end |
#record_label_html(record, term = nil) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/autoselect/otu/levels/col_valid_name.rb', line 50 def record_label_html(record, term = nil) if record.respond_to?(:_col_extension) return ERB::Util.html_escape(record.name.to_s) end super end |