Module: TaxonWorks::Analysis::AssertedDistribution::BasicEndemism
- Defined in:
- lib/taxonworks/analysis/asserted_distribution/basic_endemism.rb
Class Method Summary collapse
-
.quick_endemism(taxon_name, geographic_area) ⇒ Hash
A very simple report summarizing asserted distributions !! only a single geographic area is used (not its children).
Class Method Details
.quick_endemism(taxon_name, geographic_area) ⇒ Hash
Returns a very simple report summarizing asserted distributions !! only a single geographic area is used (not its children).
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/taxonworks/analysis/asserted_distribution/basic_endemism.rb', line 11 def self.quick_endemism(taxon_name, geographic_area) data = { } otus = Otu.descendant_of_taxon_name(taxon_name.id) return {} if otus.count > 2000 ::AssertedDistribution.where( geographic_area:, project: taxon_name.project, otu: otus ).find_each do |a| e = ::AssertedDistribution.where(project: taxon_name.project, otu: a.otu).where.not(geographic_area:).count n = a.otu.taxon_name&.valid_taxon_name if e == 0 && !data[n] data[n] = false else data[n] = true end end data end |