caruby-tissue 1.4.2 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. data/History.md +53 -0
  2. data/bin/crtdump +1 -6
  3. data/bin/crtexample +1 -6
  4. data/bin/crtmigrate +1 -6
  5. data/bin/crtsmoke +1 -6
  6. data/conf/migration/filter_fields.yaml +1 -1
  7. data/conf/migration/general_fields.yaml +1 -1
  8. data/conf/migration/simple_fields.yaml +1 -1
  9. data/conf/migration/small_fields.yaml +1 -1
  10. data/examples/galena/README.md +34 -25
  11. data/examples/galena/bin/seed +2 -7
  12. data/examples/galena/conf/migration/annotation_fields.yaml +1 -1
  13. data/examples/galena/conf/migration/filter_fields.yaml +1 -1
  14. data/examples/galena/conf/migration/frozen_fields.yaml +2 -2
  15. data/examples/galena/conf/migration/general_fields.yaml +1 -1
  16. data/examples/galena/conf/migration/registration_fields.yaml +1 -0
  17. data/examples/galena/conf/migration/simple_fields.yaml +1 -1
  18. data/examples/galena/data/frozen.csv +1 -1
  19. data/examples/galena/data/general.csv +1 -1
  20. data/examples/galena/data/registration.csv +1 -1
  21. data/examples/galena/lib/galena/tissue/migration/frozen_shims.rb +8 -4
  22. data/examples/galena/lib/galena/tissue/seed/defaults.rb +16 -9
  23. data/examples/pcbin/README.md +8 -8
  24. data/examples/pcbin/conf/biopsy_fields.yaml +1 -1
  25. data/examples/pcbin/conf/patient_fields.yaml +1 -1
  26. data/examples/pcbin/conf/surgery_fields.yaml +1 -1
  27. data/examples/pcbin/conf/t_stage_fields.yaml +1 -1
  28. data/examples/pcbin/conf/therapy_fields.yaml +1 -1
  29. data/lib/catissue.rb +1 -1
  30. data/lib/catissue/annotation/annotatable.rb +12 -22
  31. data/lib/catissue/annotation/annotatable_class.rb +87 -114
  32. data/lib/catissue/annotation/annotation.rb +9 -44
  33. data/lib/catissue/annotation/annotation_class.rb +238 -145
  34. data/lib/catissue/annotation/annotation_module.rb +47 -59
  35. data/lib/catissue/annotation/de_integration.rb +12 -2
  36. data/lib/catissue/annotation/proxy.rb +11 -17
  37. data/lib/catissue/annotation/proxy_1_1.rb +47 -0
  38. data/lib/catissue/annotation/proxy_class.rb +55 -37
  39. data/lib/catissue/annotation/record_entry_proxy.rb +20 -0
  40. data/lib/catissue/database.rb +164 -112
  41. data/lib/catissue/database/annotation/annotation_service.rb +5 -5
  42. data/lib/catissue/database/annotation/annotator.rb +2 -2
  43. data/lib/catissue/database/annotation/entity_facade.rb +24 -21
  44. data/lib/catissue/database/annotation/id_generator.rb +26 -26
  45. data/lib/catissue/database/annotation/integration_service.rb +8 -8
  46. data/lib/catissue/database/annotation/record_entry_integrator.rb +24 -6
  47. data/lib/catissue/database/annotation/reference_writer.rb +33 -6
  48. data/lib/catissue/domain.rb +26 -0
  49. data/lib/catissue/domain/abstract_position.rb +1 -1
  50. data/lib/catissue/domain/abstract_specimen.rb +16 -16
  51. data/lib/catissue/domain/check_in_check_out_event_parameter.rb +1 -1
  52. data/lib/catissue/domain/collection_event_parameters.rb +1 -1
  53. data/lib/catissue/domain/collection_protocol.rb +9 -13
  54. data/lib/catissue/domain/collection_protocol_event.rb +4 -4
  55. data/lib/catissue/domain/collection_protocol_registration.rb +4 -4
  56. data/lib/catissue/domain/container.rb +12 -21
  57. data/lib/catissue/domain/container_type.rb +65 -64
  58. data/lib/catissue/domain/disposal_event_parameters.rb +1 -1
  59. data/lib/catissue/domain/hash_code.rb +3 -6
  60. data/lib/catissue/domain/new_specimen_array_order_item.rb +4 -4
  61. data/lib/catissue/domain/order_details.rb +3 -3
  62. data/lib/catissue/domain/participant.rb +28 -20
  63. data/lib/catissue/domain/participant/clinical/chemotherapy.rb +21 -0
  64. data/lib/catissue/domain/participant/clinical/duration.rb +11 -0
  65. data/lib/catissue/domain/participant/clinical/radiation_therapy.rb +21 -0
  66. data/lib/catissue/domain/participant_medical_identifier.rb +2 -2
  67. data/lib/catissue/domain/site.rb +6 -6
  68. data/lib/catissue/domain/specimen.rb +41 -34
  69. data/lib/catissue/domain/specimen/pathology/prostate_specimen_gleason_score.rb +18 -0
  70. data/lib/catissue/domain/specimen/pathology/prostate_specimen_pathology_annotation.rb +13 -8
  71. data/lib/catissue/domain/specimen/pathology/specimen_additional_finding.rb +21 -0
  72. data/lib/catissue/domain/specimen/pathology/specimen_base_solid_tissue_pathology_annotation.rb +30 -7
  73. data/lib/catissue/domain/specimen/pathology/specimen_details.rb +18 -0
  74. data/lib/catissue/domain/specimen/pathology/specimen_histologic_grade.rb +18 -0
  75. data/lib/catissue/domain/specimen/pathology/specimen_histologic_type.rb +22 -6
  76. data/lib/catissue/domain/specimen/pathology/specimen_histologic_variant_type.rb +18 -0
  77. data/lib/catissue/domain/specimen/pathology/specimen_invasion.rb +18 -0
  78. data/lib/catissue/domain/specimen_array.rb +8 -8
  79. data/lib/catissue/domain/specimen_array_content.rb +4 -4
  80. data/lib/catissue/domain/specimen_collection_group.rb +43 -41
  81. data/lib/catissue/domain/specimen_collection_group/pathology/base_pathology_annotation.rb +16 -0
  82. data/lib/catissue/domain/specimen_collection_group/pathology/base_solid_tissue_pathology_annotation.rb +16 -0
  83. data/lib/catissue/domain/specimen_position.rb +3 -3
  84. data/lib/catissue/domain/specimen_protocol.rb +7 -7
  85. data/lib/catissue/domain/specimen_requirement.rb +9 -9
  86. data/lib/catissue/domain/storage_container.rb +13 -13
  87. data/lib/catissue/domain/storage_type.rb +12 -7
  88. data/lib/catissue/domain/transfer_event_parameters.rb +2 -2
  89. data/lib/catissue/domain/user.rb +15 -15
  90. data/lib/catissue/extract/extractor.rb +1 -1
  91. data/lib/catissue/resource.rb +8 -36
  92. data/lib/catissue/util/location.rb +0 -13
  93. data/lib/catissue/util/person.rb +2 -1
  94. data/lib/catissue/util/position.rb +1 -11
  95. data/lib/catissue/util/uniquify.rb +1 -1
  96. data/lib/catissue/version.rb +1 -1
  97. data/lib/catissue/wustl/logger.rb +17 -16
  98. data/test/fixtures/lib/catissue/defaults_test_fixture.rb +6 -4
  99. data/test/lib/catissue/domain/collection_protocol_test.rb +0 -1
  100. data/test/lib/catissue/domain/participant_test.rb +74 -19
  101. data/test/lib/catissue/domain/specimen_collection_group_test.rb +14 -10
  102. data/test/lib/catissue/domain/specimen_test.rb +36 -60
  103. data/test/lib/catissue/domain/storage_type_test.rb +5 -5
  104. data/test/lib/catissue/domain/transfer_event_parameters_test.rb +14 -12
  105. data/test/lib/catissue/migration/test_case.rb +0 -1
  106. data/test/lib/catissue/test_case.rb +12 -12
  107. data/test/lib/examples/galena/tissue/domain/examples_test.rb +1 -1
  108. data/test/lib/examples/galena/tissue/migration/annotation_test.rb +9 -7
  109. data/test/lib/examples/galena/tissue/migration/frozen_test.rb +1 -1
  110. data/test/lib/examples/galena/tissue/migration/general_test.rb +1 -1
  111. data/test/lib/examples/galena/tissue/migration/registration_test.rb +3 -9
  112. data/test/lib/examples/galena/tissue/migration/seedify.rb +3 -3
  113. data/test/lib/examples/pcbin/migration_test.rb +37 -16
  114. metadata +24 -10
  115. data/History.txt +0 -50
