Module: AssertedDistribution::DwcExtensions
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
Shared::IsDwcOccurrence::DWC_DELIMITER, Shared::IsDwcOccurrence::VIEW_EXCLUSIONS
Instance Attribute Summary collapse
Instance Method Summary
collapse
#dwc_occurrence_attribute_values, #dwc_occurrence_attributes, #dwc_occurrence_id, #get_dwc_occurrence, #set_dwc_occurrence
Instance Attribute Details
#geographic_names ⇒ Object
Returns the value of attribute geographic_names.
24
25
26
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 24
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.
65
66
67
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 65
def dwc_associated_references
sources.order(:cached_nomenclature_date).map(&:cached).uniq.join(AssertedDistribution::DWC_DELIMITER)
end
|
#dwc_country ⇒ Object
73
74
75
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 73
def dwc_country
geographic_names[:country]
end
|
#dwc_county ⇒ Object
81
82
83
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 81
def dwc_county
geographic_names[:county]
end
|
#dwc_family ⇒ Object
31
32
33
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 31
def dwc_family
taxonomy['family']
end
|
#dwc_genus ⇒ Object
36
37
38
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 36
def dwc_genus
taxonomy['genus'] && taxonomy['genus'].compact.join(' ').presence
end
|
#dwc_infraspecific_epithet ⇒ Object
45
46
47
48
49
50
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 45
def dwc_infraspecific_epithet
%w{variety form subspecies}.each do |n| return taxonomy[n].last if taxonomy[n]
end
nil
end
|
#dwc_kingdom ⇒ Object
26
27
28
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 26
def dwc_kingdom
taxonomy['kingdom']
end
|
#dwc_occurrence_status ⇒ Object
69
70
71
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 69
def dwc_occurrence_status
is_absent == true ? 'absent' : 'present'
end
|
#dwc_scientific_name ⇒ Object
52
53
54
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 52
def dwc_scientific_name
otu.taxon_name&.valid_taxon_name&.cached_name_and_author_year
end
|
#dwc_specific_epithet ⇒ Object
41
42
43
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 41
def dwc_specific_epithet
taxonomy['species'] && taxonomy['species'].compact.join(' ').presence
end
|
#dwc_state_province ⇒ Object
77
78
79
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 77
def dwc_state_province
geographic_names[:state]
end
|
#dwc_taxon_name_authorship ⇒ Object
56
57
58
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 56
def dwc_taxon_name_authorship
otu.taxon_name&.valid_taxon_name&.cached_author_year
end
|
#dwc_taxon_rank ⇒ Object
60
61
62
|
# File 'app/models/asserted_distribution/dwc_extensions.rb', line 60
def dwc_taxon_rank
otu.taxon_name&.valid_taxon_name&.rank
end
|