Module: BiologicalAssociation::GlobiExtensions
- Extended by:
- ActiveSupport::Concern
- Included in:
- BiologicalAssociation
- Defined in:
- app/models/biological_association/globi_extensions.rb
Instance Method Summary collapse
-
#globi_extension_json ⇒ Object
Don’t use dwc_.
-
#globi_extension_row ⇒ Object
Don’t use dwc_.
-
#globi_interaction_type_id ⇒ Object
—.
- #globi_interaction_type_name ⇒ Object
- #globi_source_catalog_number ⇒ Object
- #globi_source_collection_code ⇒ Object
- #globi_source_institution_code ⇒ Object
- #globi_source_life_stage_id ⇒ Object
- #globi_source_life_stage_name ⇒ Object
-
#globi_source_occurrence_id ⇒ Object
TODO: use alias.
- #globi_source_sex_id ⇒ Object
- #globi_source_sex_name ⇒ Object
- #globi_source_taxon_name ⇒ Object
- #globi_source_taxon_path ⇒ Object
- #globi_source_taxon_rank ⇒ Object
- #globi_target_catalog_number ⇒ Object
- #globi_target_collection_code ⇒ Object
- #globi_target_institution_code ⇒ Object
- #globi_target_life_stage_id ⇒ Object
- #globi_target_life_stage_name ⇒ Object
-
#globi_target_occurrence_id ⇒ Object
TODO: use alias.
- #globi_target_sex_id ⇒ Object
- #globi_target_sex_name ⇒ Object
- #globi_target_taxon_name ⇒ Object
- #globi_target_taxon_path ⇒ Object
- #globi_target_taxon_rank ⇒ Object
Instance Method Details
#globi_extension_json ⇒ Object
Don’t use dwc_
83 84 85 86 87 88 89 90 91 |
# File 'app/models/biological_association/globi_extensions.rb', line 83 def globi_extension_json r = {} Export::CSV::Globi::HEADERS.each do |h| if m = GLOBI_EXTENSION_MAP[h.to_sym] r[h] = send(m) end end r end |
#globi_extension_row ⇒ Object
Don’t use dwc_
70 71 72 73 74 75 76 77 78 79 80 |
# File 'app/models/biological_association/globi_extensions.rb', line 70 def globi_extension_row r = [] Export::CSV::Globi::HEADERS.each do |h| if m = GLOBI_EXTENSION_MAP[h.to_sym] r.push send(m) else r.push nil end end r end |
#globi_interaction_type_id ⇒ Object
178 179 180 |
# File 'app/models/biological_association/globi_extensions.rb', line 178 def globi_interaction_type_id dwc_relationship_of_resource_id end |
#globi_interaction_type_name ⇒ Object
182 183 184 |
# File 'app/models/biological_association/globi_extensions.rb', line 182 def globi_interaction_type_name dwc_relationship_of_resource end |
#globi_source_catalog_number ⇒ Object
102 103 104 105 106 |
# File 'app/models/biological_association/globi_extensions.rb', line 102 def globi_source_catalog_number if biological_association_subject_type == 'CollectionObject' biological_association_subject.dwc_catalog_number end end |
#globi_source_collection_code ⇒ Object
108 109 110 111 112 |
# File 'app/models/biological_association/globi_extensions.rb', line 108 def globi_source_collection_code if biological_association_subject_type == 'CollectionObject' biological_association_subject.dwc_collection_code end end |
#globi_source_institution_code ⇒ Object
114 115 116 117 118 119 |
# File 'app/models/biological_association/globi_extensions.rb', line 114 def globi_source_institution_code if biological_association_subject_type == 'CollectionObject' biological_association_subject.dwc_institution_code else end end |
#globi_source_life_stage_id ⇒ Object
141 142 143 144 145 146 147 148 |
# File 'app/models/biological_association/globi_extensions.rb', line 141 def globi_source_life_stage_id if biological_association_subject_type == 'CollectionObject' biological_association_subject.biocuration_classes.tagged_with_uri(::DWC_ATTRIBUTE_URIS[:lifeStage]) .pluck(:uri)&.join(', ').presence else nil # Maybe some OTU data attribute property list as above end end |
#globi_source_life_stage_name ⇒ Object
150 151 152 153 154 155 156 |
# File 'app/models/biological_association/globi_extensions.rb', line 150 def globi_source_life_stage_name if biological_association_subject_type == 'CollectionObject' biological_association_subject.dwc_life_stage else nil # Maybe some OTU data attribute property list end end |
#globi_source_occurrence_id ⇒ Object
TODO: use alias
94 95 96 97 98 99 100 |
# File 'app/models/biological_association/globi_extensions.rb', line 94 def globi_source_occurrence_id if biological_association_subject_type == 'CollectionObject' biological_association_object.dwc_occurrence_id end # dwc_resource_id end |
#globi_source_sex_id ⇒ Object
158 159 160 161 162 163 164 165 |
# File 'app/models/biological_association/globi_extensions.rb', line 158 def globi_source_sex_id if biological_association_subject_type == 'CollectionObject' biological_association_subject.biocuration_classes.tagged_with_uri(::DWC_ATTRIBUTE_URIS[:sex]) .pluck(:uri)&.join(', ').presence else nil # Maybe some OTU data attribute property list as above end end |
#globi_source_sex_name ⇒ Object
167 168 169 170 171 172 173 |
# File 'app/models/biological_association/globi_extensions.rb', line 167 def globi_source_sex_name if biological_association_subject_type == 'CollectionObject' biological_association_subject.dwc_sex else nil # Maybe some OTU data attribute property list end end |
#globi_source_taxon_name ⇒ Object
121 122 123 124 125 126 127 |
# File 'app/models/biological_association/globi_extensions.rb', line 121 def globi_source_taxon_name if biological_association_subject_type == 'CollectionObject' biological_association_subject.dwc_scientific_name else dwc_resource end end |
#globi_source_taxon_path ⇒ Object
137 138 139 |
# File 'app/models/biological_association/globi_extensions.rb', line 137 def globi_source_taxon_path ApplicationController.helpers.ancestry_path(biological_association_subject.ancestry) end |
#globi_source_taxon_rank ⇒ Object
129 130 131 132 133 134 135 |
# File 'app/models/biological_association/globi_extensions.rb', line 129 def globi_source_taxon_rank if biological_association_subject_type == 'CollectionObject' biological_association_subject.dwc_taxon_rank else biological_association_subject.taxon_name&.rank end end |
#globi_target_catalog_number ⇒ Object
196 197 198 199 200 |
# File 'app/models/biological_association/globi_extensions.rb', line 196 def globi_target_catalog_number if biological_association_object_type == 'CollectionObject' biological_association_object.dwc_catalog_number end end |
#globi_target_collection_code ⇒ Object
202 203 204 205 206 |
# File 'app/models/biological_association/globi_extensions.rb', line 202 def globi_target_collection_code if biological_association_object_type == 'CollectionObject' biological_association_object.dwc_collection_code end end |
#globi_target_institution_code ⇒ Object
208 209 210 211 212 213 |
# File 'app/models/biological_association/globi_extensions.rb', line 208 def globi_target_institution_code if biological_association_object_type == 'CollectionObject' biological_association_object.dwc_institution_code else end end |
#globi_target_life_stage_id ⇒ Object
235 236 237 238 239 240 241 242 |
# File 'app/models/biological_association/globi_extensions.rb', line 235 def globi_target_life_stage_id if biological_association_object_type == 'CollectionObject' biological_association_object.biocuration_classes.tagged_with_uri(::DWC_ATTRIBUTE_URIS[:lifeStage]) .pluck(:uri)&.join(', ').presence else nil # Maybe some OTU data attribute property list as above end end |
#globi_target_life_stage_name ⇒ Object
244 245 246 247 248 249 250 |
# File 'app/models/biological_association/globi_extensions.rb', line 244 def globi_target_life_stage_name if biological_association_object_type == 'CollectionObject' biological_association_object.dwc_life_stage else nil # Maybe some OTU data attribute property list end end |
#globi_target_occurrence_id ⇒ Object
TODO: use alias
190 191 192 193 194 |
# File 'app/models/biological_association/globi_extensions.rb', line 190 def globi_target_occurrence_id if biological_association_object_type == 'CollectionObject' biological_association_object.dwc_occurrence_id end end |
#globi_target_sex_id ⇒ Object
252 253 254 255 256 257 258 259 |
# File 'app/models/biological_association/globi_extensions.rb', line 252 def globi_target_sex_id if biological_association_object_type == 'CollectionObject' biological_association_object.biocuration_classes.tagged_with_uri(::DWC_ATTRIBUTE_URIS[:sex]) .pluck(:uri)&.join(', ').presence else nil # Maybe some OTU data attribute property list as above end end |
#globi_target_sex_name ⇒ Object
261 262 263 264 265 266 267 |
# File 'app/models/biological_association/globi_extensions.rb', line 261 def globi_target_sex_name if biological_association_object_type == 'CollectionObject' biological_association_object.dwc_sex else nil # Maybe some OTU data attribute property list end end |
#globi_target_taxon_name ⇒ Object
215 216 217 218 219 220 221 |
# File 'app/models/biological_association/globi_extensions.rb', line 215 def globi_target_taxon_name if biological_association_object_type == 'CollectionObject' biological_association_object.dwc_scientific_name else end end |
#globi_target_taxon_path ⇒ Object
231 232 233 |
# File 'app/models/biological_association/globi_extensions.rb', line 231 def globi_target_taxon_path ApplicationController.helpers.ancestry_path(biological_association_object.ancestry) end |
#globi_target_taxon_rank ⇒ Object
223 224 225 226 227 228 229 |
# File 'app/models/biological_association/globi_extensions.rb', line 223 def globi_target_taxon_rank if biological_association_object_type == 'CollectionObject' biological_association_object.dwc_taxon_rank else biological_association_object.taxon_name&.rank end end |