@@ -2,7 +2,7 @@ module CaTissue
2
2
  # import the Java class
3
3
  resource_import Java::edu.wustl.catissuecore.domain.CheckInCheckOutEventParameter
4
4
 
5
- class CheckInCheckOutEventParameter < CaTissue::SpecimenEventParameters
5
+ class CheckInCheckOutEventParameter
6
6
  # The check-in/check-out status permissible values.
7
7
  module Status
8
8
  CHECKED_OUT = 'CHECK OUT'
@@ -5,7 +5,7 @@ module CaTissue
5
5
  # import the Java class
6
6
  resource_import Java::edu.wustl.catissuecore.domain.CollectionEventParameters
7
7
 
8
- class CollectionEventParameters < CaTissue::SpecimenEventParameters
8
+ class CollectionEventParameters
9
9
  include CollectibleEventParameters
10
10
 
11
11
  add_attribute_defaults(:collection_procedure => 'Not Specified', :container => 'Not Specified')
@@ -9,8 +9,8 @@ module CaTissue
9
9
  class CollectionProtocol
10
10
  include HashCode
11
11
 
12
- # caTissue alert - Bug #64: Some domain collection properties not initialized.
13
- # Initialize consent_tiers if necessary.
12
+ # @quirk caTissue Bug #64: Some domain collection properties not initialized.
13
+ # Initialize consent_tiers if necessary.
14
14
  #
