caruby-tissue 1.5.4 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/History.md +4 -0
  2. data/examples/galena/README.md +2 -11
  3. data/examples/galena/conf/migration/filter_defaults.yaml +1 -0
  4. data/examples/galena/conf/migration/filter_values.yaml +13 -0
  5. data/examples/galena/lib/galena/tissue/migration/filter_shims.rb +3 -15
  6. data/examples/galena/lib/galena/tissue/migration/frozen_shims.rb +3 -6
  7. data/examples/galena/lib/galena/tissue/seed/defaults.rb +2 -2
  8. data/lib/catissue/annotation/annotatable_class.rb +10 -8
  9. data/lib/catissue/annotation/annotation_class.rb +6 -3
  10. data/lib/catissue/annotation/annotation_module.rb +7 -2
  11. data/lib/catissue/cli/command.rb +11 -4
  12. data/lib/catissue/cli/migrate.rb +5 -16
  13. data/lib/catissue/database/annotation/annotation_service.rb +2 -2
  14. data/lib/catissue/database/annotation/entity_facade.rb +6 -11
  15. data/lib/catissue/database/annotation/record_entry_integrator.rb +4 -4
  16. data/lib/catissue/database/controlled_values.rb +2 -3
  17. data/lib/catissue/database.rb +64 -35
  18. data/lib/catissue/domain/abstract_specimen.rb +24 -26
  19. data/lib/catissue/domain/abstract_specimen_collection_group.rb +1 -1
  20. data/lib/catissue/domain/capacity.rb +1 -1
  21. data/lib/catissue/domain/collection_protocol.rb +12 -9
  22. data/lib/catissue/domain/collection_protocol_event.rb +9 -11
  23. data/lib/catissue/domain/collection_protocol_registration.rb +5 -5
  24. data/lib/catissue/domain/container.rb +3 -4
  25. data/lib/catissue/domain/container_type.rb +11 -12
  26. data/lib/catissue/domain/disposal_event_parameters.rb +1 -1
  27. data/lib/catissue/domain/new_specimen_array_order_item.rb +6 -5
  28. data/lib/catissue/domain/order_details.rb +4 -0
  29. data/lib/catissue/domain/participant.rb +17 -17
  30. data/lib/catissue/domain/participant_medical_identifier.rb +2 -3
  31. data/lib/catissue/domain/site.rb +7 -9
  32. data/lib/catissue/domain/specimen/pathology/prostate_specimen_gleason_score.rb +2 -3
  33. data/lib/catissue/domain/specimen/pathology/prostate_specimen_pathology_annotation.rb +4 -3
  34. data/lib/catissue/domain/specimen/pathology/specimen_additional_finding.rb +5 -7
  35. data/lib/catissue/domain/specimen/pathology/specimen_base_solid_tissue_pathology_annotation.rb +11 -11
  36. data/lib/catissue/domain/specimen/pathology/specimen_details.rb +2 -4
  37. data/lib/catissue/domain/specimen/pathology/specimen_histologic_grade.rb +2 -4
  38. data/lib/catissue/domain/specimen/pathology/specimen_histologic_type.rb +6 -6
  39. data/lib/catissue/domain/specimen/pathology/specimen_histologic_variant_type.rb +2 -4
  40. data/lib/catissue/domain/specimen/pathology/specimen_invasion.rb +2 -4
  41. data/lib/catissue/domain/specimen.rb +35 -45
  42. data/lib/catissue/domain/specimen_array.rb +1 -1
  43. data/lib/catissue/domain/specimen_collection_group/pathology/base_pathology_annotation.rb +4 -4
  44. data/lib/catissue/domain/specimen_collection_group/pathology/base_solid_tissue_pathology_annotation.rb +4 -4
  45. data/lib/catissue/domain/specimen_collection_group.rb +40 -46
  46. data/lib/catissue/domain/specimen_protocol.rb +4 -6
  47. data/lib/catissue/domain/specimen_requirement.rb +13 -16
  48. data/lib/catissue/domain/storage_container.rb +5 -2
  49. data/lib/catissue/domain/storage_type.rb +1 -1
  50. data/lib/catissue/domain/user.rb +16 -7
  51. data/lib/catissue/extract/command.rb +1 -1
  52. data/lib/catissue/extract/delta.rb +7 -15
  53. data/lib/catissue/migration/migratable.rb +106 -8
  54. data/lib/catissue/migration/migrator.rb +20 -12
  55. data/lib/catissue/migration/shims.rb +3 -3
  56. data/lib/catissue/util/collectible.rb +2 -2
  57. data/lib/catissue/util/collectible_event_parameters.rb +2 -2
  58. data/lib/catissue/util/position.rb +3 -3
  59. data/lib/catissue/version.rb +1 -1
  60. data/test/lib/catissue/domain/address_test.rb +3 -2
  61. data/test/lib/catissue/domain/participant_test.rb +11 -0
  62. data/test/lib/catissue/domain/specimen_collection_group_test.rb +62 -12
  63. data/test/lib/catissue/domain/specimen_test.rb +0 -1
  64. data/test/lib/catissue/test_case.rb +2 -2
  65. data/test/lib/examples/galena/tissue/migration/seedify.rb +5 -5
  66. data/test/lib/examples/galena/tissue/migration/test_case.rb +9 -5
  67. metadata +8 -17
  68. data/conf/extract/simple_fields.yaml +0 -4
  69. data/conf/migration/filter_fields.yaml +0 -7
  70. data/conf/migration/filter_migration.yaml +0 -9
  71. data/conf/migration/frozen_fields.yaml +0 -11
  72. data/conf/migration/frozen_migration.yaml +0 -9
  73. data/conf/migration/general_fields.yaml +0 -44
  74. data/conf/migration/general_migration.yaml +0 -9
  75. data/conf/migration/simple_fields.yaml +0 -30
  76. data/conf/migration/simple_migration.yaml +0 -7
  77. data/conf/migration/small_fields.yaml +0 -24
  78. data/conf/migration/small_migration.yaml +0 -9
