Module: Export::Coldp::Files::VernacularName
- Defined in:
- lib/export/coldp/files/vernacular_name.rb
Overview
taxon_id name - ORIGINAL LANGUAGE transliteration - language country area lifestage sex reference_id
Class Method Summary collapse
- .area(common_name) ⇒ Object
- .generate(otus, reference_csv = nil) ⇒ Object
-
.life_stage(common_name) ⇒ Object
TODO: Map to biocuration attribute via URI hopefully.
-
.reference_id(common_name) ⇒ Object
“supporting the taxonomic concept” Potentially- all other Citations tied to Otu, what exactly supports a concept? Not used internally, for reference only.
-
.sex(common_name) ⇒ Object
TODO: Map to biocuration attribute via URI hopefully.
-
.transliteration(common_name) ⇒ Object
return the 'English' translation(s) if available.
Class Method Details
.area(common_name) ⇒ Object
24 25 26 |
# File 'lib/export/coldp/files/vernacular_name.rb', line 24 def self.area(common_name) common_name.geographic_area&.self_and_ancestors&.collect{|a| a.name}&.join('; ') end |
.generate(otus, reference_csv = nil) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/export/coldp/files/vernacular_name.rb', line 47 def self.generate(otus, reference_csv = nil ) # TODO tabs delimit CSV.generate(col_sep: "\t") do |csv| # TODO: Biocuration attribuets on these two # lifestage # sex csv << %w{ taxonID name transliteration language country area referenceID } otus.each do |o| o.common_names.each do |n| sources = n.sources.load csv << [ o.id, n.name, transliteration(n), n.language&.alpha_3_bibliographic, n.geographic_area&.level0&.iso_3166_a2, area(n), sources.collect{|a| a.id}.join(',') # reference_id ] Export::Coldp::Files::Reference.add_reference_rows(sources, reference_csv) if reference_csv && sources.any? end end end end |
.life_stage(common_name) ⇒ Object
TODO: Map to biocuration attribute via URI hopefully
29 30 31 |
# File 'lib/export/coldp/files/vernacular_name.rb', line 29 def self.life_stage(common_name) nil end |
.reference_id(common_name) ⇒ Object
“supporting the taxonomic concept” Potentially- all other Citations tied to Otu, what exactly supports a concept? Not used internally, for reference only
41 42 43 44 45 |
# File 'lib/export/coldp/files/vernacular_name.rb', line 41 def self.reference_id(common_name) i = common_name.sources.pluck(:id) return i.join(',') if i.any? nil end |
.sex(common_name) ⇒ Object
TODO: Map to biocuration attribute via URI hopefully
34 35 36 |
# File 'lib/export/coldp/files/vernacular_name.rb', line 34 def self.sex(common_name) nil end |
.transliteration(common_name) ⇒ Object
return the 'English' translation(s) if available
15 16 17 18 19 20 21 22 |
# File 'lib/export/coldp/files/vernacular_name.rb', line 15 def self.transliteration(common_name) n = common_name.alternate_values.where(type: 'AlternateValue::Translation', alternate_value_object_attribute: :name).load if n.any? n.collect{|a| a.language.name == 'English' ? a.language.name : nil}.compact.join('; ') else nil end end |