15
15
  # @return [Java::JavaUtil::Set] the tiers
16
16
  def consent_tiers
@@ -19,26 +19,24 @@ module CaTissue
19
19
 
20
20
  add_attribute_aliases(:events => :collection_protocol_events, :registrations => :collection_protocol_registrations)
21
21
 
22
- set_secondary_key_attributes(:short_title)
23
-
24
22
  add_attribute_defaults(:consents_waived => false, :aliquot_in_same_container => false)
25
23
 
26
- add_mandatory_attributes(:aliquot_in_same_container, :collection_protocol_events, :consents_waived, :enrollment, :start_date, :title)
24
+ add_mandatory_attributes(:aliquot_in_same_container, :collection_protocol_events, :consents_waived, :enrollment)
27
25
 
28
26
  add_dependent_attribute(:collection_protocol_events)
29
27
 
30
28
  add_dependent_attribute(:consent_tiers)
31
29
 
32
- # caTissue alert - Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
33
- # Create CollectionProtocol in API ignores startDate.
30
+ # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
31
+ # Create CollectionProtocol in API ignores startDate.
34
32
  qualify_attribute(:start_date, :update_only)
35
33
 
36
- # caTissue alert - Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
37
- # Create CollectionProtocol in API ignores startDate.
34
+ # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
35
+ # Create CollectionProtocol in API ignores startDate.
38
36
  set_attribute_type(:coordinators, CaTissue::User)
39
37
 
40
- # caTissue alert - Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
41
- # Create CollectionProtocol in API ignores startDate.
38
+ # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
39
+ # Create CollectionProtocol in API ignores startDate.
42
40
  qualify_attribute(:coordinators, :fetched)
43
41
 
44
42
  def initialize
@@ -149,8 +147,6 @@ module CaTissue
149
147
  # is the coordinator site.
150
148
  def add_defaults_local
151
149
  super
152
- self.title ||= short_title
153
- self.short_title ||= title
154
150
  self.start_date ||= Java::JavaUtil::Date.new
155
151
  if sites.empty? then add_default_site end
156
152
  if coordinators.empty? and sites.size == 1 then
@@ -9,8 +9,8 @@ module CaTissue
9
9
  class CollectionProtocolEvent
10
10
  include HashCode
11
11
 
12
- # caTissue alert - Bug #64: Some domain collection properties not initialized.
13
- # Initialize specimen_collection_groups if necessary.
12
+ # @quirk caTissue Bug #64: Some domain collection properties not initialized.
13
+ # Initialize specimen_collection_groups if necessary.
14
14
  #
15
15
  # @return [Java::JavaUtil::Set] the SCGs
16
16
  def specimen_collection_groups
@@ -33,8 +33,8 @@ module CaTissue
33
33
 
34
34
  add_mandatory_attributes(:collection_protocol, :clinical_diagnosis, :specimen_requirements)
35
35
 
36
- # caTissue alert - specimen_requirements is a cascaded dependent, but it is not fetched.
37
- # CollectionProtocol create cascades through each dependent CPE to each SpecimenRequirement.
36
+ # @quirk caTissue specimen_requirements is a cascaded dependent, but it is not fetched.
37
+ # CollectionProtocol create cascades through each dependent CPE to each SpecimenRequirement.
38
38
  add_dependent_attribute(:specimen_requirements, :unfetched)
39
39
 
40
40
  # The event point used for saving this CollectionProtocolEvent if none other is set.
@@ -7,8 +7,8 @@ module CaTissue
7
7
 
8
8
  # The CollectionProtocolRegistration domain class.
9
9
  class CollectionProtocolRegistration
10
- # caTissue alert - Bug #64: Some domain collection properties not initialized.
11
- # Initialize consent_tier_responses if necessary.
10
+ # @quirk caTissue Bug #64: Some domain collection properties not initialized.
11
+ # Initialize consent_tier_responses if necessary.
12
12
  #
13
13
  # @return [Java::JavaUtil::Set] the responses
14
14
  def consent_tier_responses
@@ -67,8 +67,8 @@ module CaTissue
67
67
  # must exist. This is checked in the special purpose {#validate_local} method.
68
68
  qualify_attribute(:protocol_participant_identifier, :optional)
69
69
 
70
- # caTissue alert - Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
71
- # Create CollectionProtocol in API ignores startDate.
70
+ # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
71
+ # Create CollectionProtocol in API ignores startDate.
72
72
  qualify_attribute(:registration_date, :update_only)
73
73
 
74
74
  def initialize
@@ -18,14 +18,14 @@ module CaTissue
18
18
 
19
19
  add_attribute_defaults(:activity_status => 'Active', :full => false)
20
20
 
21
- # caTissue alert - container capacity was auto-generated in 1.1.2, but is not in 1.2.
21
+ # @quirk caTissue container capacity was auto-generated in 1.1.2, but is not in 1.2.
22
22
  add_dependent_attribute(:capacity)
23
23
 
24
24
  # located_at_position is cascaded but not fetched.
25
25
  add_dependent_attribute(:located_at_position, :unfetched)
26
26
 