@@ -1,6 +1,8 @@
1
1
  module CaTissue
2
2
  class Specimen
3
3
  class Pathology
4
+ # @quirk caTissue The 1.1 class HistologicVariantType is renamed to SpecimenHistologicVariantType in 1.2.
5
+ # Alias the Ruby class constant for forward and backaward compatibility.
4
6
  begin
5
7
  resource_import Java::pathology_specimen.SpecimenHistologicVariantType
6
8
  const_set(:HistologicVariantType, SpecimenHistologicVariantType)
@@ -11,10 +13,6 @@ module CaTissue
11
13
  const_set(:SpecimenHistologicVariantType, HistologicVariantType)
12
14
  logger.debug { "Aliased the caTissue 1.1 Specimen pathology annotation class HistologicVariantType class to the renamed 1.2 SpecimenHistologicVariantType." }
13
15
  end
14
-
15
- # @quirk caTissue The 1.1 class HistologicVariantType is renamed to SpecimenHistologicVariantType in 1.2.
16
- # Alias the Ruby class constant for forward and backaward compatibility.
17
- class SpecimenHistologicVariantType; end
18
16
  end
19
17
  end
20
18
  end
@@ -1,6 +1,8 @@
1
1
  module CaTissue
2
2
  class Specimen
3
3
  class Pathology
4
+ # @quirk caTissue The 1.1 class Invasion is renamed to SpecimenInvasion in 1.2.
5
+ # Alias the Ruby class constant for forward and backaward compatibility.
4
6
  begin
5
7
  resource_import Java::pathology_specimen.SpecimenInvasion
6
8
  const_set(:Invasion, SpecimenInvasion)
@@ -11,10 +13,6 @@ module CaTissue
11
13
  const_set(:SpecimenInvasion, Invasion)
12
14
  logger.debug { "Aliased the caTissue 1.1 Specimen pathology annotation class Invasion class to the renamed 1.2 SpecimenInvasion." }
13
15
  end
14
-
15
- # @quirk caTissue The 1.1 class Invasion is renamed to SpecimenInvasion in 1.2.
16
- # Alias the Ruby class constant for forward and backaward compatibility.
17
- class SpecimenInvasion; end
18
16
  end
19
17
  end
20
18
  end
@@ -9,40 +9,6 @@ module CaTissue
9
9
  resource_import Java::edu.wustl.catissuecore.domain.Specimen
10
10
 
11
11
  # The Specimen domain class.
