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
@@ -6,12 +6,11 @@ require 'caruby/util/visitor'
6
6
  require 'catissue/resource'
7
7
  require 'catissue/database'
8
8
  require 'catissue/util/controlled_value'
9
- require 'caruby/util/transitive_closure'
10
9
  require 'caruby/domain/properties'
11
10
 
12
11
  module CaTissue
13
12
  # This ControlledValues class loads caTissue permissible values from the database.
14
- # Use of this class requires the +dbi+ gem. See +CaRuby::SQLExecutor.initialize+
13
+ # Use of this class requires the +dbi+ gem. See {CaRuby::SQLExecutor#initialize}
15
14
  # for a description of the database access properties.
16
15
  class ControlledValues
17
16
  include Singleton
@@ -31,7 +30,7 @@ module CaTissue
31
30
  # * :tissue_site
32
31
  # * :clinical_diagnosis
33
32
  #
34
- # @param [String,Symbol] public_id_or_alias the caTissue public id or an alias defined above
33
+ #@param [String,Symbol] public_id_or_alias the caTissue public id or an alias defined above
35
34
  # @return [<ControlledValue>] instances for the given public_id_or_alias
36
35
  def for_public_id(public_id_or_alias)
37
36
  pid = ControlledValue.standard_public_id(public_id_or_alias)
@@ -7,20 +7,20 @@ require 'catissue/database/annotation/annotator'
7
7
  require 'catissue/util/collectible_event_parameters'
8
8
 
9
9
  module CaTissue
10
- # A CaTissue: Database mediates access to the caTissue database.
11
- # The superclass +CaRuby::Database+ functionality is preserved and not expanded, but this CaTissue
12
- # Database implementation overrides several base class private methods to enable alternate
13
- # caTissue-specific search strategies and work-arounds.
10
+ # Database mediates access to the caTissue application server.
11
+ # Superclass +CaRuby::Database+ functionality base class methods are overridden as necessary
12
+ # to enable caTissue-specific work-arounds and alternate search strategies.
13
+ # A CaTissue::Database mediates access to the caTissue database.
14
+ # The CaRuby::Database functionality is preserved and not expanded, but this CaTissue::Database overrides
15
+ # several base class private methods to enable alternate CaTissue-specific search strategies and work
16
+ # around caTissue and caCORE bugs.
14
17
  class Database < CaRuby::Database
15
18
  include Singleton
16
19
 
17
- # @return [CaRuby::SQLExecutor] a utility SQL executor
18
- attr_reader :executor
19
-
20
- # @return [{Symbol => Object}] the server access properties
21
- attr_reader :access_properties
20
+ # return [CaRuby::SQLExecutor] a utility SQL executor
21
+ attr_reader :executor, :access_properties
22
22
 
23
- # Creates a new Database with the +catissuecore+ service.
23
+ # Creates a new Database with the +catissuecore+ service and {CaTissue.access_properties}.
24
24
  def initialize
25
25
  @access_properties = CaTissue.access_properties
26
26
  super(SVC_NAME, @access_properties)
@@ -32,7 +32,7 @@ module CaTissue
32
32
  @annotator ||= Annotator.new(self)
33
33
  end
34
34
 
35
- # If the given domain object is an {Annotation}, then this method returns the {Annotation::AnnotationService}
35
+ # If the given domain object is an {Annotation}, then this method returns the {AnnotationService}
36
36
  # for the object {AnnotationModule}, otherwise this method returns the standard {CaTissue::Database}
37
37
  # service.
38
38
  #
@@ -42,7 +42,7 @@ module CaTissue
42
42
  klass < Annotation ? klass.annotation_module.persistence_service : super
43
43
  end
44
44
 
45
- # Augments +CaRuby::Database.ensure_exists+ to ensure that an {Annotation::Proxy} reference identifier
45
+ # Augments {CaRuby::Database#ensure_exists} to ensure that an {Annotation::Proxy} reference identifier
46
46
  # reflects the hook identifier.
47
47
  #
48
48
  # @param (see CaRuby::Database::Writer#ensure_exists)
@@ -55,14 +55,14 @@ module CaTissue
55
55
 
56
56
  private
57
57
 
58
- # The application service name
58
+ # The application service name.
59
59
  SVC_NAME = 'catissuecore'
60
60
 
61
61
  UPD_EID_SQL = 'update catissue_external_identifier set name = ?, value = ?, specimen_id = ? where identifier = ?'
62
62
 
63
63
  UPD_CTR_SQL = 'update catissue_consent_tier_response set response = ? where identifier = ?'
64
64
 
65
- # Overrides #+CaRuby::Database::Writer.recursive_save?+ to support the update work-around
65
+ # Overrides #{CaRuby::Database::Writer#recursive_save?} to support the update work-around
66
66
  # described in {#update_object}. A recursive SCG update is allowed if the nested
67
67
  # transaction sequence is:
68
68
  # * Update SCG
@@ -195,7 +195,7 @@ module CaTissue
195
195
  penultimate and penultimate.subject == obj
196
196
  end
197
197
 
198
- # Augments +CaRuby::Database.save_with_template+ to work around the following caTissue anomalies:
198
+ # Augments {CaRuby::Database#save_with_template} to work around the following caTissue anomalies:
199
199
  #
200
200
  # @quirk caTissue Bug #149: API update TissueSpecimen position validation incorrect.
201
201
  # The Specimen update argument must reference the old position, even though the position is not
@@ -206,21 +206,21 @@ module CaTissue
206
206
  # position in the caTissue service update argument. A Specimen position is altered as a side-effect
207
207
  # by creating a proxy save {CaTissue::TransferEventParameters}. The changed position is not reflected
208
208
  # in the Specimen position, which must be refetched to reflect the database state. This fetch is
209
- # done automatically by +CaRuby::Database+ as part of the save proxy mechanism. The Specimen update
209
+ # done automatically by {CaRuby::Database} as part of the save proxy mechanism. The Specimen update
210
210
  # template must include a reference to the former position but not the changed position.
211
211
  #
212
- # However, the Specimen +CaRuby::Writer.update+ argument will include the changed position, not the
213
- # former position. The template built +CaRuby::Writer.update+ for submission to the caTissue app
212
+ # However, the Specimen {CaRuby::Writer#update} argument will include the changed position, not the
213
+ # former position. The template built {CaRuby::Writer#update} for submission to the caTissue app
214
214
  # does not include a position reference, since the position has a save proxy which handles position
215
- # change as part of the +CaRuby::Writer+ update dependent propagation.
215
+ # change as part of the {CaRuby::Writer} update dependent propagation.
216
216
  #
217
217
  # Thus, updating a Specimen which includes a position change is performed as follows:
218
218
  # * reconstitute the former position from the Position snapshot taken as part of the
219
- # +CaRuby::Persistable+ change tracker.
220
- # * add the former position to the template (which will now differ from the +CaRuby::Writer.update+
219
+ # {CaRuby::Persistable} change tracker.
220
+ # * add the former position to the template (which will now differ from the {CaRuby::Writer#update}
221
221
  # argument).
222
222
  # * submit the adjusted Specimen template to the caTissue app updateObject.
223
- # * +CaRuby::Writer.update+ will propagate the Specimen update to the changed position dependent,
223
+ # * {CaRuby::Writer#update} will propagate the Specimen update to the changed position dependent,
224
224
  # which in turn saves via the {CaTissue::TransferEventParameters} proxy.
225
225
  # * The proxy save will in turn refetch the proxied Specimen position to obtain the identifier
226
226
  # and merge this into the Specimen position.
@@ -294,7 +294,7 @@ module CaTissue
294
294
  logger.debug { "caTissue #{ctr} update work-around completed." }
295
295
  end
296
296
 
297
- # Overrides +CaRuby::Database::Writer.save_changed_dependents+ to handle the following anomalies:
297
+ # Overrides {CaRuby::Database::Writer#save_changed_dependents} to handle the following anomalies:
298
298
  # * create Specimen disposal event last, as described in {#save_changed_specimen_dependents}
299
299
  #
300
300
  # @param (see CaRuby::Writer#save_dependents)
@@ -305,7 +305,7 @@ module CaTissue
305
305
  end
306
306
  end
307
307
 
308
- # Overrides +CaRuby::Database::Writer.save_changed_dependents+ on a Specimen to correct the
308
+ # Overrides {CaRuby::Database::Writer#save_changed_dependents} on a Specimen to correct the
309
309
  # following problem:
310
310
  #
311
311
  # @quirk caTissue DisposalEventParameters must be created after all other Specimen SEPs.
@@ -324,7 +324,7 @@ module CaTissue
324
324
  # for the subtle interaction required between these two work-arounds.
325
325
  #
326
326
  # @param [CaTissue::Specimen] the specimen whose dependents are to be saved
327
- # @yield [dependent] calls the base +CaRuby::Writer.save_changed_dependents+
327
+ # @yield [dependent] calls the base {CaRuby::Writer#save_changed_dependents}
328
328
  # @yieldparam [Resource] dependent the dependent to save
329
329
  def save_changed_specimen_dependents(specimen)
330
330
  dsp = specimen.specimen_events.detect { |ep| CaTissue::DisposalEventParameters === ep }
@@ -346,7 +346,7 @@ module CaTissue
346
346
  end
347
347
  end
348
348
 
349
- # Overrides +CaRuby::Database.build_save_template+ to return obj itself if
349
+ # Overrides {CaRuby::Database#build_save_template} to return obj itself if
350
350
  # obj is an {Annotation}, since annotations do not employ a separate template.
351
351
  #
352
352
  # @param (see CaRuby::Database#build_save_template)
@@ -372,7 +372,7 @@ module CaTissue
372
372
  annotation
373
373
  end
374
374
 
375
- # Overrides +CaRuby::Database::Writer.save_with_template+ to work around caTissue bugs.
375
+ # Overrides {CaRuby::Database::Writer#save_with_template} to work around caTissue bugs.
376
376
  # @quirk caTissue Bug #63: a SpecimenCollectionGroup update requires the referenced CollectionProtocolRegistration
377
377
  # with an identifier to hold extraneous CollectionProtocolRegistration content, including the CPR
378
378
  # collection protocol and PPI.
@@ -482,7 +482,7 @@ module CaTissue
482
482
  template.send(wtr, pxy)
483
483
  end
484
484
 
485
- # Augment +CaRuby::Database::Writer.create_object+ to work around caTissue bugs.
485
+ # Augment {CaRuby::Database::Writer#create_object} to work around caTissue bugs.
486
486
  # @quirk caTissue Bug #124: SCG SpecimenEventParameters save fails validation.
487
487
  # Work-around is to create the SEP by updating the SCG.
488
488
  # @quirk If obj is a CaTissue::Specimen with the is_available flag set to false, then work around the bug
@@ -517,7 +517,7 @@ module CaTissue
517
517
  obj
518
518
  end
519
519
 
520
- # Overrides +CaRuby::Database.create_from_template+ as follows:
520
+ # Overrides {CaRuby::Database#create_from_template} as follows:
521
521
  # * Surrogate {Annotation::Proxy} is "created" by setting the identifier to its hook owner.
522
522
  # The create operation then creates referenced uncreated dependents.
523
523
  #
@@ -552,7 +552,7 @@ module CaTissue
552
552
  # to a non-zero value, create the Specimen and then update the created Specimen with
553
553
  # the original values.
554
554
  #
555
- # If spc has a disposal event, then this work-around interacts with the {#save_dependents}
555
+ # If spc has a disposal event, then this work-around interacts with the {#save_changed_dependents}
556
556
  # work-around as follows:
557
557
  # * delete that event from the Specimen.
558
558
  # * Create the Specimen as described above.
@@ -599,7 +599,7 @@ module CaTissue
599
599
  specimen
600
600
  end
601
601
 
602
- # Overrides +CaRuby::Database::Reader.fetch_object+ to circumvent {Annotation} fetch, since an annotation
602
+ # Overrides {CaRuby::Database::Reader#fetch_object} to circumvent {Annotation} fetch, since an annotation
603
603
  # does not have a key.
604
604
  def fetch_object(obj)
605
605
  super or fetch_alternative(obj)
@@ -611,8 +611,37 @@ module CaTissue
611
611
  when CaTissue::Participant then fetch_participant_alternative(obj)
612
612
  end
613
613
  end
614
+
615
+ # @quirk JRuby fetching a CPR CP swizzles the CPR participant. This only occurs when the CP exists in
616
+ # the database. The work-around is to reset the swizzled participant. However, merely capturing the
617
+ # participant before the CP find is sufficient to prevent this bug. JRuby does not corrupt the CPR
618
+ # participant if it is referenced by a local variable. The CPR is too complicated to reformulate as
619
+ # this bug as an isolated non-caTissue test case.
620
+ def finder_parameter(obj, attribute)
621
+ if CaTissue::CollectionProtocolRegistration === obj and attribute == :collection_protocol then
622
+ # Simply assigning the pnt variable prevents the bug from occurring.
623
+ pnt = obj.participant
624
+ end
625
+ value = super
626
+ if value and pnt and pnt != obj.participant then
627
+ swzld = obj.participant
628
+ obj.participant = pnt
629
+ logger.debug { "Worked around #{obj} corruption by restoring the swizzled participant from #{swzld} to the original #{pnt}." }
630
+ end
631
+ value
632
+ end
633
+
634
+ # Augments the +CaRuby::Writer+ exclusion filter to exclude annotations from the create template.
635
+ # Annotations are created following the owner create.
636
+ #
637
+ # @param obj (see #create_object)
638
+ # @param [Attribute] attr_md the candidate attribute metadata
639
+ # @return [Boolean] whether the attribute should not be included in the create template
640
+ def exclude_pending_create_attribute?(obj, attr_md)
641
+ attr_md.type < Annotation or super
642
+ end
614
643
 
615
- # Override +CaRuby::Database.query_safe+ to work around the following +caTissue+ bugs:
644
+ # Override {CaRuby::Database#query_safe} to work around the following +caTissue+ bugs:
616
645
  # * @quirk caTissue Specimen auto-generates blank ExternalIdentifier.
617
646
  # cf. https://cabig-kc.nci.nih.gov/Biospecimen/forums/viewtopic.php?f=19&t=436&sid=ef98f502fc0ab242781b7759a0eaff36
618
647
  # * @quirk caTissue Specimen auto-generates blank PMI.
@@ -662,7 +691,7 @@ module CaTissue
662
691
  attr_md.declarer < Annotatable and attr_md.type < Annotation::Proxy
663
692
  end
664
693
 
665
- # Queries on the given object attribute using the {Annotation::IntegationService}.
694
+ # Queries on the given object attribute using the {Annotation::IntegrationService}.
666
695
  #
667
696
  # @param [Annotatable] hook the annotated domain object
668
697
  # @param [Symbol] attribute the proxy attribute
@@ -679,7 +708,7 @@ module CaTissue
679
708
  proxies
680
709
  end
681
710
 
682
- # Queries on the given proxy using the {Annotation::IntegationService}.
711
+ # Queries on the given proxy using the {Annotation::IntegrationService}.
683
712
  #
684
713
  # @param [Annotation::Proxy] proxy the proxy object
685
714
  # @param hook (see #query_hook_proxies)
@@ -693,7 +722,7 @@ module CaTissue
693
722
  annotator.integrator.find(proxy)
694
723
  end
695
724
 
696
- # @quirk caCORE Override +CaRuby::Database::Reader.invertible_query?+ to enable the Bug #147 work
725
+ # @quirk caCORE Override {CaRuby::Database::Reader#invertible_query?} to enable the Bug #147 work
697
726
  # around in {#query_object}. Invertible queries are performed to work around Bug #79. However, this
698
727
  # work-around induces Bug #147, so we disable the Bug #79 work-around here for the special case of
699
728
  # a CPE in order to enable the Bug #147 work-around. And so it goes....
@@ -5,25 +5,6 @@ require 'caruby/util/validation'
5
5
  module CaTissue
6
6
  resource_import Java::edu.wustl.catissuecore.domain.AbstractSpecimen
7
7
 
8
- # @quirk caTissue initial_quantity must be set (cf. Bug #160).
9
- #
10
- # @quirk caTissue Specimen characteristics are auto-generated but SpecimenRequirement
11
- # characteristics are not. It is safe to set the :autogenerated flag for both
12
- # AbstractSpecimen subclasses. This results in an unnecessary SpecimenRequirement
13
- # create database query, but SpecimenRequirement create is rare and there is no harm.
14
- #
15
- # @quirk caTissue Specimen characteristics is cascaded but is not an exclusive dependent,
16
- # since it is shared by aliquots.
17
- #
18
- # @quirk caTissue Bug 166: API update Specimen ignores a SpecimenCharacteristics with a
19
- # different id. Guard against updating a Specimen with a SpecimenCharacteristics whose id
20
- # differs from the existing id.
21
- #
22
- # @quirk caTissue Unlike other dependents, AbstractSpecimen characteristics, events and child
23
- # specimens have cascade style 'all'. This implies that an AbstractSpecimen update does not
24
- # create a referenced dependent. AbstractSpecimen create cascades to create and AbstractSpecimen
25
- # update cascades to update, but AbstractSpecimen update does not cascade to create.
26
- # The :no_cascade_update_to_create flag is set to handle this feature of cascade style 'all'.
27
8
  class AbstractSpecimen
28
9
  # Sets the specimen type to the specified value. The value can be a permissible caTissue String value or
29
10
  # the shortcut symbols :fresh, :fixed and :frozen.
@@ -41,10 +22,28 @@ module CaTissue
41
22
  :event_parameters => :specimen_events,
42
23
  :characteristics => :specimen_characteristics)
43
24
 
25
+ # @quirk caTissue initial_quantity must be set (cf. Bug #160)
44
26
  add_attribute_defaults(:initial_quantity => 0.0, :pathological_status => 'Not Specified', :specimen_type => 'Not Specified')
45
27
 
46
28
  add_mandatory_attributes(:lineage, :pathological_status, :specimen_class, :specimen_type, :specimen_characteristics)
47
29
 
30
+ # @quirk caTissue Specimen characteristics are auto-generated but SpecimenRequirement
31
+ # characteristics are not. It is safe to set the :autogenerated flag for both
32
+ # AbstractSpecimen subclasses. This results in an unnecessary SpecimenRequirement
33
+ # create database query, but SpecimenRequirement create is rare and there is no harm.
34
+ #
35
+ # @quirk caTissue Specimen characteristics is cascaded but is not an exclusive dependent,
36
+ # since it is shared by aliquots.
37
+ #
38
+ # @quirk caTissue Bug 166: API update Specimen ignores a SpecimenCharacteristics with a
39
+ # different id. Guard against updating a Specimen with a SpecimenCharacteristics whose id
40
+ # differs from the existing id.
41
+ #
42
+ # @quirk caTissue Unlike other dependents, AbstractSpecimen characteristics, events and child
43
+ # specimens have cascade style 'all'. This implies that an AbstractSpecimen update does not
44
+ # create a referenced dependent. AbstractSpecimen create cascades to create and AbstractSpecimen
45
+ # update cascades to update, but AbstractSpecimen update does not cascade to create.
46
+ # The :no_cascade_update_to_create flag is set to handle this feature of cascade style 'all'.
48
47
  qualify_attribute(:specimen_characteristics, :cascaded, :fetched, :autogenerated, :no_cascade_update_to_create)
49
48
 
50
49
  # The :no_cascade_update_to_create flag is set since events has cascade style 'all'.
@@ -120,11 +119,11 @@ module CaTissue
120
119
  SpecimenClass::UNIT_HASH[self.specimen_class]
121
120
  end
122
121
 
123
- # Derives a specimen from this specimen. The parameters are described in {Specimen.create_specimen},
124
- # with one addition: a +:count+ option which specifies the number of specimens to derive.
122
+ # Derives a specimen from this specimen. The params are described in {Specimen#create_specimen},
123
+ # with one addition: an optional :count, the optional number of specimens to derive.
125
124
  #
126
- # If the +:count+ option is greater than one and the +:specimen_class+,
127
- # +:specimen_type+ and +:specimen_characteristics+ parameters are not set to values
125
+ # If the :count parameter is greater than one and the :specimen_class,
126
+ # :specimen_type and :specimen_characteristics parameters are not set to values
128
127
  # which differ from the respective values for this Specimen, then the specimen is
129
128
  # aliquoted, otherwise the derived specimens are created independently, e.g.:
130
129
  # spc = Specimen.create_specimen(:specimen_class => :tissue, :specimen_type => :frozen)
@@ -147,7 +146,6 @@ module CaTissue
147
146
  # label and _n_ is this specimen's child count after including the new derived specimen,
148
147
  # e.g. 3090_3 for the third child in parent specimen with label 3090.
149
148
  #
150
- # @param (see Specimen.create_specimen)
151
149
  # @return the new derived specimen if _count_ is one, otherwise an Array of _count_ derived specimens
152
150
  # @raise [ValidationError] if an aliquoted parent available quantity is not greater than zero
153
151
  # or the derived specimen quantities exceed the parent available quantity
@@ -182,7 +180,7 @@ module CaTissue
182
180
  end
183
181
 
184
182
  # Returns whether this AbstractSpecimen is minimally consistent with the other specimen.
185
- # This method augments the +CaRuby::Resource.minimal_match?+ with an additional restriction
183
+ # This method augments the {CaRuby::Resource#minimal_match?} with an additional restriction
186
184
  # that the other specimen is the same type as this specimen and
187
185
  # is a tolerant match on specimen class, specimen type and pathological status.
188
186
  # A _tolerant_ match condition holds if the other attribute value is equal to this
@@ -208,7 +206,7 @@ module CaTissue
208
206
  # @param [Integer] count the number of aliquots
209
207
  def set_aliquot_parameters(params, count); end
210
208
 
211
- # Overrides +CaRuby::Resource.each_defaults_dependent+ to visit the {SpecimenCharacteristics}.
209
+ # Overrides {CaRuby::Resource#each_defaults_dependent} to visit the {CaTissue::SpecimenCharacteristics}.
212
210
  # The characteristics are not dependent since they can be shared among aliquots.
213
211
  # However, the defaults should be added to them. Do so here.
214
212
  #
@@ -8,7 +8,7 @@ module CaTissue
8
8
 
9
9
  add_mandatory_attributes(:activity_status)
10
10
 
11
- # Overrides +CaRuby::Resource.each_dependent+ to exclude Specimens or SpecimenRequirements with a parent,
11
+ # Overrides {CaRuby::Resource#each_dependent} to exclude Specimens or SpecimenRequirements with a parent,
12
12
  # since parent is the immediate Specimen or SpecimenRequirement owner.
13
13
  #
14
14
  # @yield (see CaRuby::Resource#each_dependent)
@@ -24,7 +24,7 @@ module CaTissue
24
24
 
25
25
  add_mandatory_attributes(:one_dimension_capacity, :two_dimension_capacity)
26
26
 
27
- # @return [CaRuby::Coordinate] the read-only coordinate with this capacity's rows and columns
27
+ # Returns the read-only Coordinate with this Capacity's #rows and {#columns}.
28
28
  def bounds
29
29
  @bounds ||= Coordinate.new(columns, rows)
30
30
  end
@@ -1,6 +1,5 @@
1
1
  require 'date'
2
2
  require 'catissue/domain/hash_code'
3
- require 'catissue/util/collectible'
4
3
 
5
4
  module CaTissue
6
5
  # import the Java class
@@ -10,10 +9,6 @@ module CaTissue
10
9
  #
11
10
  # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
12
11
  # Create CollectionProtocol in API ignores startDate.
13
- # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
14
- # Create CollectionProtocol in API ignores startDate.
15
- # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
16
- # Create CollectionProtocol in API ignores startDate.
17
12
  class CollectionProtocol
18
13
  include HashCode
19
14
 
@@ -35,16 +30,24 @@ module CaTissue
35
30
 
36
31
  add_dependent_attribute(:consent_tiers)
37
32
 
33
+ # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
34
+ # Create CollectionProtocol in API ignores startDate.
38
35
  qualify_attribute(:start_date, :update_only)
39
36
 
37
+ # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
38
+ # Create CollectionProtocol in API ignores startDate.
40
39
  set_attribute_type(:coordinators, CaTissue::User)
41
40
 
41
+ # @quirk caTissue Augment the standard metadata storable reference attributes to work around caTissue Bug #150:
42
+ # Create CollectionProtocol in API ignores startDate.
42
43
  qualify_attribute(:coordinators, :fetched)
43
44
 
45
+ # @quirk caTissue Bug #64 - consent tiers collection property is not initialized to an empty set in the Java constructor.
46
+ # Initialize it to a +LinkedHashSet+ in caRuby.
44
47
  def initialize
45
48
  super
49
+ # @quirk JRuby consent_tiers property method is not accessible until respond_to? is called.
46
50
  respond_to?(:consent_tiers)
47
- # work around caTissue Bug #64 - consent tiers is nil rather than an empty set
48
51
  self.consent_tiers ||= Java::JavaUtil::LinkedHashSet.new
49
52
  end
50
53
 
@@ -80,7 +83,7 @@ module CaTissue
80
83
  # Adds specimens to this protocol. The following parameter options are supported:
81
84
  # * :participant - the Participant from whom the specimen is collected
82
85
  # * :biospecimens - the collected top-level underived specimens
83
- # * additional SCG parameters as described in {Collectible#merge_attributes}.
86
+ # * additional SCG parameters as described in {SpecimenCollectionGroup#merge}.
84
87
  #
85
88
  # If the options does not include a +:collection_protocol_event+, then the SCG is assigned
86
89
  # to the first collection event in this protocol.
@@ -89,8 +92,8 @@ module CaTissue
89
92
  # if that can be uniquely determined.
90
93
  #
91
94
  # This add_specimens method adds the following parameter options before calling the
92
- # {SpecimenCollectionGroup} constructor:
93
- # * :registration => a new {CollectionProtocolRegistration} for this protocol
95
+ # {CaTissue::SpecimenCollectionGroup} constructor:
96
+ # * :registration => a new {CaTissue::CollectionProtocolRegistration} for this protocol
94
97
  # and the specified participant
95
98
  #
96
99
  # @param [(<Specimen>, {Symbol => Object})] specimens_and_params the specimens to add followed
@@ -6,14 +6,15 @@ module CaTissue
6
6
  resource_import Java::edu.wustl.catissuecore.domain.CollectionProtocolEvent
7
7
 
8
8
  # The CollectionProtocolRegistration domain class.
9
- #
10
- # @quirk caTissue specimen_requirements is a cascaded dependent, but it is not fetched.
11
- # CollectionProtocol create cascades through each dependent CPE to each SpecimenRequirement.
12
9
  class CollectionProtocolEvent
13
10
  include HashCode
14
11
 
15
12
  # @quirk caTissue Bug #64: Some domain collection properties not initialized.
16
13
  # Initialize specimen_collection_groups if necessary.
14
+ # @quirk caTissue The +specimen_collection_groups+ is unnecessary and expensive to maintain inverse integrity.
15
+ # The SCG event attribute is required, but adding the SCG to the event SCG inverse attribute value requires
16
+ # loading all of the SCGs. +specimen_collection_groups+ is not used in practice. The event SCGs can be
17
+ # easily obtained by a query.
17
18
  #
18
19
  # @return [Java::JavaUtil::Set] the SCGs
19
20
  def specimen_collection_groups
@@ -36,24 +37,21 @@ module CaTissue
36
37
 
37
38
  add_mandatory_attributes(:collection_protocol, :clinical_diagnosis, :specimen_requirements)
38
39
 
40
+ # @quirk caTissue specimen_requirements is a cascaded dependent, but it is not fetched.
41
+ # CollectionProtocol create cascades through each dependent CPE to each SpecimenRequirement.
39
42
  add_dependent_attribute(:specimen_requirements, :unfetched)
40
43
 
44
+ remove_attribute(:specimen_collection_groups)
45
+
41
46
  # The event point used for saving this CollectionProtocolEvent if none other is set.
42
47
  DEFAULT_EVENT_POINT = 1.0
43
48
 
44
- def initialize
45
- super
46
- respond_to?(:specimen_collection_groups)
47
- # work around caTissue Bug #64
48
- self.specimen_collection_groups ||= Java::JavaUtil::LinkedHashSet.new
49
- end
50
-
51
49
  # Removes associations to this registration
52
50
  def delete
53
51
  protocol.events.delete(self) if protocol
54
52
  end
55
53
 
56
- # Overrides +CaRuby::Resource.references+ in the case of the _specimen_requirements_ attribute to select
54
+ # Overrides {CaRuby::Resource#references} in the case of the _specimen_requirements_ attribute to select
57
55
  # only top-level SpecimenRequirements not derived from another SpecimenRequirement.
58
56
  def direct_dependents(attribute)
59
57
  if attribute == :specimen_requirements then