27
- # caTissue alert - Like SCG, the Container save argument name value is ignored and assigned by caTissue
28
- # to a different value instead. Therefore, this attribute is marked auto-generated.
27
+ # @quirk caTissue Like SCG, the Container save argument name value is ignored and assigned by caTissue
28
+ # to a different value instead. Therefore, this attribute is marked auto-generated.
29
29
  qualify_attribute(:name, :autogenerated)
30
30
 
31
31
  # Returns the meta-type which constrains this Container in its role as a {Storable}
@@ -126,15 +126,6 @@ module CaTissue
126
126
  full? and subcontainers.all? { |ctr| ctr.completely_full? }
127
127
  end
128
128
 
129
- # @eturn [Integer] -1, 0, or 1 if self is contained in, contains or the same as the other
130
- # Container, resp.
131
- def <=>(other)
132
- raise TypeError.new("Can't compare #{qp} to #{other}") unless StorageContainer === self
133
- return 0 if equal?(other) or (name and name == other.name)
134
- return 1 if subcontainers.detect { |child| child >= other if StorageContainer === child }
135
- -1 if other > self
136
- end
137
-
138
129
  # @return [Storable, nil] the occupant at the given zero-based row and column, or nil if none
139
130
  def [](column, row)
140
131
  return if column.nil? or row.nil?
@@ -210,22 +201,22 @@ module CaTissue
210
201
  def first_available_location
211
202
  return if full?
212
203
  # look for the first unoccupied location
213
- occupied = all_occupied_positions.map { |pos| pos.location }.sort
204
+ occd = all_occupied_positions.map { |pos| pos.location }.sort { |l1, l2| l1.coordinate <=> l2.coordinate }
214
205
  # find a gap, if one exists, otherwise return the next location
215
206
  # after the last occupied location
216
- current = Location.new(:in => self, :at => Coordinate.new(0, 0))
217
- occupied.each do |loc|
218
- break if current < loc
219
- current.succ!
207
+ curr = Location.new(:in => self, :at => Coordinate.new(0, 0))
208
+ occd.each do |loc|
209
+ break if curr.coordinate < loc.coordinate
210
+ curr.succ!
220
211
  end
221
- current
212
+ curr
222
213
  end
223
214
 
224
215
  # Copies this Container's ContainerType capacity, if it exists, to the Container capacity.
225
216
  #
226
- # caTissue alert - this method must be called by subclass initializers. The caTissue API
227
- # does not make the reasonable assumption that the default Container capacity is the
228
- # ContainerType capacity.
217
+ # @quirk caTissue this method must be called by subclass initializers. The caTissue API
218
+ # does not make the reasonable assumption that the default Container capacity is the
219
+ # ContainerType capacity.
229
220
  #
230
221
  # @return [Capacity, nil] the initialized capacity, if any
231
222
  def copy_container_type_capacity
@@ -7,61 +7,61 @@ module CaTissue
7
7
  # The caTissue ContainerType domain class wrapper.
8
8
  # Each {ContainerType} subclass is required to implement the container_class method.
9
9
  #
10
- # caTissue alert - the ContainerType and Container class hierarchy is a confusing
11
- # olio of entangled relationships. The canonical use case is as follows:
12
- # * A Specimen is contained in a box, vial or specimen array.
13
- # * A vial or specimen array can also be placed in a box.
14
- # * A frozen specimen container is placed on a rack in a freezer.
10
+ # @quirk caTissue the ContainerType and Container class hierarchy is a confusing
11
+ # olio of entangled relationships. The canonical use case is as follows:
12
+ # * A Specimen is contained in a box, vial or specimen array.
13
+ # * A vial or specimen array can also be placed in a box.
14
+ # * A frozen specimen container is placed on a rack in a freezer.
15
15
  #