12
- #
13
- # @quirk caTissue Specimen consent_tier_statuses is cascaded but not fetched.
14
- #
15
- # @quirk caTissue When a Specimen is auto-generated or created, a consent tier
16
- # status is created for each registration consent. A created Specimen has a
17
- # a well-formed status record. An auto-generated status record is malformed,
18
- # missing the Specimen id reference. This differs from the auto-generated
19
- # SCG status record, which is malformed in a different way which results in
20
- # a severe display error, as described in Bug #156. The malformed Specimen
21
- # status record results in displaying null field values in the Specimen Consent
22
- # page, but otherwise no adverse effects.
23
- #
24
- # @quirk caTissue Specimen position update is cascaded in Hibernate, but updateObject
25
- # is precluded by the caTissue business logic. Position change is performed by a
26
- # TransferEventParameters proxy instead. SpecimenPosition work-around is to
27
- # designate a save proxy.
28
- #
29
- # @quirk caTissue the Specimen parent_changed flag is ignored in a caCORE update
30
- # or create Specimen argument and is set on the server. Mark the attribute as unsaved.
31
- #
32
- # @quirk caTissue Bug #159: Update pending Specimen ignores availableQuantity.
33
- # available_quantity is not reflected in the caCORE create or update result.
34
- # This is true even though the caTissue GUI supports available_quantity update.
35
- # Work-around is to set the :autogenerated flag, which will refetch a saved Specimen
36
- # if there is a change to the available_quantity value and will reupdate the Specimen
37
- # if the fetched available_quantity differs from the save argument value.
38
- #
39
- # @quirk caTissue An auto-generated Specimen auto-generates the collection and received events.
40
- # Therefore, CPR create must match the complete auto-generated SCG-Specimen-Event hierarchy.
41
- # However, SpecimenRequirement events are not auto-generated. Therefore, the AbstractSpecimen
42
- # events behavior must be specialized for Specimen but not SpecimenRequirement.
43
- #
44
- # @quirk caTissue remove the autogenerated blank ExternalIdentifier.
45
- # cf. https://cabig-kc.nci.nih.gov/Biospecimen/forums/viewtopic.php?f=19&t=436&sid=ef98f502fc0ab242781b7759a0eaff36
46
12
  class Specimen < CaTissue::AbstractSpecimen
47
13
  include Storable, Collectible
48
14
 
@@ -87,10 +53,24 @@ module CaTissue
87
53
  # Specimen children are cascaded.
88
54
  qualify_attribute(:child_specimens, :autogenerated)
89
55
 
56
+ # @quirk caTissue Specimen consent_tier_statuses is cascaded but not fetched.
57
+ #
58
+ # @quirk caTissue When a Specimen is auto-generated or created, a consent tier
59
+ # status is created for each registration consent. A created Specimen has a
60
+ # a well-formed status record. An auto-generated status record is malformed,
61
+ # missing the Specimen id reference. This differs from the auto-generated
62
+ # SCG status record, which is malformed in a different way which results in
63
+ # a severe display error, as described in Bug #156. The malformed Specimen
64
+ # status record results in displaying null field values in the Specimen Consent
65
+ # page, but otherwise no adverse effects.
90
66
  add_dependent_attribute(:consent_tier_statuses, :unfetched)
91
67
 
92
68
  add_dependent_attribute(:external_identifiers)
93
69
 
70
+ # @quirk caTissue Specimen position update is cascaded in Hibernate, but updateObject
71
+ # is precluded by the caTissue business logic. Position change is performed by a
72
+ # TransferEventParameters proxy instead. SpecimenPosition work-around is to
73
+ # designate a save proxy.
94
74
  add_dependent_attribute(:specimen_position)
95
75
 
96
76
  # Although label is the key, it is auto-generated if not provided in the create.
@@ -108,10 +88,22 @@ module CaTissue
108
88
  # Oddly, the seldom-used biohazards are fetched along with Specimen.
109
89
  qualify_attribute(:biohazards, :fetched)
110
90
 
91
+ # @quirk caTissue the Specimen parent_changed flag is ignored in a caCORE update
92
+ # or create Specimen argument and is set on the server. Mark the attribute as unsaved.
111
93
  qualify_attribute(:parent_changed, :unsaved)
112
94
 
95
+ # @quirk caTissue Bug #159: Update pending Specimen ignores availableQuantity.
96
+ # available_quantity is not reflected in the caCORE create or update result.
97
+ # This is true even though the caTissue GUI supports available_quantity update.
98
+ # Work-around is to set the :autogenerated flag, which will refetch a saved Specimen
99
+ # if there is a change to the available_quantity value and will reupdate the Specimen
100
+ # if the fetched available_quantity differs from the save argument value.
113
101
  qualify_attribute(:available_quantity, :autogenerated)
114
102
 
103
+ # @quirk caTissue An auto-generated Specimen auto-generates the collection and received events.
104
+ # Therefore, CPR create must match the complete auto-generated SCG-Specimen-Event hierarchy.
105
+ # However, SpecimenRequirement events are not auto-generated. Therefore, the AbstractSpecimen
106
+ # events behavior must be specialized for Specimen but not SpecimenRequirement.
115
107
  qualify_attribute(:specimen_events, :autogenerated)
116
108
 
117
109
  # The Specimen proxy class.
