Class: Catalog::CollectionObject
- Defined in:
- lib/catalog/collection_object.rb
Defined Under Namespace
Constant Summary collapse
- EVENT_TYPES =
An arbitrary vocabulary of human-readable event names (tags) in the lifetime of a collection object
[ :born, :died, :collected_on, :determined, :described, :given_identifier, :georeferenced, :destroyed, :placed_in_repository, :sent_for_loan, :returned_from_loan, :updated_metadata, :added_note, :annotated, :cited, :containerized, :extracted_from, :sequenced, :dissected, :tagged, :typified, :added_attribute, :biologically_classified, :fossilized_between, # chronological time period b/w which specimen was fossilized :imaged, # == depicted :metadata_depicted, :collecting_event_metadata_depicted, :collection_site_imaged, :digital_record_created_by, :digital_record_updated_by, :biologically_associated, :became_origin_of, :originated_from ].freeze
- FILTER_MAP =
Group the events so that they can be toggled
{ born: :life, died: :life, collected_on: :collecting_event, determined: :taxon_determinations, described: :observations, given_identifier: :annotations, georeferenced: :collecting_event, destroyed: :accessions, placed_in_repository: :accessions, sent_for_loan: :loans, returned_from_loan: :loans, updated_metadata: :annotations, added_note: :annotations, annotated: :annotations, cited: :annotations, containerized: :accessions, extracted_from: :lab, sequenced: :lab, dissected: :lab, tagged: :annotations, typified: nil, added_attribute: :annotations, biologically_classified: :biology, fossilized_between: :collecting_event, imaged: :images, metadata_depicted: :images, collecting_event_metadata_depicted: :images, collection_site_imaged: :collecting_event, biologically_associated: :biology, became_origin_of: :lab, originated_from: :lab, }.freeze
Instance Attribute Summary
Attributes inherited from Catalog
Class Method Summary collapse
-
.data_for(collection_object) ⇒ Catalog::CollectionObject::Entry
rubocop:disable Metrics/MethodLength.
Methods inherited from Catalog
all_dates, #build, chronological_item_sort, #citations, #entries_sorted, #entry_sort_valid?, #initialize, #items, #items_chronologically, #objects_for_source, #reference_object_global_id, #reference_object_valid_taxon_name_global_id, #sources, #sources_to_json, topic_year_metadata, #topics, #topics_to_json, year_hash, year_metadata
Constructor Details
This class inherits a constructor from Catalog
Class Method Details
.data_for(collection_object) ⇒ Catalog::CollectionObject::Entry
rubocop:disable Metrics/MethodLength
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/catalog/collection_object.rb', line 81 def self.data_for(collection_object) o = collection_object data = Catalog::CollectionObject::Entry.new(o) data.items << Catalog::CollectionObject::EntryItem.new(type: :collected_on, object: o.collecting_event, start_date: o.collecting_event.start_date, end_date: o.collecting_event.end_date) if o.collecting_event_id.present? data.items << Catalog::CollectionObject::EntryItem.new(type: :digital_record_created_by, object: o.creator, start_date: o.created_at.to_time) data.items << Catalog::CollectionObject::EntryItem.new(type: :digital_record_updated_by, object: o.updater, start_date: o.updated_at.to_time) o.origin_relationships.each do |a| data.items << Catalog::CollectionObject::EntryItem.new( type: :became_origin_of, object: a, start_date: a.created_at ) end o..each do |a| data.items << Catalog::CollectionObject::EntryItem.new( type: :originated_from, object: a, start_date: a.created_at ) end o.all_biological_associations.each do |a| data.items << Catalog::CollectionObject::EntryItem.new( type: :biologically_associated, object: a, start_date: a.created_at ) end o.biocuration_classifications.each do |b| data.items << Catalog::CollectionObject::EntryItem.new( type: :biologically_classified, object: b, start_date: b.created_at.to_time) end o.versions.each do |v| data.items << Catalog::CollectionObject::EntryItem.new( type: :updated_metadata, object: v, start_date: v.created_at.to_time) end o.georeferences.each do |g| data.items << Catalog::CollectionObject::EntryItem.new( type: :georeferenced, object: g, start_date: g.created_at.to_time) end o.type_materials.each do |t| date = t&.source&.nomenclature_date&.to_time data.items << Catalog::CollectionObject::EntryItem.new(type: :typified, object: t, start_date: date) end o.taxon_determinations.each do |td| data.items << Catalog::CollectionObject::EntryItem.new(type: :determined, object: td, start_date: td.sort_date) end o.identifiers.each do |i| data.items << Catalog::CollectionObject::EntryItem.new( type: :given_identifier, object: i, start_date: i.created_at) end o.all_loan_items.each do |li| data.items << Catalog::CollectionObject::EntryItem.new( type: :sent_for_loan, object: li.loan, start_date: li.loan.date_sent.to_time ) if li.loan.date_sent data.items << Catalog::CollectionObject::EntryItem.new( type: :returned_from_loan, object: li.loan, start_date: (li.returned? ? li.date_returned.to_time : li.loan.date_closed.to_time) ) if li.loan.date_closed || li.returned? end o..each do |t| data.items << Catalog::CollectionObject::EntryItem.new( type: :tagged, object: t, start_date: t.created_at.to_time) end o.data_attributes.each do |d| data.items << Catalog::CollectionObject::EntryItem.new( type: :added_attribute, object: d, start_date: d.created_at.to_time) end o.notes.each do |n| data.items << Catalog::CollectionObject::EntryItem.new( type: :added_note, object: n, start_date: n.created_at.to_time) end o.depictions.each do |d| t = d. ? :metadata_depicted : :imaged data.items << Catalog::CollectionObject::EntryItem.new( type: t, object: d, start_date: d.created_at.to_time) end o.collecting_event && o.collecting_event.depictions.each do |d| t = d. ? :collecting_event_metadata_depicted : :collection_site_imaged data.items << Catalog::CollectionObject::EntryItem.new( type: t, object: d, start_date: d.created_at.to_time) end data.items << Catalog::CollectionObject::EntryItem.new( type: :containerized, object: o.container, start_date: o.created_at.to_time) if o.container # TODO: extracts, sequences, data end |