16
- # This conceptual model is implemented in caTissue as follows:
17
- # * The specimen collection container type, e.g. +Citrate Vacutainer+, is captured
18
- # as a {CaTissue::CollectionEventParameters#container} String. There is no separate
19
- # collection container instance or container type instance.
20
- # * A tissue specimen storage box is captured as a {CaTissue::StorageContainer}
21
- # instance constrained to a {CaTissue::StorageType} instance. Boxes with different
22
- # types are instances of the same {CaTissue::StorageContainer} class but belong
23
- # to different {CaTissue::StorageType} instances.
24
- # * {CaTissue::SpecimenArray} is a {CaTissue::Container} but not a {CaTissue::StorageContainer}.
25
- # The specimen array class is {CaTissue::SpecimenArray}, but its type is a
26
- # {CaTissue::SpecimenArrayType} instance, which is a {CaTissue::ContainerType} but not
27
- # a {CaTissue::StorageType}.
28
- # * A rack is a {CaTissue::StorageContainer} instance whose type is a {CaTissue::StorageType}
29
- # instance which can hold the box {CaTissue::StorageType}.
30
- # * A freezer is a {CaTissue::StorageContainer} instance whose type is a {CaTissue::StorageType}
31
- # instance which can hold the rack {CaTissue::StorageType}.
32
- # * Each {CaTissue::StorageContainer} belongs to a given {CaTissue::Site}. A child
33
- # {CaTissue::StorageContainer} site defaults to its parent container site.
34
- # Site consistency is not enforced by caTissue, i.e. it is possible to create
35
- # a rack whose site differs from that of its parent freezer and child boxes.
36
- # * {CaTissue::SpecimenArray} is not associated to a site.
37
- # * The container children are partitioned into three methods for the three different
38
- # types and pseudo-types of contained items: {CaTissue::StorageContainer},
39
- # {CaTissue::SpecimenArray} and {CaTissue::Specimen#class}.
40
- # * {CaTissue::SpecimenArray} holds {CaTissue::SpecimenArrayContent} positions, which
41
- # are the functional equivalent of {CaTissue::SpecimenPosition} adapted for specimen
42
- # arrays, although {CaTissue::SpecimenArrayContent} is not a {CaTissue::SpecimenPosition}
43
- # or even an {CaTissue::AbstractPosition}. {CaTissue::SpecimenPosition} is functionally
44
- # a specimen position in a box, whereas {CaTissue::SpecimenArrayContent} is functionally
45
- # a specimen position in a specimen array.
16
+ # This conceptual model is implemented in caTissue as follows:
17
+ # * The specimen collection container type, e.g. +Citrate Vacutainer+, is captured
18
+ # as a {CaTissue::CollectionEventParameters#container} String. There is no separate
19
+ # collection container instance or container type instance.
20
+ # * A tissue specimen storage box is captured as a {CaTissue::StorageContainer}
21
+ # instance constrained to a {CaTissue::StorageType} instance. Boxes with different
22
+ # types are instances of the same {CaTissue::StorageContainer} class but belong
23
+ # to different {CaTissue::StorageType} instances.
24
+ # * {CaTissue::SpecimenArray} is a {CaTissue::Container} but not a {CaTissue::StorageContainer}.
25
+ # The specimen array class is {CaTissue::SpecimenArray}, but its type is a
26
+ # {CaTissue::SpecimenArrayType} instance, which is a {CaTissue::ContainerType} but not
27
+ # a {CaTissue::StorageType}.
28
+ # * A rack is a {CaTissue::StorageContainer} instance whose type is a {CaTissue::StorageType}
29
+ # instance which can hold the box {CaTissue::StorageType}.
30
+ # * A freezer is a {CaTissue::StorageContainer} instance whose type is a {CaTissue::StorageType}
31
+ # instance which can hold the rack {CaTissue::StorageType}.
32
+ # * Each {CaTissue::StorageContainer} belongs to a given {CaTissue::Site}. A child
33
+ # {CaTissue::StorageContainer} site defaults to its parent container site.
34
+ # Site consistency is not enforced by caTissue, i.e. it is possible to create
35
+ # a rack whose site differs from that of its parent freezer and child boxes.
36
+ # * {CaTissue::SpecimenArray} is not associated to a site.
37
+ # * The container children are partitioned into three methods for the three different
38
+ # types and pseudo-types of contained items: {CaTissue::StorageContainer},
39
+ # {CaTissue::SpecimenArray} and {CaTissue::Specimen#class}.
40
+ # * {CaTissue::SpecimenArray} holds {CaTissue::SpecimenArrayContent} positions, which
41
+ # are the functional equivalent of {CaTissue::SpecimenPosition} adapted for specimen
42
+ # arrays, although {CaTissue::SpecimenArrayContent} is not a {CaTissue::SpecimenPosition}
43
+ # or even an {CaTissue::AbstractPosition}. {CaTissue::SpecimenPosition} is functionally
44
+ # a specimen position in a box, whereas {CaTissue::SpecimenArrayContent} is functionally
45
+ # a specimen position in a specimen array.
46
46
  #
47
- # The ContainerType/Container mish-mash is partially rationalized in caRuby as follows:
48
- # * {CaTissue::StorageType} and {CaTissue::StorageContainer} include the
49
- # {CaTissue::StorageTypeHolder} module, which unifies treatment of contained
50
- # types.
51
- # * Similarly, {CaTissue::AbstractPosition} and {CaTissue::SpecimenArrayContent} include
52
- # the {CaTissue::Position} module, which unifies treatment of positions.
53
- # * Contained child types are consolidated into {CaTissue::StorageTypeHolder#child_types}.
54
- # * Similarly, {CaTissue::StorageContainer} child items are consolidated into
55
- # {CaTissue::StorageContainer#child_types}.
56
- # * The various container and position classes are augmented with helper methods to
57
- # add, move and find specimens and subcontainers. These methods hide the mind-numbing
58
- # eccentricity of caTissue specimen storage interaction.
59
- # The entire amalgamation is further simplifying by introducing the standard Ruby
60
- # container add method {CaTissue::Container::<<}. The only call the caRuby client
61
- # needs to make to add a specimen box to a freezer is:
62
- # freezer << box
63
- # which places the box in the first available rack slot in the freezer, or:
64
- # box >> freezer
47
+ # The ContainerType/Container mish-mash is partially rationalized in caRuby as follows:
48
+ # * {CaTissue::StorageType} and {CaTissue::StorageContainer} include the
49
+ # {CaTissue::StorageTypeHolder} module, which unifies treatment of contained
50
+ # types.
51
+ # * Similarly, {CaTissue::AbstractPosition} and {CaTissue::SpecimenArrayContent} include
52
+ # the {CaTissue::Position} module, which unifies treatment of positions.
53
+ # * Contained child types are consolidated into {CaTissue::StorageTypeHolder#child_types}.
54
+ # * Similarly, {CaTissue::StorageContainer} child items are consolidated into
55
+ # {CaTissue::StorageContainer#child_types}.
56
+ # * The various container and position classes are augmented with helper methods to
57
+ # add, move and find specimens and subcontainers. These methods hide the mind-numbing
58
+ # eccentricity of caTissue specimen storage interaction.
59
+ # The entire amalgamation is further simplifying by introducing the standard Ruby
60
+ # container add method {CaTissue::Container::<<}. The only call the caRuby client
61
+ # needs to make to add a specimen box to a freezer is:
62
+ # freezer << box
63
+ # which places the box in the first available rack slot in the freezer, or:
64
+ # box >> freezer
65
65
  class ContainerType