@@ -123,15 +115,13 @@ module CaTissue
123
115
  # Specimen storage is constrained on the basis of the +specimen_class+.
124
116
  alias :storable_type :specimen_class
125
117
 
126
- # @quirk caTissue Work around caTissue Bug #64, by initializing the Specimen
127
- # consent tier statuses set.
128
118
  def initialize
129
119
  super
120
+ # work around caTissue Bug #64
130
121
  self.consent_tier_statuses ||= Java::JavaUtil::LinkedHashSet.new
131
122
  end
132
123
 
133
- # @return [Specimen, SpecimenCollectionGroup] the parent specimen, if it exists,
134
- # otherwise the SCG
124
+ # Overrides {Resource#owner} to return the parent_specimen, if it exists, or the specimen_collection_group otherwise.
135
125
  def owner
136
126
  parent_specimen or specimen_collection_group
137
127
  end
@@ -146,7 +136,7 @@ module CaTissue
146
136
  collection_status == 'Collected'
147
137
  end
148
138
 
149
- # Relaxes the +CaRuby::Persistable.fetch_saved?+ condition for a Specimen as follows:
139
+ # Relaxes the {CaRuby::Persistable#fetch_saved?} condition for a Specimen as follows:
150
140
  # * If the Specimen available_quantity was updated, then fetch the saved Specimen.
151
141
  #
152
142
  # @return (see CaRuby::Persistable#fetch_saved)
@@ -164,6 +154,8 @@ module CaTissue
164
154
  CaTissue::CheckInCheckOutEventParameter.new(:specimen => self, :storage_status => Status.CHECKED_IN)
165
155
  end
166
156
 
157
+ # @quirk caTissue remove the autogenerated blank ExternalIdentifier.
158
+ # cf. https://cabig-kc.nci.nih.gov/Biospecimen/forums/viewtopic.php?f=19&t=436&sid=ef98f502fc0ab242781b7759a0eaff36
167
159
  def merge_attribute(attribute, newval, matches=nil)
168
160
  if attribute == :external_identifiers and newval then
169
161
  CaTissue::Specimen.remove_empty_external_identifier(newval)
@@ -183,7 +175,7 @@ module CaTissue
183
175
  # update
184
176
  # end
185
177
 
186
- # Override default +CaRuby::Resource.merge_attributes+ to ignore a source SpecimenRequirement parent_specimen.
178
+ # Override default {CaRuby::Resource#merge_attributes} to ignore a source SpecimenRequirement parent_specimen.
187
179
  def merge_attributes(other, attributes=nil)
188
180
  case other
189
181
  when SpecimenRequirement then
@@ -205,11 +197,9 @@ module CaTissue
205
197
  self
206
198
  end
207
199
 
208
- # This method relaxes +CaRuby::Resource.match_in_owner_scope+ to include a match on at least
209
- # one external identifier in the scope of an owner SCG.
210
- #
211
- # Wparam [<Specimen>] the specimens to match against
212
- # @return [Specimen] the Specimen in others which matches this Specimen.
200
+ # Returns the Specimen in others which matches this Specimen in the scope of an owner SCG.
201
+ # This method relaxes {CaRuby::Resource#match_in_owner_scope} to include a match on at least
202
+ # one external identifier.
213
203
  def match_in_owner_scope(others)
214
204
  super or others.detect do |other|
215
205
  other.class == self.class and external_identifier_match?(other)
@@ -4,8 +4,8 @@ module CaTissue
4
4
  # import the Java class
5
5
  resource_import Java::edu.wustl.catissuecore.domain.SpecimenArray
6
6
 
7
- # @quirk caTissue the superclass Container occupied_positions does not apply to SpecimenArray.
8
7
  class SpecimenArray
8
+ # @quirk caTissue the superclass Container occupied_positions does not apply to SpecimenArray.
9
9
  remove_attribute(:occupied_positions)
10
10
 
11
11
  # Initializes this instance's child storage types from the given type.
@@ -3,11 +3,11 @@ module CaTissue
3
3
  class Pathology
4
4
  resource_import Java::pathology_scg.BasePathologyAnnotation
5
5
 
6
- # @quirk caTissue The BasePathologyAnnotation => HistologicType collection
7
- # property is misnamed as histologicType rather than histologicTypeCollection. This misnaming
8
- # prevents caRuby from inferring the attribute domain type and inverse. Work-around is to set
9
- # these attribute features manually.
10
6
  class BasePathologyAnnotation
