Class: CollectionProfile

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Housekeeping, SoftValidation
Defined in:
app/models/collection_profile.rb

Constant Summary collapse

COLLECTION_PROFILE_TYPES =

region Profile indices

%w(dry wet slide)

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SoftValidation

#clear_soft_validations, #fix_soft_validations, #soft_fixed?, #soft_valid?, #soft_validate, #soft_validated?, #soft_validations

Methods included from Housekeeping

#has_polymorphic_relationship?

Class Method Details

.favret_arrangement_level_indices(t) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'app/models/collection_profile.rb', line 154

def self.favret_arrangement_level_indices(t)
  case t
    when 'dry'
      {1 => 'mixed taxa in same container',
           2 => 'specimens crowded arranged at higher taxonomic level, or species sharing trays',
           3 => 'specimens arranged alphabetically or phylogenetically',
           4 => 'specimens arranged geographically or numerically within a taxon'}
    when 'slide'
      {1 => 'mixed taxa in same container',
           2 => 'specimens crowded arranged at higher taxonomic level, or species sharing trays',
           3 => 'specimens arranged alphabetically or phylogenetically',
           4 => 'specimens arranged geographically or numerically within a taxon'}
    when 'wet'
      {1 => 'mixed taxa in same container',
           2 => 'specimens crowded arranged at higher taxonomic level, or species sharing trays',
           3 => 'specimens arranged alphabetically or phylogenetically',
           4 => 'specimens arranged geographically or numerically within a taxon'}
    else
      {}
  end
end

.favret_computerization_level_indices(t) ⇒ Object



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'app/models/collection_profile.rb', line 198

def self.favret_computerization_level_indices(t)
  case t
    when 'dry'
      {2 => 'no computerization',
           3 => 'taxonomic information computerized',
           4 => 'all specimens databased and localities georeferenced'}
    when 'slide'
      {2 => 'no computerization',
           3 => 'taxonomic information computerized',
           4 => 'all specimens databased and localities georeferenced'}
    when 'wet'
      {2 => 'no computerization',
           3 => 'taxonomic information computerized',
           4 => 'all specimens databased and localities georeferenced'}
    else
      {}
  end
end

.favret_condition_of_labels_indices(t) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'app/models/collection_profile.rb', line 113

def self.favret_condition_of_labels_indices(t)
  case t
    when 'dry'
      {1 => 'faded to illegible, crumbling or missing',
           2 => 'partially faded, on non-archival paper',
           3 => 'labels on archival paper'}
    when 'slide'
      {1 => 'faded to illegible, crumbling or missing, become detached',
           2 => 'partially faded or pencil writing, on non-archival paper',
           3 => 'labels on archival paper'}
    when 'wet'
      {1 => 'faded to illegible, crumbling or missing',
           2 => 'partially faded, on non-archival paper',
           3 => 'labels on archival paper'}
    else
      {}
  end
end

.favret_conservation_status_indices(t) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'app/models/collection_profile.rb', line 54

def self.favret_conservation_status_indices(t)
  case t
    when 'dry'
      {1 => 'pest infestation or specimens unusable due to damage',
           2 => 'specimens damaged, pins broken or bent',
           3 => 'specimens intact and stable'}
    when 'slide'
      {1 => 'slide or cover is broken or mountant crystallized',
           2 => 'improper mounting medium, not ringed, slide or cover is cracked',
           3 => 'slide ringed or mounted in Canada balsam'}
    when 'wet'
      {1 => 'specimens damaged or desiccated (not completely covered by fluid)',
           2 => 'fluid level low or dark',
           3 =>'fluid topped off and clear'}
    else
      {}
  end
end

.favret_container_condition_indices(t) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'app/models/collection_profile.rb', line 91

def self.favret_container_condition_indices(t)
  case t
    when 'dry'
      {1 => 'cigar boxes, pill boxes, paper bags',
           2 => 'substandard containers, hart botom unit trays',
           3 => 'wrong size or dirty unit trays',
           4 => 'archival unit trays'}
    when 'slide'
      {1 => 'not stored in slide box or tray',
           2 => 'slide boxes of non-standard 100-slide size, brocken or rusty hinges',
           3 => 'good slide boxes or trays with rust-free hinges and substantial closure clasps',
           4 => 'slides stored flat'}
    when 'wet'
      {1 => 'bad stoppers/lids, loose vails/jars; vials  loose on shelf',
           2 => 'degraded or poor stoppers/lids; vials in wire-sided racks',
           3 => 'neoprene stoppers, good containers; vial racks solid',
           4 => 'archival racks/trays, stoppers'}
    else
      {}
  end
end

.favret_data_quality_indices(t) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'app/models/collection_profile.rb', line 176

def self.favret_data_quality_indices(t)
  case t
    when 'dry'
      {1 => 'data absent often codes only',
           2 => 'missing data can be inferred',
           3 => 'all data fields intact',
           4 => 'value-added data, including retrospective georeferencing'}
    when 'slide'
      {1 => 'data absent often codes only',
           2 => 'missing data can be inferred',
           3 => 'all data fields intact',
           4 => 'value-added data, including retrospective georeferencing'}
    when 'wet'
      {1 => 'data absent often codes only',
           2 => 'missing data can be inferred',
           3 => 'all data fields intact',
           4 => 'value-added data, including retrospective georeferencing'}
    else
      {}
  end
end

.favret_identification_level_indices(t) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'app/models/collection_profile.rb', line 132

def self.favret_identification_level_indices(t)
  case
    when 'dry'
      {1 => 'all specimens not determined to any level',
           2 => 'identified to order or family',
           3 => 'identified to genus (in small groups to family)',
           4 => 'identified to species'}
    when 'slide'
      {1 => 'all specimens not determined to any level',
           2 => 'identified to order or family',
           3 => 'identified to genus (in small groups to family)',
           4 => 'identified to species'}
    when 'wet'
      {1 => 'all specimens not determined to any level',
           2 => 'identified to order or family',
           3 => 'identified to genus (in small groups to family)',
           4 => 'identified to species'}
    else
      {}
  end
end

.favret_processing_state_indices(t) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'app/models/collection_profile.rb', line 73

def self.favret_processing_state_indices(t)
  case t
    when 'dry'
      {1 => 'bulk, unprocessed specimens',
           2 => 'specimens lacking labels or not properly prepared',
           3 => 'properly sorted and labled'}
    when 'slide'
      {2 => 'specimens not cleared and/or improperly oriented',
           3 =>'specimens cleared and properly oriented'}
    when 'wet'
      {1 => 'bulk, unprocessed specimens',
           2 => 'mixed field samples in clear alcohol and proper vials',
           3 => 'properly sorted and labled'}
    else
      {}
  end
end

Instance Method Details

#average_profile_indexObject



49
50
51
52
# File 'app/models/collection_profile.rb', line 49

def average_profile_index
  i = self.collection_profile_indices
  i.empty? ? nil : i.sum / i.size.to_f
end

#collection_profile_indicesObject



37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/collection_profile.rb', line 37

def collection_profile_indices
  i = [self.conservation_status,
       self.processing_state,
       self.container_condition,
       self.condition_of_labels,
       self.identification_level,
       self.arrangement_level,
       self.data_quality,
       self.computerization_level].compact
  i.size == 8 ? i : []
end