66
66
  add_attribute_aliases(:column_label => :oneDimensionLabel, :row_label => :twoDimensionLabel)
67
67
 
@@ -71,17 +71,17 @@ module CaTissue
71
71
 
72
72
  add_mandatory_attributes(:activity_status, :capacity, :one_dimension_label, :two_dimension_label)
73
73
 
74
- # caTissue alert - although capacity is not marked cascaded in Hibernate, it is created when the
75
- # ContainerType is created.
74
+ # @quirk caTissue although capacity is not marked cascaded in Hibernate, it is created when the
75
+ # ContainerType is created.
76
76
  add_dependent_attribute(:capacity)
77
77
 
78
78
  # Override default {CaRuby::Resource#merge_attributes} to support the Capacity :rows and :columns
79
79
  # pseudo-attributes.
80
80
  #
81
- # JRuby alert - Subclasses do not pick up this class's Resource method overrides.
82
- # Specimen picks up the AbstractSpecimen Resource overrides, but ContainerType subclasses do
83
- # not pick up ContainerType Resource overrides. Work-around is that each ContainerType
84
- # subclass must alias +merge_attributes+ to this method.
81
+ # @quirk JRuby Subclasses do not pick up this class's Resource method overrides.
82
+ # Specimen picks up the AbstractSpecimen Resource overrides, but ContainerType subclasses do
83
+ # not pick up ContainerType Resource overrides. Work-around is that each ContainerType
84
+ # subclass must alias +merge_attributes+ to this method.
85
85
  #
86
86
  # @param (see #merge_attributes)
87
87
  def merge_attributes(other, attributes=nil)
@@ -104,8 +104,9 @@ module CaTissue
104
104
  # @return an available container of this ContainerType which is not
105
105
  # {CaTissue::Container#completely_full?}.
106
106
  def find_available(site, opts=nil)
107
+ logger.debug { "Finding an available #{site} #{self} container..." }
107
108
  find_containers(:site => site).detect { |ctr| not ctr.completely_full? } or
108
- (create_container(:site => site).create if Options.get(:create, opts))
109
+ (new_container(:site => site).create if Options.get(:create, opts))
109
110
  end
110
111
 
111
112
  # Fetches containers of this ContainerType from the database.
@@ -113,7 +114,7 @@ module CaTissue
113
114
  # @param [<Symbol => Object>] params the optional search attribute => value hash
114
115
  # @return the containers of this type which satisfy the search parameters
115
116
  def find_containers(params=nil)
116
- tmpl = create_container(params)
117
+ tmpl = new_container(params)
117
118
  logger.debug { "Finding #{name} containers..." }
118
119
  tmpl.query
119
120
  end
@@ -123,7 +124,7 @@ module CaTissue
123
124
  #
124
125
  # @param [{Symbol => Object}] vh the attribute => value hash
125
126
  # @return [Container] the new container
126
- def create_container(vh=nil)
127
+ def new_container(vh=nil)
127
128
  vh ||= {}
128
129
  vh[:container_type] = self
129
130
  container_class.new(vh)
@@ -135,8 +136,8 @@ module CaTissue
135
136
  # The default {#one_dimension_label} is 'Column' if there is a non-zero dimension capacity, 'Unused' otherwise.
136
137
  # The default {#two_dimension_label} is 'Row' if there is a non-zero dimension capacity, 'Unused' otherwise.
137
138
  #
138
- # JRuby alert - See {#merge_container_type_attributes}. Work-around is that each ContainerType
139
- # subclass must alias +add_defaults_local+ to this method.
139
+ # @quirk JRuby See {#merge_container_type_attributes}. Work-around is that each ContainerType
140
+ # subclass must alias +add_defaults_local+ to this method.
140
141
  def add_defaults_local
141
142
  super
142
143
  self.capacity ||= Capacity.new.add_defaults
@@ -5,7 +5,7 @@ module CaTissue
5
5
  class DisposalEventParameters < CaTissue::SpecimenEventParameters
6
6
  add_attribute_defaults(:activity_status => 'Closed')
7
7
 