7
+ # @quirk caTissue The BasePathologyAnnotation => HistologicType collection
8
+ # property is misnamed as histologicType rather than histologicTypeCollection. This misnaming
9
+ # prevents caRuby from inferring the attribute domain type and inverse. Work-around is to set
10
+ # these attribute features manually.
11
11
  set_attribute_type(:histologic_type, CaTissue::SpecimenCollectionGroup::Pathology::HistologicType)
12
12
  set_attribute_inverse(:histologic_type, :base_pathology_annotation)
13
13
  end
@@ -3,11 +3,11 @@ module CaTissue
3
3
  class Pathology
4
4
  resource_import Java::pathology_scg.BaseSolidTissuePathologyAnnotation
5
5
 
6
- # @quirk caTissue The BaseSolidTissuePathologyAnnotation => HistologicGrade collection
7
- # property is misnamed as histologicGrade rather than histologicGradeCollection. This misnaming
8
- # prevents caRuby from inferring the attribute domain type and inverse. Work-around is to set
9
- # these attribute features manually.
10
6
  class BaseSolidTissuePathologyAnnotation
7
+ # @quirk caTissue The BaseSolidTissuePathologyAnnotation => HistologicGrade collection
8
+ # property is misnamed as histologicGrade rather than histologicGradeCollection. This misnaming
9
+ # prevents caRuby from inferring the attribute domain type and inverse. Work-around is to set
10
+ # these attribute features manually.
11
11
  set_attribute_type(:histologic_grade, CaTissue::SpecimenCollectionGroup::Pathology::HistologicGrade)
12
12
  set_attribute_inverse(:histologic_grade, :base_solid_tissue_pathology_annotation)
13
13
  end
@@ -10,45 +10,7 @@ module CaTissue
10
10
  #
11
11
  # _Note_: the SpecimenCollectionGroup name attribute is auto-generated on create in caTissue 1.1 API and should not
12
12
  # be set by API clients when creating a new SpecimenCollectionGroup in the database.
13
- #
14
- # @quirk caTissue Bug #116: specimen_collection_site is incorrectly attached in the caTissue class
15
- # model to AbstractSpecimenCollectionGroup rather than SpecimenCollectionGroup. CollectionProtocolEvent
16
- # is a subclass of AbstractSpecimenCollectionGroup but does not have a collection site. Therfore, the
17
- # specimen_collection_site is ignored in the caRuby AbstractSpecimenCollectionGroup class declaration
18
- # and declared as an aliased, mandatory, fetched attribute for the SpecimenCollectionGroup subclass only.
19
- #
20
- # @quirk caTissue An auto-generated or created SCG auto-generates a ConsentTierStatus for each
21
- # ConsentTierResponse defined in the SCG owner CPR.
22
- #
23
- # @quirk caTissue SCG consent_tier_statuses is cascaded but not fetched.
24
- #
25
- # @quirk caTissue SpecimenCollectionGroup auto-generated update ignores the referenced
26
- # specimen_event_parameters and instead creates new parameters. This occurs only on the
27
- # first update, and an SEP cannot be added to an existing, updated SCG. Work-around is
28
- # to update the SCG template without the parameters, then update the parameters separately.
29
- #
30
- # @quirk caTissue although SpecimenCollectionGroup auto-generated update ignores referenced
31
- # specimen_event_parameters, collection and received event parameters are mandatory for a
32
- # a created SCG. Set the +:autogenerated_on_update_only+ flag rather than the +:autogenerate+
33
- # to mark the attribute to handle this quirk.
34
- #
35
- # @quirk caTissue SCG specimens query result does not set the Specimen children and parent, even
36
- # though they are guaranteed to be in the SCG specimens result set. The children and parent must be
37
- # fetched separately, resulting in redundant copies of the same Specimen and additional fetches.
38
- # caRuby partially rectifies this lapse by reconciling the SCG specimens parent-child relationships
39
- # within the SCG scope. class SpecimenCollectionGroup < CaTissue::AbstractSpecimenCollectionGroup
40
- #
41
- # @quirk caTissue caTissue requires that a SpecimenCollectionGroup update object references a
42
- # CollectionProtocolRegistration with a Participant reference. This is a caTissue bug, since the
43
- # CPR identifier should be sufficient for a SCG update, but caTissue bizlogic requires an extraneous
44
- # CPR -> Participant reference. The work-around is too mark the attribute with a special
45
- # +:include_in_save_template+ flag.
46
- #
47
- # @quirk caTissue Bug #65: Although SCG name uniquely identifies a SCG, the SCG name is auto-generated on create
48
- # and cannnot be set by the client. Therefore, name is marked as update_only.
49
- #
50
- # @quirk caTissue Bug #64: Initialize the SCG consent_tier_statuses to an empty set.
51
- class SpecimenCollectionGroup
13
+ class SpecimenCollectionGroup < CaTissue::AbstractSpecimenCollectionGroup
52
14
  include Collectible
53
15
 
54
16
  # @quirk caTissue Bug #64: Some domain collection properties not initialized.
@@ -84,6 +46,11 @@ module CaTissue
84
46
  :events => :specimen_event_parameters,
85
47
  :registration => :collection_protocol_registration)
86
48
 
49
+ # @quirk caTissue Bug #116: specimen_collection_site is incorrectly attached in the caTissue class
50
+ # model to AbstractSpecimenCollectionGroup rather than SpecimenCollectionGroup. CollectionProtocolEvent
51
+ # is a subclass of AbstractSpecimenCollectionGroup but does not have a collection site. Therfore, the
52
+ # specimen_collection_site is ignored in the caRuby AbstractSpecimenCollectionGroup class declaration
53
+ # and declared as an aliased, mandatory, fetched attribute for the SpecimenCollectionGroup subclass only.
87
54
  add_mandatory_attributes(:specimen_collection_site, :clinical_diagnosis, :collection_status)
88
55
 
89
56
  qualify_attribute(:specimen_collection_site, :fetched)
@@ -92,6 +59,10 @@ module CaTissue
92
59
 
93
60
  set_alternate_key_attributes(:surgical_pathology_number, :collection_protocol_registration)
94
61
 
62
+ # @quirk caTissue An auto-generated or created SCG auto-generates a ConsentTierStatus for each
63
+ # ConsentTierResponse defined in the SCG owner CPR.
64
+ #
65
+ # @quirk caTissue SCG consent_tier_statuses is cascaded but not fetched.
95
66
  add_dependent_attribute(:consent_tier_statuses, :autogenerated, :unfetched)
96
67
 
97
68
  # SCG event parameters are disjoint, since they are owned by either a SCG or a Specimen.
@@ -99,11 +70,26 @@ module CaTissue
99
70
  # A SCG SEP is only created as a dependent when the SCG is created. A SCG SEP
100
71
  # cannot be created for an existing SCG. By contrast, a Specimen SEP can only be
101
72
  # created, not updated.
73
+ #
74
+ # @quirk caTissue SpecimenCollectionGroup auto-generated update ignores the referenced
75
+ # specimen_event_parameters and instead creates new parameters. This occurs only on the
76
+ # first update, and an SEP cannot be added to an existing, updated SCG. Work-around is
77
+ # to update the SCG template without the parameters, then update the parameters separately.
78
+ #
79
+ # @quirk caTissue although SpecimenCollectionGroup auto-generated update ignores referenced
80
+ # specimen_event_parameters, collection and received event parameters are mandatory for a
81
+ # a created SCG. Set the +:autogenerated_on_update_only+ flag rather than the +:autogenerate+
82
+ # to mark the attribute to handle this quirk.
102
83
  add_dependent_attribute(:specimen_event_parameters, :autogenerated_on_update, :disjoint)
103
84
 
104
85
  # SCG Specimens are auto-generated from SpecimenRequirement templates when the SCG is created.
105
86
  # The Specimens are not cascaded.
106
87
  #
88
+ # @quirk caTissue SCG specimens query result does not set the Specimen children and parent, even
89
+ # though they are guaranteed to be in the SCG specimens result set. The children and parent must be
90
+ # fetched separately, resulting in redundant copies of the same Specimen and additional fetches.
91
+ # caRuby partially rectifies this lapse by reconciling the SCG specimens parent-child relationships
92
+ # within the SCG scope.
107
93
  add_dependent_attribute(:specimens, :logical, :autogenerated)
108
94
 
109
95
  # The CPE-SCG association is bi-directional.
@@ -112,17 +98,25 @@ module CaTissue
112
98
  # CPE is fetched but not cascaded.
113
99
  qualify_attribute(:collection_protocol_event, :fetched)
114
100
 
101
+ # @quirk caTissue caTissue requires that a SpecimenCollectionGroup update object references a
102
+ # CollectionProtocolRegistration with a Participant reference. This is a caTissue bug, since the
103
+ # CPR identifier should be sufficient for a SCG update, but caTissue bizlogic requires an extraneous
104
+ # CPR -> Participant reference. The work-around is too mark the attribute with a special
105
+ # +:include_in_save_template+ flag.
115
106
  qualify_attribute(:collection_protocol_registration, :include_in_save_template)
116
107
 
108
+ # @quirk caTissue Bug #65: Although SCG name uniquely identifies a SCG, the SCG name is auto-generated on create
109
+ # and cannnot be set by the client. Therefore, name is marked as update_only.
117
110
  qualify_attribute(:name, :autogenerated, :update_only)
118
111
 
119
112
  # The SCG proxy class.
120
113
  self.annotation_proxy_class_name = 'SCGRecordEntry'
121
-
114
+
122
115
  # The SCG pathology annotation.
123
116
  add_annotation('Pathology', :package => 'pathology_scg', :service => 'pathologySCG')
124
117
 
125
- def initialize
118
+ # @quirk caTissue Bug #64: Initialize the SCG consent_tier_statuses to an empty set.
119
+ def initialize
126
120
  super
127
121
  # work around caTissue Bug #64
128
122
  self.consent_tier_statuses ||= Java::JavaUtil::LinkedHashSet.new
@@ -159,11 +153,11 @@ module CaTissue
159
153
  end
160
154
 
161
155
  # Merges the other object into this SpecimenCollectionGroup. This method augments
162
- # +CaRuby::Resource.merge_attributes+ as follows:
156
+ # {CaRuby::Resource#merge_attributes} as follows:
163
157
  # * Adds the transitive closure of each non-derived Specimen in other.
164
158
  #
165
159
  # @param (see CaRuby::Resource#merge_attributes)
166
- # @option (see Collectible#merge_attributes)
160
+ # @option (see CaTissue::Collectible#merge_attributes)
167
161
  def merge_attributes(other, attributes=nil)
168
162
  if Hash === other then
169
163
  # extract the event parameters
@@ -191,7 +185,7 @@ module CaTissue
191
185
  super and event_point == other.event_point
192
186
  end
193
187
 
194
- # Overrides +CaRuby::Resource.direct_dependents+ in the case of the _specimens_ attribute to select
188
+ # Overrides {CaRuby::Resource#direct_dependents} in the case of the _specimens_ attribute to select
195
189
  # only top-level Specimens not derived from another Specimen.
196
190
  def direct_dependents(attribute)
197
191
  if attribute == :specimens then
@@ -212,7 +206,7 @@ module CaTissue
212
206
  end
213
207
  end
214
208
 
215
- # Relaxes the +CaRuby::Persistable.saved_fetch_attributes+ condition for a SCG as follows:
209
+ # Relaxes the {CaRuby::Persistable#saved_fetch_attributes} condition for a SCG as follows:
216
210
  # * If the SCG status was updated from +Pending+ to +Collected+, then fetch the saved SCG event parameters.
217
211
  #
218
212
  # @param (see CaRuby::Persistable#saved_fetch_attributes)
@@ -221,7 +215,7 @@ module CaTissue
221
215
  operation == :update && status_changed_to_complete? ? EVENT_PARAM_ATTRS : super
222
216
  end
223
217
 
224
- # Relaxes the +CaRuby::Persistable.saved_fetch_attributes+ condition for a SCG as follows:
218
+ # Relaxes the {CaRuby::Persistable#saved_fetch_attributes} condition for a SCG as follows:
225
219
  # * If the SCG status was updated from +Pending+ to +Collected+, then fetch the saved SCG event parameters.
226
220
  #
227
221
  # @param (see CaRuby::Persistable#saved_fetch_attributes)
@@ -5,19 +5,17 @@ module CaTissue
5
5
  resource_import Java::edu.wustl.catissuecore.domain.SpecimenProtocol
6
6
 
7
7
  # The SpecimenProtocol domain class.
8
- #
9
- # @quirk caTissue Bug #155: enrollment is incorrectly defined in SpecimenProtocol rather
10
- # than CollectionProtocol. It is defaulted here until this defect is fixed.
11
- #
12
- # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
13
- # Create CollectionProtocol in API ignores startDate.
14
8
  class SpecimenProtocol
15
9
  set_secondary_key_attributes(:title)
16
10
 
11
+ # @quirk caTissue Bug #155: enrollment is incorrectly defined in SpecimenProtocol rather
12
+ # than CollectionProtocol. It is defaulted here until this defect is fixed.
17
13
  add_attribute_defaults(:activity_status => 'Active', :enrollment => 0)
18
14
 
19
15
  add_mandatory_attributes(:principal_investigator, :activity_status, :start_date, :short_title)
20
16
 
17
+ # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
18
+ # Create CollectionProtocol in API ignores startDate.
21
19
  qualify_attribute(:start_date, :update_only)
22
20
 
23
21
  private
@@ -36,17 +36,14 @@ module CaTissue
36
36
  # parent CPE is created.
37
37
  qualify_attribute(:child_specimens, :logical)
38
38
 
39
- # @return [SpecimenRequirement, CollectionProtocolEvent] the parent requirement,
40
- # if it is set, otherwise the collection protocol event
39
+ # Overrides {Resource#owner} to return the parent_specimen, if it exists, or the collection_protocol_event otherwise.
41
40
  def owner
42
41
  parent_specimen or collection_protocol_event
43
42
  end
44
43
 
45
- # This method relaxes +CaRuby::Resource.match_in_owner_scope+ for a requirement that matches another requirement
46
- # with the same class, specimen type, pathological_status and characteristics.
47
- #
48
- # @return [SpecimenRequirement] the requirement in others which matches this requirement in the scope of an
49
- # owner {CollectionProtocolEvent}
44
+ # Returns the SpecimenRequirement in others which matches this SpecimenRequirement in the scope of an owner CollectionProtocolEvent.
45
+ # This method relaxes {CaRuby::Resource#match_in_owner_scope} for a SpecimenRequirement that matches any SpecimenRequirement
46
+ # in others with the same class, specimen type, pathological_status and characteristics.
50
47
  def match_in_owner_scope(others)
51
48
  others.detect do |other|
52
49
  self.class == other.class and specimen_type == other.specimen_type and pathological_status == other.pathological_status and
@@ -56,8 +53,7 @@ module CaTissue
56
53
 
57
54
  private
58
55
 
59
- # @param [SpecimenRequirement] the requirement to match against
60
- # @return [Boolean] whether this requirement's characteristics matches the other requirement's characteristics
56
+ # Returns whether this SpecimenRequirement characteristics matches the other SpecimenRequirement characteristics
61
57
  # on the tissue site and tissue side.
62
58
  def match_characteristics(other)
63
59
  chr = characteristics
@@ -65,17 +61,19 @@ module CaTissue
65
61
  chr and ochr and chr.tissue_side == ochr.tissue_side and chr.tissue_site == ochr.tissue_site
66
62
  end
67
63
 
68
- # @raise [NotImplementedError] always, since SpecimenRequirement is abstract
64
+ # Raises NotImplementedError, since SpecimenRequirement is abstract.
69
65
  def self.allocate
70
66
  raise NotImplementedError.new("SpecimenRequirement is abstract; use the create method to make a new instance")
71
67
  end
72
68
 
73
69
  public
74
70
 
71
+ # @quirk caTissue Bug #64 - consent tier responses is not initialized to an empty set
72
+ # in the Java constructor. Initialize it to a +LinkedHashSet+ in caRuby.
75
73
  def initialize
76
74
  super
75
+ # @quirk JRuby specimens property method is not accessible until respond_to? is called.
77
76
  respond_to?(:specimens)
78
- # work around caTissue Bug #64
79
77
  self.specimens ||= Java::JavaUtil::LinkedHashSet.new
80
78
  end
81
79
 
@@ -97,15 +95,14 @@ module CaTissue
97
95
  klass.new(params.merge(:collection_protocol_event => event))
98
96
  end
99
97
 
100
- # @return [CollectionProtocol, nil] the collection event protocol, if any
98
+ # Returns the {#collection_event} protocol, if any.
101
99
  def collection_protocol
102
100
  collection_event.protocol if collection_event
103
101
  end
104
102
 
105
103
  protected
106
104
 
107
- # @quirk caTissue Overrides the CaRuby::Resource method to handle caTissue Bug #67 -
108
- # SpecimenRequirement activityStatus cannot be set.
105
+ # @quirk caTissue Overrides the CaRuby::Resource method to handle caTissue Bug #67 - SpecimenRequirement activityStatus cannot be set.
109
106
  #
110
107
  # @return [<Symbol>] the required attributes which are nil for this domain object
111
108
  def missing_mandatory_attributes
@@ -119,12 +116,12 @@ module CaTissue
119
116
 
120
117
  private
121
118
 
122
- # @return [Boolean] whether this SpecimenRequirement has multiple non-aliquot derivatives
119
+ # Returns whether this SpecimenRequirement has multiple non-aliquot derivatives.
123
120
  def multiple_derivatives?
124
121
  children.size > 1 and children.any? { |drv| not drv.aliquot? }
125
122
  end
126
123
 
127
- # Augments +CaRuby::Resource.validate+ to verify that this SpecimenRequirement does not have multiple non-aliquot
124
+ # Augments {CaRuby::Resource#validate} to verify that this SpecimenRequirement does not have multiple non-aliquot
128
125
  # derivatives, which is disallowed by caTissue.
129
126
  #
130
127
  # @quirk caTissue multiple SpecimenRequirement non-aliquot derivatives is accepted by caTissue but results