Module: AssertedDistribution::DwcExtensions
- Extended by:
- ActiveSupport::Concern
- Included in:
- AssertedDistribution
- Defined in:
- app/models/asserted_distribution/dwc_extensions.rb
Constant Summary collapse
- DWC_OCCURRENCE_MAP =
{ associatedReferences: :dwc_associated_references, country: :dwc_country, county: :dwc_county, occurrenceStatus: :dwc_occurrence_status, stateProvince: :dwc_state_province, kingdom: :dwc_kingdom, family: :dwc_family, genus: :dwc_genus, specificEpithet: :dwc_specific_epithet, infraspecificEpithet: :dwc_infraspecific_epithet, scientificName: :dwc_scientific_name, scientificNameAuthorship: :dwc_taxon_name_authorship, taxonRank: :dwc_taxon_rank, }.freeze
Instance Attribute Summary collapse
-
#geographic_names ⇒ Object
Returns the value of attribute geographic_names.
Instance Method Summary collapse
-
#dwc_associated_references ⇒ Object
TODO: If this is altered there are implications for sources section in PaperCatalog.
- #dwc_country ⇒ Object
- #dwc_county ⇒ Object
- #dwc_family ⇒ Object
- #dwc_genus ⇒ Object
- #dwc_infraspecific_epithet ⇒ Object
- #dwc_kingdom ⇒ Object
- #dwc_occurrence_status ⇒ Object
- #dwc_scientific_name ⇒ Object
- #dwc_specific_epithet ⇒ Object
- #dwc_state_province ⇒ Object
- #dwc_taxon_name_authorship ⇒ Object
- #dwc_taxon_rank ⇒ Object
Instance Attribute Details
#geographic_names ⇒ Object
Returns the value of attribute geographic_names.
23 24 25 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 23 def geographic_names @geographic_names end |
Instance Method Details
#dwc_associated_references ⇒ Object
TODO: If this is altered there are implications for sources section in PaperCatalog.
64 65 66 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 64 def dwc_associated_references sources.order(:cached_nomenclature_date).map(&:cached).uniq.join(AssertedDistribution::DWC_DELIMITER) end |
#dwc_country ⇒ Object
72 73 74 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 72 def dwc_country geographic_names[:country] end |
#dwc_county ⇒ Object
80 81 82 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 80 def dwc_county geographic_names[:county] end |
#dwc_family ⇒ Object
30 31 32 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 30 def dwc_family taxonomy['family'] end |
#dwc_genus ⇒ Object
35 36 37 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 35 def dwc_genus taxonomy['genus'] && taxonomy['genus'].compact.join(' ').presence end |
#dwc_infraspecific_epithet ⇒ Object
44 45 46 47 48 49 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 44 def dwc_infraspecific_epithet %w{variety form subspecies}.each do |n| # add more as observed return taxonomy[n].last if taxonomy[n] end nil end |
#dwc_kingdom ⇒ Object
25 26 27 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 25 def dwc_kingdom taxonomy['kingdom'] end |
#dwc_occurrence_status ⇒ Object
68 69 70 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 68 def dwc_occurrence_status is_absent ? 'absent' : 'present' end |
#dwc_scientific_name ⇒ Object
51 52 53 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 51 def dwc_scientific_name otu.taxon_name&.valid_taxon_name&. end |
#dwc_specific_epithet ⇒ Object
40 41 42 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 40 def dwc_specific_epithet taxonomy['species'] && taxonomy['species'].compact.join(' ').presence end |
#dwc_state_province ⇒ Object
76 77 78 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 76 def dwc_state_province geographic_names[:state] end |
#dwc_taxon_name_authorship ⇒ Object
55 56 57 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 55 def otu.taxon_name&.valid_taxon_name&. end |
#dwc_taxon_rank ⇒ Object
59 60 61 |
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 59 def dwc_taxon_rank otu.taxon_name&.valid_taxon_name&.rank end |