8
- # caTissue alert - DisposalEventParameters activity status is transient.
8
+ # @quirk caTissue DisposalEventParameters activity status is transient.
9
9
  qualify_attribute(:activity_status, :unfetched)
10
10
  end
11
11
  end
@@ -1,8 +1,8 @@
1
1
  module CaTissue
2
2
  # This HashCode mix-in overrides the caTissue hashCode and equality test to work around caTissue bugs.
3
3
  module HashCode
4
- # caTissue alert - caTissue hashCode changes with identifier assignment.
5
- # This leads to ugly cascading errors when used in a Set or Hash.
4
+ # @quirk caTissue caTissue hashCode changes with identifier assignment.
5
+ # This leads to ugly cascading errors when used in a Set or Hash.
6
6
  #
7
7
  # @return [Integer] a unique hash code
8
8
  # @see #==
@@ -10,10 +10,7 @@ module CaTissue
10
10
  proxy_object_id * 31 + 17
11
11
  end
12
12
 
13
- # Returns whether other is of type same type as this object with the same hash as this object.
14
- #
15
- # caTissue alert - Bug #70: caTissue equal returns true for class mismatch.
16
- #
13
+ # @quirk caTissue Bug #70: caTissue equal returns true for class mismatch.
17
14
  # @param other the object to compare
18
15
  # @return [Boolean] whether the objects are identical
19
16
  # @see #hash
@@ -6,16 +6,16 @@ module CaTissue
6
6
 
7
7
  # The NewSpecimenArrayOrderItem domain class.
8
8
  class NewSpecimenArrayOrderItem
9
- # caTissue alert - Bug #64: Some domain collection properties not initialized.
10
- # Initialize order_items if necessary.
9
+ # @quirk caTissue Bug #64: Some domain collection properties not initialized.
10
+ # Initialize order_items if necessary.
11
11
  #
12
12
  # @return [Java::JavaUtil::Set] the items
13
13
  def order_items
14
14
  getOrderItemCollection or (self.order_items = Java::JavaUtil::LinkedHashSet.new)
15
15
  end
16
16
 
17
- # caTissue alert - Bug #64: Some domain collection properties not initialized.
18
- # Initialize distributions if necessary.
17
+ # @quirk caTissue Bug #64: Some domain collection properties not initialized.
18
+ # Initialize distributions if necessary.
19
19
  def distributions
20
20
  getDistributionCollection or (self.distributions = Java::JavaUtil::LinkedHashSet.new)
21
21
  end
@@ -5,8 +5,8 @@ module CaTissue
5
5
 
6
6
  # The OrderDetails domain class.
7
7
  class OrderDetails
8
- # caTissue alert - Bug #64: Some domain collection properties not initialized.
9
- # Initialize order_items if necessary.
8
+ # @quirk caTissue Bug #64: Some domain collection properties not initialized.
9
+ # Initialize order_items if necessary.
10
10
  #
11
11
  # @return [Java::JavaUtil::Set] the items
12
12
  def order_items
@@ -16,7 +16,7 @@ module CaTissue
16
16
  def initialize
17
17
  super
18
18
  respond_to?(:order_items)
19
- # caTissue alert - work around caTissue Bug #64
19
+ # @quirk caTissue work around caTissue Bug #64
20
20
  self.order_items ||= Java::JavaUtil::LinkedHashSet.new
21
21
  end
22
22
  end
@@ -12,9 +12,9 @@ module CaTissue
12
12
 
13
13
  # The convenience Person name aggregate is not a Java property but is added as a transient attribute
14
14
  # which is reflected in the saved Java property name subfields.
15
- add_attribute(:name)
15
+ add_attribute(:name, CaRuby::Person::Name)
16
16
 
17
- # caTissue alert - clinical study is unsupported by 1.1.x caTissue, removed in 1.2.
17
+ # @quirk caTissue clinical study is unsupported by 1.1.x caTissue, removed in 1.2.
18
18
  if attribute_defined?(:clinical_study_registrations) then remove_attribute(:clinical_study_registrations) end
19
19
 
20
20
  add_attribute_aliases(:collection_registrations => :collection_protocol_registrations,
@@ -30,32 +30,35 @@ module CaTissue
30
30
  add_attribute_defaults(:activity_status => 'Active', :ethnicity => 'Unknown', :gender => 'Unspecified',
31
31
  :sex_genotype => 'Unknown', :vital_status => 'Unknown')
32
32
 
33
- # caTissue alert - Bug #154: Participant gender is specified by caTissue as optional, but if it is not set then
34
- # it appears as Female in the GUI even though it is null in the database.
33
+ # @quirk caTissue Bug #154: Participant gender is specified by caTissue as optional, but if it is not set then
34
+ # it appears as Female in the GUI even though it is null in the database.
35
35
  add_mandatory_attributes(:activity_status, :gender)
36
36
 
37
- # caTissue alert - Participant CPR cascade is simulated in the bizlogic.
38
- # See the PMI comment below.
37
+ # @quirk caTissue Participant CPR cascade is simulated in the bizlogic.
38
+ # See the PMI comment below.
39
39
  add_dependent_attribute(:collection_protocol_registrations)
40
40
 
41
41
  add_dependent_attribute(:races)
42
42
 
43
- # caTissue alert - Participant PMI is fetched but not cascaded. However, the Participant bizlogic
44
- # simulates PMI cascade. The bizlogic doesn't document why this is done, but it appears that the
45
- # reason is to inject an empty PMI if necessary in order to work around a caTissue query bug
46
- # (see merge_attribute comment). At any rate, mark PMI as cascaded in the caRuby metadata
47
- # to reflect the bizlogic simulation. However, this designation should be revisited with each
48
- # release, since if the bizlogic hack is removed then caRuby Participant PMI save will break.
43
+ # @quirk caTissue Participant PMI is fetched but not cascaded. However, the Participant bizlogic
44
+ # simulates PMI cascade. The bizlogic doesn't document why this is done, but it appears that the
45
+ # reason is to inject an empty PMI if necessary in order to work around a caTissue query bug
46
+ # (see merge_attribute comment). At any rate, mark PMI as cascaded in the caRuby metadata
47
+ # to reflect the bizlogic simulation. However, this designation should be revisited with each
48
+ # release, since if the bizlogic hack is removed then caRuby Participant PMI save will break.
49
49
  add_dependent_attribute(:participant_medical_identifiers)
50
50
 
51
51
  # SSN is a key, if present, but is not required.
52
52
  qualify_attribute(:social_security_number, :optional)
53
53
 
54
+ # The Participant proxy class.
55
+ self.annotation_proxy_class_name = 'ParticipantRecordEntry'
56
+
54
57
  # The clinicial annotation.
55
- add_annotation('Clinical', :package => 'clinical_annotation', :service => 'CA', :record_entry => 'ParticipantRecordEntry')
58
+ add_annotation('Clinical', :package => 'clinical_annotation', :service => 'CA')
56
59
 
57
- # caTissue alert - remove the autogenerated blank PMI.
58
- # cf. https://cabig-kc.nci.nih.gov/Biospecimen/forums/viewtopic.php?f=19&t=436&sid=ef98f502fc0ab242781b7759a0eaff36
60
+ # @quirk caTissue remove the autogenerated blank PMI.
61
+ # cf. https://cabig-kc.nci.nih.gov/Biospecimen/forums/viewtopic.php?f=19&t=436&sid=ef98f502fc0ab242781b7759a0eaff36
59
62
  def merge_attribute(attribute, newval, matches=nil)
60
63
  if attribute == :participant_medical_identifiers and newval then
61
64
  CaTissue::Participant.remove_empty_medical_identifier(newval)
@@ -63,24 +66,26 @@ module CaTissue
63
66
  super
64
67
  end
65
68
 
66
- # Returns the SSN if it exists, otherwise the first ParticipantMedicalIdentifier, if any, otherwise nil.
69
+ # @return the SSN if it exists, otherwise the first ParticipantMedicalIdentifier, if any, otherwise nil
67
70
  def key
68
71
  super or medical_identifiers.first
69
72
  end
70
73
 
71
- # Returns a new ParticipantMedicalIdentifier which adds this Participant to the given site
72
- # with Medical Record Number mrn.
74
+ # @param [CaTissue::Site] the registration site
75
+ # @param [String] mrn the registration MRN
76
+ # @return [CaTissue::ParticipantMedicalIdentifier] a new PMI which adds this Participant to the site
77
+ # with the MRN
73
78
  def add_mrn(site, mrn)
74
79
  CaTissue::ParticipantMedicalIdentifier.new(:participant => self, :site => site, :medical_record_number => mrn)
75
80
  end
76
81
 
77
- # Returns this Participant's medical record numbers. Each medical record number is Site-specific.
82
+ # @return [<String>] this Participant's medical record numbers. Each medical record number is site-specific.
78
83
  # @see the medical_identifiers attribute for MRN-site associations
79
84
  def medical_record_numbers
80
85
  medical_identifiers.map { |pmi| pmi.medicalRecordNumber }
81
86
  end
82
87
 
83
- # Returns all specimens collected from this Participant.
88
+ # @return [<CTissue::Specimen>] all specimens collected from this participant
84
89
  def specimens
85
90
  Flattener.new(registrations.specimens.map { |cpr| cpr.specimens })
86
91
  end
@@ -93,6 +98,7 @@ module CaTissue
93
98
  # Returns the MRN for this participant. If this Participant does not have exactly one
94
99
  # MRN, then this method returns nil. This method is a convenience for the common situation
95
100
  # where a participant is enrolled at one site.
101
+ # @return [String] the MRN
96
102
  def medical_record_number
97
103
  return medical_identifiers.first.medical_record_number if medical_identifiers.size == 1
98
104
  end
@@ -100,6 +106,8 @@ module CaTissue
100
106
  # Returns the collection site for which this participant has a MRN. If there is not exactly one
101
107
  # such site, then this method returns nil. This method is a convenience for the common situation
102
108
  # where a participant is enrolled at one site.
109
+ #
110
+ # @return [CaTissue::Site] the collection site
103
111
  def collection_site
104
112
  return unless medical_identifiers.size == 1
105
113
  site = medical_identifiers.first.site