app/models/tramea.rb
# TODO: Eventually I would LOVE to add a key called "taxon_concept_history"
# where we store entry ids with taxon_concept ids and the curator or process
# name that associated the two (and a timestamp for the move).
Eventually I would LOVE to add a key called "taxon_concept_history"
where we store entry ids with taxon_concept ids and the curator or process
name that associated the two (and a timestamp for the move).
Eventually I would LOVE to add a key called " taxon_concept_history " where we store entry ids with taxon_concept ids and the curator or process name that associated the two ( and a timestamp for the move ) .
def node_from_hierarchy_entry(entry, options = {})
      hash = {
        "id" => entry.id,
        "taxon_concept_id" => entry.taxon_concept_id,
        "exemplar" =>
          TaxonConceptPreferredEntry.exists?(hierarchy_entry_id: entry.id),
        "scientific_name" => entry.name.string,
        "rank" => entry.rank.label.firstcap
      }
      return hash if options[:lite]
      hash.merge({
        "source" => {
          "content_partner_id" => entry.hierarchy.content_partner.id,
          "resource_id" => entry.hierarchy.resource.id,
          "name" => entry.hierarchy.resource.title,
          "id" => entry.identifier,
          "url" => entry.outlink_url,
          "browsable_on_eol" => entry.hierarchy.browsable?
        },
        "data_ids" => entry.data_object_ids,
        "ancestors" => entry.ancestors.map do |ancestor|
          node_from_hierarchy_entry(ancestor, lite: true)
        end,
        "children" => entry.children.map do |child|
          node_from_hierarchy_entry(child, lite: true)
        end,
        "siblings" => entry.siblings.map do |sibling|
          node_from_hierarchy_entry(sibling, lite: true)
        end
      })
    end
def node_from_hierarchy_entry ( entry , options = { } ) hash = { "id" => entry . id , "taxon_concept_id" => entry . taxon_concept_id , "exemplar" => TaxonConceptPreferredEntry . exists? ( hierarchy_entry_id : entry . id ) , "scientific_name" => entry . name . string , "rank" => entry . rank . label . firstcap } return hash if options [ :lite ] hash . merge ( { "source" => { "content_partner_id" => entry . hierarchy . content_partner . id , "resource_id" => entry . hierarchy . resource . id , "name" => entry . hierarchy . resource . title , "id" => entry . identifier , "url" => entry . outlink_url , "browsable_on_eol" => entry . hierarchy . browsable? } , "data_ids" => entry . data_object_ids , "ancestors" => entry . ancestors . map do | ancestor | node_from_hierarchy_entry ( ancestor , lite : true ) end , "children" => entry . children . map do | child | node_from_hierarchy_entry ( child , lite : true ) end , "siblings" => entry . siblings . map do | sibling | node_from_hierarchy_entry ( sibling , lite : true ) end } ) end
TODO: Eventually I would LOVE to add a key called "taxon_concept_history"
where we store entry ids with taxon_concept ids and the curator or process
name that associated the two (and a timestamp for the move).
TODO : Eventually I would LOVE to add a key called " taxon_concept_history " where we store entry ids with taxon_concept ids and the curator or process name that associated the two ( and a timestamp for the move ) .
# ARRRRRGH: Hierarchy#content_partner is a METHOD. :| It's because there # are some other "types" of resources that don't dierecly have a CP. # TODO: It might be nice to group these by data type, actually:
entry
<not_specific>
options
<not_specific>