caruby-tissue 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -7
- data/lib/catissue/annotation/annotatable_class.rb +18 -1
- data/lib/catissue/annotation/annotation.rb +5 -0
- data/lib/catissue/annotation/annotation_class.rb +15 -3
- data/lib/catissue/annotation/proxy_class.rb +2 -1
- data/lib/catissue/database/annotation/annotation_service.rb +13 -6
- data/lib/catissue/database/annotation/annotator.rb +3 -1
- data/lib/catissue/database/annotation/entity_facade.rb +21 -29
- data/lib/catissue/database/annotation/integration_service.rb +6 -4
- data/lib/catissue/database.rb +2 -2
- data/lib/catissue/domain/abstract_domain_object.rb +1 -1
- data/lib/catissue/domain/abstract_position.rb +1 -1
- data/lib/catissue/domain/abstract_specimen.rb +1 -1
- data/lib/catissue/domain/abstract_specimen_collection_group.rb +1 -1
- data/lib/catissue/domain/address.rb +1 -1
- data/lib/catissue/domain/cancer_research_group.rb +1 -1
- data/lib/catissue/domain/capacity.rb +1 -1
- data/lib/catissue/domain/check_in_check_out_event_parameter.rb +1 -1
- data/lib/catissue/domain/collection_event_parameters.rb +1 -1
- data/lib/catissue/domain/collection_protocol.rb +1 -1
- data/lib/catissue/domain/collection_protocol_event.rb +1 -1
- data/lib/catissue/domain/collection_protocol_registration.rb +1 -1
- data/lib/catissue/domain/consent_tier_response.rb +1 -1
- data/lib/catissue/domain/consent_tier_status.rb +1 -1
- data/lib/catissue/domain/container.rb +1 -1
- data/lib/catissue/domain/container_position.rb +4 -2
- data/lib/catissue/domain/container_type.rb +1 -1
- data/lib/catissue/domain/department.rb +1 -1
- data/lib/catissue/domain/disposal_event_parameters.rb +1 -1
- data/lib/catissue/domain/embedded_event_parameters.rb +1 -1
- data/lib/catissue/domain/external_identifier.rb +1 -1
- data/lib/catissue/domain/frozen_event_parameters.rb +1 -1
- data/lib/catissue/domain/institution.rb +1 -1
- data/lib/catissue/domain/new_specimen_array_order_item.rb +1 -1
- data/lib/catissue/domain/order_details.rb +1 -1
- data/lib/catissue/domain/participant.rb +2 -2
- data/lib/catissue/domain/participant_medical_identifier.rb +1 -1
- data/lib/catissue/domain/password.rb +1 -1
- data/lib/catissue/domain/race.rb +1 -1
- data/lib/catissue/domain/received_event_parameters.rb +1 -1
- data/lib/catissue/domain/site.rb +1 -1
- data/lib/catissue/domain/specimen.rb +49 -40
- data/lib/catissue/domain/specimen_array.rb +1 -1
- data/lib/catissue/domain/specimen_array_content.rb +1 -1
- data/lib/catissue/domain/specimen_array_type.rb +1 -1
- data/lib/catissue/domain/specimen_characteristics.rb +1 -1
- data/lib/catissue/domain/specimen_collection_group.rb +7 -7
- data/lib/catissue/domain/specimen_event_parameters.rb +6 -6
- data/lib/catissue/domain/specimen_position.rb +1 -1
- data/lib/catissue/domain/specimen_protocol.rb +1 -1
- data/lib/catissue/domain/specimen_requirement.rb +13 -13
- data/lib/catissue/domain/storage_container.rb +1 -1
- data/lib/catissue/domain/storage_type.rb +1 -1
- data/lib/catissue/domain/transfer_event_parameters.rb +1 -1
- data/lib/catissue/domain/user.rb +1 -1
- data/lib/catissue/migration/migrator.rb +2 -2
- data/lib/catissue/version.rb +1 -1
- data/test/lib/catissue/domain/specimen_test.rb +241 -242
- data/test/lib/catissue/test_case.rb +11 -7
- metadata +3 -4
- data/examples/galena/lib/galena/cli/seed.rb +0 -22
@@ -2,7 +2,7 @@ require 'caruby/util/collection'
|
|
2
2
|
|
3
3
|
module CaTissue
|
4
4
|
# import the Java class
|
5
|
-
java_import
|
5
|
+
java_import Java::edu.wustl.catissuecore.domain.CollectionProtocolRegistration
|
6
6
|
|
7
7
|
# The CollectionProtocolRegistration domain class.
|
8
8
|
class CollectionProtocolRegistration
|
@@ -4,7 +4,7 @@ require 'catissue/util/location'
|
|
4
4
|
|
5
5
|
module CaTissue
|
6
6
|
# import the Java class
|
7
|
-
java_import
|
7
|
+
java_import Java::edu.wustl.catissuecore.domain.Container
|
8
8
|
|
9
9
|
# The +caTissue+ +Container+ domain class wrapper.
|
10
10
|
# Each Container subclass is required to implement the {#container_type} method.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module CaTissue
|
2
2
|
# import the Java class
|
3
|
-
java_import
|
3
|
+
java_import Java::edu.wustl.catissuecore.domain.ContainerPosition
|
4
4
|
|
5
5
|
class ContainerPosition
|
6
6
|
include Resource
|
@@ -18,8 +18,10 @@ module CaTissue
|
|
18
18
|
|
19
19
|
qualify_attribute(:parent_container, :fetched)
|
20
20
|
|
21
|
+
private
|
22
|
+
|
21
23
|
# @raise [ValidationError] if the parent is the same as the occupant
|
22
|
-
def
|
24
|
+
def validate_local
|
23
25
|
super
|
24
26
|
if parent == occupant or (parent.identifier and parent.identifier == occupant.identifier) then
|
25
27
|
raise ValidationError.new("#{self} has a circular containment reference to subcontainer #{occupant}")
|
@@ -2,7 +2,7 @@ require 'caruby/util/options'
|
|
2
2
|
|
3
3
|
module CaTissue
|
4
4
|
# import the Java class
|
5
|
-
java_import
|
5
|
+
java_import Java::edu.wustl.catissuecore.domain.ContainerType
|
6
6
|
|
7
7
|
# The caTissue ContainerType domain class wrapper.
|
8
8
|
# Each {ContainerType} subclass is required to implement the container_class method.
|
@@ -2,7 +2,7 @@ require 'catissue/resource'
|
|
2
2
|
|
3
3
|
module CaTissue
|
4
4
|
# import the Java class
|
5
|
-
java_import
|
5
|
+
java_import Java::edu.wustl.catissuecore.domain.NewSpecimenArrayOrderItem
|
6
6
|
|
7
7
|
# The NewSpecimenArrayOrderItem domain class.
|
8
8
|
class NewSpecimenArrayOrderItem
|
@@ -4,7 +4,7 @@ require 'catissue/util/person'
|
|
4
4
|
|
5
5
|
module CaTissue
|
6
6
|
# import the Java class
|
7
|
-
java_import
|
7
|
+
java_import Java::edu.wustl.catissuecore.domain.Participant
|
8
8
|
|
9
9
|
# The Participant domain class.
|
10
10
|
class Participant
|
@@ -137,7 +137,7 @@ module CaTissue
|
|
137
137
|
# Make a new default Race which references this Participant, if necessary. Setting the Race
|
138
138
|
# participant to self automatically adds the Race to this Participant's races collection.
|
139
139
|
# The Race name defaults to Unknown.
|
140
|
-
if races.empty? then CaTissue::Race.new(:participant => self).
|
140
|
+
if races.empty? then CaTissue::Race.new(:participant => self).add_defaults_recursive end
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|
data/lib/catissue/domain/race.rb
CHANGED
@@ -2,7 +2,7 @@ require 'catissue/domain/scg_event_parameters'
|
|
2
2
|
|
3
3
|
module CaTissue
|
4
4
|
# import the Java class
|
5
|
-
java_import
|
5
|
+
java_import Java::edu.wustl.catissuecore.domain.ReceivedEventParameters
|
6
6
|
|
7
7
|
class ReceivedEventParameters
|
8
8
|
include Resource, SCGEventParameters
|
data/lib/catissue/domain/site.rb
CHANGED
@@ -5,7 +5,7 @@ require 'catissue/util/storable'
|
|
5
5
|
|
6
6
|
module CaTissue
|
7
7
|
# import the Java class
|
8
|
-
java_import
|
8
|
+
java_import Java::edu.wustl.catissuecore.domain.Specimen
|
9
9
|
|
10
10
|
# The Specimen domain class.
|
11
11
|
class Specimen
|
@@ -183,35 +183,6 @@ module CaTissue
|
|
183
183
|
self
|
184
184
|
end
|
185
185
|
|
186
|
-
# Raises a ValidationError when one the following conditions holds:
|
187
|
-
# * a top-level Specimen does not have a SGC
|
188
|
-
# * the available_quantity exceeds the initial_quantity
|
189
|
-
# * the availability flag is set and the available_quantity is zero
|
190
|
-
#
|
191
|
-
# caTissue alert - Bug #160: Missing Is Available? validation.
|
192
|
-
# Updating Specimen with the availablity flag set and available_quantity zero
|
193
|
-
# silently leaves the availablity flag unset.
|
194
|
-
def validate
|
195
|
-
super
|
196
|
-
if parent.nil? and specimen_collection_group.nil? then
|
197
|
-
raise ValidationError.new("Top-level specimen #{self} is missing specimen collection group")
|
198
|
-
end
|
199
|
-
if available_quantity and initial_quantity and available_quantity > initial_quantity then
|
200
|
-
raise ValidationError.new("#{self} available quantity #{available_quantity} cannot exceed initial quantity #{initial_quantity}")
|
201
|
-
end
|
202
|
-
if available? and available_quantity.zero? then
|
203
|
-
raise ValidationError.new("#{self} availablility flag cannot be set when the avaialble quantity is zero")
|
204
|
-
end
|
205
|
-
if collected? then
|
206
|
-
unless event_parameters.detect { |ep| CaTissue::CollectionEventParameters === ep } then
|
207
|
-
raise ValidationError.new("#{self} is missing CollectionEventParameters")
|
208
|
-
end
|
209
|
-
unless event_parameters.detect { |ep| CaTissue::ReceivedEventParameters === ep } then
|
210
|
-
raise ValidationError.new("#{self} is missing ReceivedEventParameters")
|
211
|
-
end
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
186
|
# Returns the Specimen in others which matches this Specimen in the scope of an owner SCG.
|
216
187
|
# This method relaxes {CaRuby::Resource#match_in_owner_scope} to include a match on at least
|
217
188
|
# one external identifier.
|
@@ -367,6 +338,37 @@ module CaTissue
|
|
367
338
|
|
368
339
|
MERGEABLE_SPC_CHR_ATTRS = SpecimenCharacteristics.nondomain_java_attributes - SpecimenCharacteristics.primary_key_attributes
|
369
340
|
|
341
|
+
# Validates that the following conditions hold:
|
342
|
+
# * a top-level Specimen does not have a SGC
|
343
|
+
# * the available_quantity exceeds the initial_quantity
|
344
|
+
# * the availability flag is set and the available_quantity is zero
|
345
|
+
#
|
346
|
+
# caTissue alert - Bug #160: Missing Is Available? validation.
|
347
|
+
# Updating Specimen with the availablity flag set and available_quantity zero
|
348
|
+
# silently leaves the availablity flag unset.
|
349
|
+
#
|
350
|
+
# @raise [ValidationError] if the validation fails
|
351
|
+
def validate_local
|
352
|
+
super
|
353
|
+
if parent.nil? and specimen_collection_group.nil? then
|
354
|
+
raise ValidationError.new("Top-level specimen #{self} is missing specimen collection group")
|
355
|
+
end
|
356
|
+
if available_quantity and initial_quantity and available_quantity > initial_quantity then
|
357
|
+
raise ValidationError.new("#{self} available quantity #{available_quantity} cannot exceed initial quantity #{initial_quantity}")
|
358
|
+
end
|
359
|
+
if available? and available_quantity.zero? then
|
360
|
+
raise ValidationError.new("#{self} availablility flag cannot be set when the avaialble quantity is zero")
|
361
|
+
end
|
362
|
+
if collected? then
|
363
|
+
unless event_parameters.detect { |ep| CaTissue::CollectionEventParameters === ep } then
|
364
|
+
raise ValidationError.new("#{self} is missing CollectionEventParameters")
|
365
|
+
end
|
366
|
+
unless event_parameters.detect { |ep| CaTissue::ReceivedEventParameters === ep } then
|
367
|
+
raise ValidationError.new("#{self} is missing ReceivedEventParameters")
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
370
372
|
# @param [Resource] other the object to match
|
371
373
|
# @return [Boolean] whether this specimen matches the other specimen on at least one external identifier
|
372
374
|
def external_identifier_match?(other)
|
@@ -405,9 +407,9 @@ module CaTissue
|
|
405
407
|
#
|
406
408
|
# caTissue alert - initial_quantity cannot be null (cf. Bug #160).
|
407
409
|
#
|
408
|
-
# caTissue alert - the
|
409
|
-
# caTissue allows a nil available status on insert but not a false value, even though a
|
410
|
-
# is set to false (0 database value) when the record is inserted.
|
410
|
+
# caTissue alert - the available status cannot be set to to false. The status must be set to nil
|
411
|
+
# instead. caTissue allows a nil available status on insert but not a false value, even though a
|
412
|
+
# nil status is set to false (0 database value) when the record is inserted.
|
411
413
|
#
|
412
414
|
# caTissue alert - a collected Specimen without a collection and received event parameters
|
413
415
|
# results in the dreaded 'Severe Error' caTissue server message. Create default SEPs if necessary.
|
@@ -417,14 +419,21 @@ module CaTissue
|
|
417
419
|
add_default_event_parameters
|
418
420
|
|
419
421
|
# The default available quantity is the initial quantity.
|
420
|
-
|
421
|
-
if aq.nil? or aq.zero? then
|
422
|
-
self.available_quantity = is_available == false ? 0.0 : initial_quantity
|
423
|
-
end
|
422
|
+
self.available_quantity ||= is_available ? initial_quantity : 0
|
424
423
|
|
425
|
-
|
426
|
-
|
427
|
-
|
424
|
+
if is_available.nil? then
|
425
|
+
self.is_available = default_availablility
|
426
|
+
elsif is_available == false then
|
427
|
+
# Reset is_available value from false to nil to work around caTissue bug but described in method doc.
|
428
|
+
self.is_available = nil
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
# The specimen is available by default if there is a positive available quantity.
|
433
|
+
#
|
434
|
+
# @return [Boolean, nil] +nil+ if the available quantity is zero, +true+ otherwise
|
435
|
+
def default_availablility
|
436
|
+
available_quantity.zero? ? nil : true
|
428
437
|
end
|
429
438
|
|
430
439
|
# Adds the default collection and received event parameters if the collection status
|
@@ -2,7 +2,7 @@ require 'catissue/util/position'
|
|
2
2
|
|
3
3
|
module CaTissue
|
4
4
|
# import the Java class
|
5
|
-
java_import
|
5
|
+
java_import Java::edu.wustl.catissuecore.domain.SpecimenArrayContent
|
6
6
|
|
7
7
|
# caTissue alert - #{CaTissue::SpecimenArrayContent} should be derived from
|
8
8
|
# {CaTissue::AbstractPosition} but isn't (cf. {CaTissue::ContainerType}).
|
@@ -2,7 +2,7 @@ require 'caruby/util/transitive_closure'
|
|
2
2
|
|
3
3
|
module CaTissue
|
4
4
|
# import the Java class
|
5
|
-
java_import
|
5
|
+
java_import Java::edu.wustl.catissuecore.domain.SpecimenCollectionGroup
|
6
6
|
|
7
7
|
# The SpecimenCollectionGroup domain class.
|
8
8
|
#
|
@@ -252,12 +252,6 @@ module CaTissue
|
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
255
|
-
def validate
|
256
|
-
super
|
257
|
-
validate_consent
|
258
|
-
validate_event_parameters
|
259
|
-
end
|
260
|
-
|
261
255
|
# Relaxes the {CaRuby::Persistable#saved_fetch_attributes} condition for a SCG as follows:
|
262
256
|
# * If the SCG status was updated from +Pending+ to +Collected+, then fetch the saved SCG event parameters.
|
263
257
|
#
|
@@ -279,6 +273,12 @@ module CaTissue
|
|
279
273
|
private
|
280
274
|
|
281
275
|
EVENT_PARAM_ATTRS = [:specimen_event_parameters]
|
276
|
+
|
277
|
+
def validate_local
|
278
|
+
super
|
279
|
+
validate_consent
|
280
|
+
validate_event_parameters
|
281
|
+
end
|
282
282
|
|
283
283
|
# @see #fetch_saved
|
284
284
|
def status_changed_to_complete?
|
@@ -3,7 +3,7 @@ require 'caruby/util/inflector'
|
|
3
3
|
|
4
4
|
module CaTissue
|
5
5
|
# import the Java class
|
6
|
-
java_import
|
6
|
+
java_import Java::edu.wustl.catissuecore.domain.SpecimenEventParameters
|
7
7
|
|
8
8
|
class SpecimenEventParameters
|
9
9
|
include Resource
|
@@ -73,17 +73,17 @@ module CaTissue
|
|
73
73
|
specimen_collection_group.collection_protocol if specimen_collection_group
|
74
74
|
end
|
75
75
|
|
76
|
-
|
76
|
+
private
|
77
|
+
|
78
|
+
SUBCLASS_SUFFIX = 'EventParameters'
|
79
|
+
|
80
|
+
def validate_local
|
77
81
|
super
|
78
82
|
if subject.nil? then
|
79
83
|
raise ValidationError.new("Both specimen_collection_group and specimen are missing in SpecimenEventParameters #{self}")
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
83
|
-
private
|
84
|
-
|
85
|
-
SUBCLASS_SUFFIX = 'EventParameters'
|
86
|
-
|
87
87
|
# Sets each missing value to a default as follows:
|
88
88
|
# * default user is the SCG receiver
|
89
89
|
# * default timestamp is now
|