Skip to content

Error on unparsable classification string. #3740

@JoeCohen

Description

@JoeCohen

Failed to import iNat 314859861: Unable to parse: ‘Opisthokonts’
Weird
"The opisthokonts are a broad group of eukaryotes, including both the animal and fungus kingdoms. The opisthokonts, previously called the "Fungi/Metazoa group". https://www.google.com/search?q=Opisthokonts

The problem is entirely in MO. The classification string for Name 15121, Neonectria faginata (M.L. Lohman, A.M.J. Watson & Ayers) Castl. & Rossman is screwed up.

We should:

  • Not throw an Error if the classification string is unparseable.
  • Prevent saving unparseable Classification strings. (We may have already done this. IDK when this string was saved.)
mushroom-observer(dev)> Name.find(15121).classification
=> "Opisthokonts\r\nFungi\r\nDikarya\r\nAscomycota\r\nPezizomycotina\r\nSordariomycetes\r\nHypocreomycetidae\r\nHypocreales\r\nNectriaceae[1]"

To replicate locally:

  • Load a pre-20260115 db dump (I will fix the Name on 14 Jan because the messed-up classification prevents importing iNat observations named Neonectria faginata.)
  • http://localhost:3000/names/15121
  • Result:
RuntimeError in Names#show
Showing /Users/joe/mushroom-observer/app/views/controllers/names/show/_observations_menu.html.erb where line #42 raised:

Unable to parse: ‘Opisthokonts’
Extracted source (around line #601):
              
            results.push([line_rank, line_name])
          elsif line.present?
            raise(:runtime_invalid_classification.t(text: line))
          end
        end
      end

Trace of template inclusion: #<ActionView::Template app/views/controllers/names/show.html.erb locals=[]>

Rails.root: /Users/joe/mushroom-observer

Application Trace | Framework Trace | Full Trace
app/models/name/taxonomy.rb:601:in `block in parse_classification'
app/models/name/taxonomy.rb:591:in `each'
app/models/name/taxonomy.rb:591:in `parse_classification'
app/models/name/taxonomy.rb:290:in `parse_classification'
app/models/name/taxonomy.rb:111:in `kingdom'
app/models/name/taxonomy.rb:93:in `unsearchable_in_registry?'
app/models/name/taxonomy.rb:89:in `searchable_in_registry?'
app/views/controllers/names/show/_observations_menu.html.erb:42
app/views/controllers/names/show/_observations_menu.html.erb:33
app/views/controllers/names/show/_observations_menu.html.erb:31
app/views/controllers/names/show/_observations_menu.html.erb:13
app/components/panel.rb:192:in `render_plain_body'
app/components/panel.rb:185:in `render_body'
app/components/panel.rb:80:in `block in <class:Panel>'
app/components/panel.rb:172:in `block in render_middle_sections'
app/components/panel.rb:172:in `each'
app/components/panel.rb:172:in `render_middle_sections'
app/components/panel.rb:166:in `render_thumbnail_and_body'
app/components/panel.rb:95:in `block in view_template'
app/components/panel.rb:89:in `view_template'
app/views/controllers/names/show/_observations_menu.html.erb:7
app/views/controllers/names/show.html.erb:39
app/views/controllers/names/show.html.erb:37
app/views/controllers/names/show.html.erb:13
app/controllers/application_controller.rb:149:in `catch_errors_and_log_request_stats'
Request
Parameters:

{"id"=>"15121"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions