caruby-tissue 1.5.6 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +17 -0
- data/History.md +5 -1
- data/README.md +2 -2
- data/bin/crtdump +2 -8
- data/bin/crtexample +2 -5
- data/bin/crtmigrate +3 -6
- data/bin/crtsmoke +3 -8
- data/conf/wustl/{log4j.properties → linux/log4j.properties} +3 -3
- data/conf/wustl/windows/log4j.properties +40 -0
- data/examples/galena/Gemfile +16 -0
- data/examples/galena/Gemfile.lock +88 -0
- data/examples/galena/README.md +16 -16
- data/examples/galena/Rakefile +30 -0
- data/examples/galena/bin/seed +5 -11
- data/examples/galena/conf/annotation/defaults.yaml +2 -0
- data/examples/galena/conf/{migration/annotation_fields.yaml → annotation/fields.yaml} +2 -4
- data/examples/galena/conf/defaults.yaml +9 -0
- data/examples/galena/conf/{migration/filter_fields.yaml → filter/fields.yaml} +0 -1
- data/examples/galena/conf/filter/values.yaml +8 -0
- data/examples/galena/conf/{migration/frozen_defaults.yaml → frozen/defaults.yaml} +0 -0
- data/examples/galena/conf/{migration/frozen_fields.yaml → frozen/fields.yaml} +0 -2
- data/examples/galena/conf/{migration/general_fields.yaml → general/fields.yaml} +0 -24
- data/examples/galena/conf/registration/fields.yaml +6 -0
- data/examples/galena/conf/{migration/simple_fields.yaml → simple/fields.yaml} +1 -6
- data/examples/galena/data/annotation.csv +1 -1
- data/examples/galena/data/filter.csv +1 -1
- data/examples/galena/data/frozen.csv +1 -1
- data/examples/galena/data/general.csv +1 -1
- data/examples/galena/data/registration.csv +1 -1
- data/examples/galena/data/simple.csv +1 -1
- data/examples/galena/galena.gemspec +24 -0
- data/examples/galena/lib/galena/filter.rb +25 -0
- data/examples/galena/lib/galena/{tissue/migration/frozen_shims.rb → frozen.rb} +6 -10
- data/examples/galena/lib/galena/seed.rb +126 -0
- data/examples/galena/lib/galena/version.rb +3 -0
- data/examples/galena/lib/galena.rb +18 -7
- data/examples/galena/log/galena.log +37351 -0
- data/examples/galena/log/galena.log.0 +147830 -0
- data/examples/galena/spec/annotation_spec.rb +46 -0
- data/examples/galena/spec/filter_spec.rb +94 -0
- data/examples/galena/spec/frozen_spec.rb +39 -0
- data/examples/galena/spec/general_spec.rb +62 -0
- data/examples/galena/spec/registration_spec.rb +37 -0
- data/examples/galena/spec/seed.rb +107 -0
- data/examples/galena/spec/simple_spec.rb +58 -0
- data/examples/galena/spec/spec_helper.rb +11 -0
- data/examples/galena/spec/support/migration.rb +70 -0
- data/lib/catissue/annotation/annotatable.rb +10 -8
- data/lib/catissue/annotation/annotation.rb +7 -7
- data/lib/catissue/annotation/de_integration.rb +9 -20
- data/lib/catissue/annotation/importer.rb +148 -0
- data/lib/catissue/annotation/introspector.rb +32 -0
- data/lib/catissue/annotation/metadata.rb +422 -0
- data/lib/catissue/annotation/proxy.rb +2 -2
- data/lib/catissue/annotation/proxy_class.rb +45 -30
- data/lib/catissue/annotation/record_entry_proxy.rb +2 -2
- data/lib/catissue/cli/command.rb +14 -24
- data/lib/catissue/cli/example.rb +5 -3
- data/lib/catissue/cli/migrate.rb +45 -37
- data/lib/catissue/cli/smoke.rb +2 -3
- data/lib/catissue/database/annotation/annotation_service.rb +8 -17
- data/lib/catissue/database/annotation/entity_facade.rb +33 -30
- data/lib/catissue/database/annotation/id_generator.rb +1 -1
- data/lib/catissue/database/annotation/integration_service.rb +11 -4
- data/lib/catissue/database/annotation/reference_writer.rb +38 -38
- data/lib/catissue/database/controlled_value_finder.rb +13 -28
- data/lib/catissue/database/controlled_values.rb +73 -45
- data/lib/catissue/database.rb +637 -277
- data/lib/catissue/domain/abstract_domain_object.rb +5 -0
- data/lib/catissue/domain/abstract_position.rb +3 -5
- data/lib/catissue/domain/abstract_specimen.rb +79 -65
- data/lib/catissue/domain/abstract_specimen_collection_group.rb +3 -6
- data/lib/catissue/domain/address.rb +0 -2
- data/lib/catissue/domain/cancer_research_group.rb +0 -3
- data/lib/catissue/domain/capacity.rb +2 -4
- data/lib/catissue/domain/check_in_check_out_event_parameter.rb +0 -3
- data/lib/catissue/domain/collection_event_parameters.rb +2 -7
- data/lib/catissue/domain/collection_protocol.rb +11 -16
- data/lib/catissue/domain/collection_protocol_event.rb +19 -12
- data/lib/catissue/domain/collection_protocol_registration.rb +8 -12
- data/lib/catissue/domain/consent_tier_response.rb +0 -4
- data/lib/catissue/domain/consent_tier_status.rb +1 -4
- data/lib/catissue/domain/container.rb +10 -10
- data/lib/catissue/domain/container_position.rb +4 -7
- data/lib/catissue/domain/container_type.rb +4 -7
- data/lib/catissue/domain/department.rb +0 -3
- data/lib/catissue/domain/disposal_event_parameters.rb +5 -5
- data/lib/catissue/domain/embedded_event_parameters.rb +1 -4
- data/lib/catissue/domain/external_identifier.rb +0 -12
- data/lib/catissue/domain/frozen_event_parameters.rb +1 -4
- data/lib/catissue/domain/institution.rb +0 -3
- data/lib/catissue/domain/new_specimen_array_order_item.rb +0 -5
- data/lib/catissue/domain/order_details.rb +0 -2
- data/lib/catissue/domain/participant/clinical/chemotherapy.rb +1 -3
- data/lib/catissue/domain/participant/clinical/duration.rb +2 -4
- data/lib/catissue/domain/participant/clinical/radiation_therapy.rb +2 -4
- data/lib/catissue/domain/participant.rb +22 -24
- data/lib/catissue/domain/participant_medical_identifier.rb +0 -4
- data/lib/catissue/domain/password.rb +0 -4
- data/lib/catissue/domain/race.rb +0 -3
- data/lib/catissue/domain/received_event_parameters.rb +3 -6
- data/lib/catissue/domain/site.rb +1 -4
- data/lib/catissue/domain/specimen/pathology/additional_finding.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/details.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/gleason_score.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/histologic_grade.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/histologic_type.rb +19 -0
- data/lib/catissue/domain/specimen/pathology/histologic_variant_type.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/invasion.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/prostate_specimen_gleason_score.rb +5 -11
- data/lib/catissue/domain/specimen/pathology/prostate_specimen_pathology_annotation.rb +12 -12
- data/lib/catissue/domain/specimen/pathology/specimen_additional_finding.rb +5 -14
- data/lib/catissue/domain/specimen/pathology/specimen_base_solid_tissue_pathology_annotation.rb +6 -21
- data/lib/catissue/domain/specimen/pathology/specimen_details.rb +4 -10
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_grade.rb +4 -10
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_type.rb +6 -14
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_variant_type.rb +5 -11
- data/lib/catissue/domain/specimen/pathology/specimen_invasion.rb +5 -11
- data/lib/catissue/domain/specimen.rb +113 -76
- data/lib/catissue/domain/specimen_array.rb +0 -3
- data/lib/catissue/domain/specimen_array_content.rb +1 -4
- data/lib/catissue/domain/specimen_array_type.rb +1 -4
- data/lib/catissue/domain/specimen_characteristics.rb +0 -3
- data/lib/catissue/domain/specimen_collection_group/pathology/base_pathology_annotation.rb +2 -4
- data/lib/catissue/domain/specimen_collection_group/pathology/base_solid_tissue_pathology_annotation.rb +2 -4
- data/lib/catissue/domain/specimen_collection_group.rb +43 -53
- data/lib/catissue/domain/specimen_event_parameters.rb +24 -32
- data/lib/catissue/domain/specimen_position.rb +8 -5
- data/lib/catissue/domain/specimen_protocol.rb +3 -6
- data/lib/catissue/domain/specimen_requirement.rb +22 -20
- data/lib/catissue/domain/storage_container.rb +9 -12
- data/lib/catissue/domain/storage_type.rb +6 -10
- data/lib/catissue/domain/transfer_event_parameters.rb +3 -6
- data/lib/catissue/domain/user.rb +22 -29
- data/lib/catissue/{util → helpers}/collectible.rb +23 -18
- data/lib/catissue/helpers/collectible_event_parameters.rb +68 -0
- data/lib/catissue/helpers/controlled_value.rb +35 -0
- data/lib/catissue/{domain → helpers}/hash_code.rb +0 -0
- data/lib/catissue/{util → helpers}/location.rb +6 -5
- data/lib/catissue/helpers/log.rb +4 -0
- data/lib/catissue/{util → helpers}/person.rb +1 -1
- data/lib/catissue/{util → helpers}/position.rb +10 -8
- data/lib/catissue/helpers/properties_loader.rb +143 -0
- data/lib/catissue/{util → helpers}/storable.rb +2 -1
- data/lib/catissue/{util → helpers}/storage_type_holder.rb +9 -3
- data/lib/catissue/{annotation/annotatable_class.rb → metadata.rb} +73 -95
- data/lib/catissue/migration/migratable.rb +93 -44
- data/lib/catissue/migration/migrator.rb +26 -42
- data/lib/catissue/migration/shims.rb +1 -1
- data/lib/catissue/migration/unique.rb +76 -0
- data/lib/catissue/resource.rb +16 -20
- data/lib/catissue/version.rb +1 -1
- data/lib/catissue/wustl/logger.rb +52 -32
- data/lib/catissue.rb +38 -20
- data/test/lib/catissue/database/controlled_values_test.rb +22 -27
- data/test/lib/catissue/database/database_test.rb +18 -0
- data/test/lib/catissue/domain/address_test.rb +9 -11
- data/test/lib/catissue/domain/ca_tissue_test_defaults_test.rb +5 -16
- data/test/lib/catissue/domain/capacity_test.rb +2 -2
- data/test/lib/catissue/domain/collection_event_parameters_test.rb +16 -8
- data/test/lib/catissue/domain/collection_protocol_event_test.rb +1 -1
- data/test/lib/catissue/domain/collection_protocol_registration_test.rb +26 -16
- data/test/lib/catissue/domain/collection_protocol_test.rb +2 -2
- data/test/lib/catissue/domain/container_position_test.rb +7 -4
- data/test/lib/catissue/domain/department_test.rb +3 -3
- data/test/lib/catissue/domain/disposal_event_parameters_test.rb +1 -1
- data/test/lib/catissue/domain/external_identifier_test.rb +5 -1
- data/test/lib/catissue/domain/location_test.rb +4 -4
- data/test/lib/catissue/domain/participant_medical_identifier_test.rb +3 -3
- data/test/lib/catissue/domain/participant_test.rb +33 -20
- data/test/lib/catissue/domain/received_event_parameters_test.rb +19 -0
- data/test/lib/catissue/domain/site_test.rb +2 -2
- data/test/lib/catissue/domain/specimen_array_test.rb +3 -3
- data/test/lib/catissue/domain/specimen_array_type_test.rb +6 -6
- data/test/lib/catissue/domain/specimen_characteristics_test.rb +1 -1
- data/test/lib/catissue/domain/specimen_collection_group_test.rb +49 -13
- data/test/lib/catissue/domain/specimen_event_parameters_test.rb +4 -4
- data/test/lib/catissue/domain/specimen_position_test.rb +1 -1
- data/test/lib/catissue/domain/specimen_requirement_test.rb +2 -2
- data/test/lib/catissue/domain/specimen_test.rb +58 -24
- data/test/lib/catissue/domain/storage_container_test.rb +3 -16
- data/test/lib/catissue/domain/storage_type_test.rb +3 -3
- data/test/lib/catissue/domain/transfer_event_parameters_test.rb +17 -17
- data/test/lib/catissue/domain/user_test.rb +32 -34
- data/test/lib/catissue/helpers/properties_loader_test.rb +19 -0
- data/test/lib/catissue/migration/{test_case.rb → helpers/test_case.rb} +30 -20
- data/test/lib/examples/galena/tissue/domain/examples_test.rb +28 -38
- data/test/lib/examples/galena/tissue/helpers/test_case.rb +24 -0
- metadata +175 -99
- data/bin/crtextract +0 -47
- data/examples/galena/conf/extract/simple_fields.yaml +0 -4
- data/examples/galena/conf/migration/annotation_defaults.yaml +0 -2
- data/examples/galena/conf/migration/filter_defaults.yaml +0 -1
- data/examples/galena/conf/migration/filter_values.yaml +0 -13
- data/examples/galena/conf/migration/participant_fields.yaml +0 -4
- data/examples/galena/conf/migration/registration_fields.yaml +0 -5
- data/examples/galena/data/participant.csv +0 -1
- data/examples/galena/lib/galena/tissue/migration/filter_shims.rb +0 -41
- data/examples/galena/lib/galena/tissue/seed/defaults.rb +0 -127
- data/examples/psbin/README.md +0 -45
- data/examples/psbin/conf/adjuvant_hormone_defaults.yaml +0 -2
- data/examples/psbin/conf/adjuvant_radiation_defaults.yaml +0 -3
- data/examples/psbin/conf/biopsy_defaults.yaml +0 -3
- data/examples/psbin/conf/biopsy_fields.yaml +0 -9
- data/examples/psbin/conf/neoadjuvant_hormone_defaults.yaml +0 -2
- data/examples/psbin/conf/neoadjuvant_radiation_defaults.yaml +0 -3
- data/examples/psbin/conf/patient_defaults.yaml +0 -3
- data/examples/psbin/conf/patient_fields.yaml +0 -5
- data/examples/psbin/conf/surgery_defaults.yaml +0 -4
- data/examples/psbin/conf/surgery_fields.yaml +0 -15
- data/examples/psbin/conf/t_stage_defaults.yaml +0 -1
- data/examples/psbin/conf/t_stage_fields.yaml +0 -4
- data/examples/psbin/conf/therapy_fields.yaml +0 -5
- data/examples/psbin/data/adjuvant_hormone.csv +0 -1
- data/examples/psbin/data/adjuvant_radiation.csv +0 -1
- data/examples/psbin/data/biopsy.csv +0 -1
- data/examples/psbin/data/neoadjuvant_hormone.csv +0 -1
- data/examples/psbin/data/neoadjuvant_radiation.csv +0 -1
- data/examples/psbin/data/patient.csv +0 -1
- data/examples/psbin/data/surgery.csv +0 -1
- data/examples/psbin/data/t_stage.csv +0 -1
- data/examples/psbin/lib/psbin/biopsy_shims.rb +0 -15
- data/examples/psbin/lib/psbin/surgery_shims.rb +0 -15
- data/lib/catissue/annotation/annotation_class.rb +0 -406
- data/lib/catissue/annotation/annotation_module.rb +0 -106
- data/lib/catissue/domain.rb +0 -26
- data/lib/catissue/extract/command.rb +0 -31
- data/lib/catissue/extract/delta.rb +0 -58
- data/lib/catissue/extract/extractor.rb +0 -99
- data/lib/catissue/migration/uniquify.rb +0 -2
- data/lib/catissue/util/collectible_event_parameters.rb +0 -71
- data/lib/catissue/util/controlled_value.rb +0 -29
- data/lib/catissue/util/uniquify.rb +0 -86
- data/test/fixtures/catissue/domain/conf/catissue_override.yaml +0 -9
- data/test/fixtures/catissue/extract/conf/scg_extract.yaml +0 -3
- data/test/fixtures/catissue/extract/conf/scg_fields.yaml +0 -3
- data/test/fixtures/catissue/extract/conf/spc_extract.yaml +0 -3
- data/test/fixtures/catissue/extract/conf/spc_fields.yaml +0 -4
- data/test/fixtures/lib/catissue/defaults_test_fixture.rb +0 -206
- data/test/fixtures/lib/examples/galena/migration/alt_key_shims.rb +0 -7
- data/test/lib/catissue/domain/base_haemotology_pathology_test.rb +0 -24
- data/test/lib/catissue/extract/delta_test.rb +0 -25
- data/test/lib/catissue/extract/extractor_test.rb +0 -43
- data/test/lib/catissue/import/importable_module_test.rb +0 -14
- data/test/lib/catissue/test_case.rb +0 -247
- data/test/lib/examples/galena/tissue/migration/annotation_test.rb +0 -29
- data/test/lib/examples/galena/tissue/migration/filter_test.rb +0 -29
- data/test/lib/examples/galena/tissue/migration/frozen_test.rb +0 -36
- data/test/lib/examples/galena/tissue/migration/general_test.rb +0 -56
- data/test/lib/examples/galena/tissue/migration/participant_test.rb +0 -61
- data/test/lib/examples/galena/tissue/migration/registration_test.rb +0 -17
- data/test/lib/examples/galena/tissue/migration/seedify.rb +0 -119
- data/test/lib/examples/galena/tissue/migration/simple_test.rb +0 -30
- data/test/lib/examples/galena/tissue/migration/test_case.rb +0 -72
- data/test/lib/examples/psbin/migration_test.rb +0 -153
@@ -1,12 +1,10 @@
|
|
1
|
-
require 'catissue/
|
1
|
+
require 'catissue/helpers/position'
|
2
2
|
|
3
3
|
module CaTissue
|
4
|
-
resource_import Java::edu.wustl.catissuecore.domain.AbstractPosition
|
5
|
-
|
6
4
|
# The +caTissue+ AbstractPosition class is augmented with a comparison operator and the
|
7
5
|
# zero-based +row+ and +column+ methods wrapping the corresponding one-based dimension
|
8
6
|
# attributes. Each AbstractPosition is required to implement the +holder+ and +occupant+
|
9
|
-
|
7
|
+
# methods.
|
10
8
|
class AbstractPosition
|
11
9
|
include Position
|
12
10
|
|
@@ -19,4 +17,4 @@ module CaTissue
|
|
19
17
|
# add the synthetic {#location} attribute
|
20
18
|
add_attribute(:location, Location)
|
21
19
|
end
|
22
|
-
end
|
20
|
+
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'set'
|
2
|
-
require '
|
3
|
-
require '
|
2
|
+
require 'jinx/helpers/inflector'
|
3
|
+
require 'jinx/helpers/validation'
|
4
4
|
|
5
5
|
module CaTissue
|
6
|
-
resource_import Java::edu.wustl.catissuecore.domain.AbstractSpecimen
|
7
|
-
|
8
6
|
class AbstractSpecimen
|
9
7
|
# Sets the specimen type to the specified value. The value can be a permissible caTissue String value or
|
10
|
-
# the shortcut symbols :fresh, :fixed and
|
8
|
+
# the shortcut symbols :fresh, :fixed and +:frozen+.
|
11
9
|
#
|
12
10
|
# @param [String, Symbol, nil] value the value to set
|
13
11
|
def specimen_type=(value)
|
@@ -28,7 +26,7 @@ module CaTissue
|
|
28
26
|
add_mandatory_attributes(:lineage, :pathological_status, :specimen_class, :specimen_type, :specimen_characteristics)
|
29
27
|
|
30
28
|
# @quirk caTissue Specimen characteristics are auto-generated but SpecimenRequirement
|
31
|
-
# characteristics are not. It is safe to set the
|
29
|
+
# characteristics are not. It is safe to set the +:autogenerated+ flag for both
|
32
30
|
# AbstractSpecimen subclasses. This results in an unnecessary SpecimenRequirement
|
33
31
|
# create database query, but SpecimenRequirement create is rare and there is no harm.
|
34
32
|
#
|
@@ -40,33 +38,42 @@ module CaTissue
|
|
40
38
|
# differs from the existing id.
|
41
39
|
#
|
42
40
|
# @quirk caTissue Unlike other dependents, AbstractSpecimen characteristics, events and child
|
43
|
-
# specimens have cascade style
|
41
|
+
# specimens have cascade style +all+. This implies that an AbstractSpecimen update does not
|
44
42
|
# create a referenced dependent. AbstractSpecimen create cascades to create and AbstractSpecimen
|
45
43
|
# update cascades to update, but AbstractSpecimen update does not cascade to create.
|
46
|
-
# The
|
44
|
+
# The +:no_cascade_update_to_create flag+ is set to handle this feature of cascade style +all+.
|
47
45
|
qualify_attribute(:specimen_characteristics, :cascaded, :fetched, :autogenerated, :no_cascade_update_to_create)
|
48
46
|
|
49
|
-
# The
|
50
|
-
add_dependent_attribute(:
|
51
|
-
|
47
|
+
# The +:no_cascade_update_to_create+ flag is set since specimen_events has cascade style +all+.
|
48
|
+
add_dependent_attribute(:specimen_event_parameters, :disjoint)
|
49
|
+
|
52
50
|
set_attribute_inverse(:parent_specimen, :child_specimens)
|
53
51
|
|
54
|
-
|
52
|
+
# @quirk caTissue A Specimen update cascades to a child specimen, but the update is not reflected
|
53
|
+
# in the caTissue updateObject result. Work-around is to fetch the updated child from the
|
54
|
+
# database to ensure that the database content reflects the intended update argument.
|
55
|
+
#
|
56
|
+
# The +:no_cascade_update_to_create+ flag is set since child_specimens has cascade style +all+.
|
57
|
+
add_dependent_attribute(:child_specimens, :unfetched, :fetch_saved, :no_cascade_update_to_create)
|
55
58
|
|
59
|
+
# The specimen_class attribute constants.
|
56
60
|
class SpecimenClass
|
57
61
|
TISSUE = 'Tissue'
|
58
62
|
FLUID = 'Fluid'
|
59
63
|
MOLECULAR = 'Molecular'
|
60
64
|
CELL = 'Cell'
|
61
65
|
|
62
|
-
|
63
|
-
|
66
|
+
# The standard units used for each specimen class.
|
64
67
|
UNIT_HASH = {TISSUE => 'gm', FLUID => 'ml', MOLECULAR => 'ug'}
|
65
68
|
|
66
|
-
# @return whether the value is an accepted tissue class value
|
69
|
+
# @return [Boolean] whether the value is an accepted tissue class value
|
67
70
|
def self.include?(value)
|
68
71
|
EXTENT.include?(value)
|
69
72
|
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
EXTENT = Set.new([TISSUE, FLUID, MOLECULAR, CELL])
|
70
77
|
end
|
71
78
|
|
72
79
|
# Initializes this AbstractSpecimen. The default +specimen_class+ is inferred from this
|
@@ -76,33 +83,33 @@ module CaTissue
|
|
76
83
|
self.specimen_class ||= infer_specimen_class(self.class)
|
77
84
|
end
|
78
85
|
|
79
|
-
# @return whether this specimen is derived from a parent specimen
|
86
|
+
# @return [Boolean] whether this specimen is derived from a parent specimen
|
80
87
|
def derived?
|
81
|
-
|
88
|
+
!!parent
|
82
89
|
end
|
83
90
|
|
84
|
-
# @return whether this specimen is an aliquot
|
91
|
+
# @return [Boolean] whether this specimen is an aliquot
|
85
92
|
def aliquot?
|
86
93
|
lineage ||= default_lineage
|
87
94
|
lineage == 'Aliquot'
|
88
95
|
end
|
89
96
|
|
90
|
-
# @return this specimen's aliquots
|
97
|
+
# @return [<AbstractSpecimen>] this specimen's aliquots
|
91
98
|
def aliquots
|
92
99
|
children.filter { |child| child.aliquot? }
|
93
100
|
end
|
94
101
|
|
95
|
-
# @return whether this specimen's type is 'Fresh Tissue'
|
102
|
+
# @return [Boolean] whether this specimen's type is 'Fresh Tissue'
|
96
103
|
def fresh?
|
97
104
|
specimen_type == 'Fresh Tissue'
|
98
105
|
end
|
99
106
|
|
100
|
-
# @return whether this specimen's type starts with 'Fixed'
|
107
|
+
# @return [Boolean] whether this specimen's type starts with 'Fixed'
|
101
108
|
def fixed?
|
102
109
|
specimen_type =~ /^Fixed/
|
103
110
|
end
|
104
111
|
|
105
|
-
# @return whether this specimen's type starts with 'Frozen'
|
112
|
+
# @return [Boolean] whether this specimen's type starts with 'Frozen'
|
106
113
|
def frozen?
|
107
114
|
specimen_type =~ /^Frozen/
|
108
115
|
end
|
@@ -119,11 +126,12 @@ module CaTissue
|
|
119
126
|
SpecimenClass::UNIT_HASH[self.specimen_class]
|
120
127
|
end
|
121
128
|
|
122
|
-
# Derives a specimen from this specimen. The
|
123
|
-
# with one addition:
|
129
|
+
# Derives a new specimen from this specimen. The options are described in
|
130
|
+
# {Specimen.create_specimen}, with one addition:
|
131
|
+
# * +:count+(+Integer+) - the optional number of specimens to derive
|
124
132
|
#
|
125
|
-
# If the
|
126
|
-
#
|
133
|
+
# If the +:count+ option is greater than one and the +:specimen_class+,
|
134
|
+
# +:specimen_type+ and +:specimen_characteristics+ options are not set to values
|
127
135
|
# which differ from the respective values for this Specimen, then the specimen is
|
128
136
|
# aliquoted, otherwise the derived specimens are created independently, e.g.:
|
129
137
|
# spc = Specimen.create_specimen(:specimen_class => :tissue, :specimen_type => :frozen)
|
@@ -144,50 +152,52 @@ module CaTissue
|
|
144
152
|
#
|
145
153
|
# The default derived specimen label is _label_+_+_n_, where _label_ is this specimen's
|
146
154
|
# label and _n_ is this specimen's child count after including the new derived specimen,
|
147
|
-
# e.g. 3090_3 for the third child in parent specimen with label 3090
|
155
|
+
# e.g. +3090_3+ for the third child in the parent specimen with label +3090+.
|
148
156
|
#
|
149
|
-
# @
|
150
|
-
# @
|
157
|
+
# @param [{Symbol => Object}, nil] opts the attribute => value hash
|
158
|
+
# @return [AbstractSpecimen, <AbstractSpecimen>] the new derived specimen if the +:count+ option
|
159
|
+
# is missing or one, otherwise an Array of _count_ derived specimens
|
160
|
+
# @raise [Jinx::ValidationError] if an aliquoted parent available quantity is not greater than zero
|
151
161
|
# or the derived specimen quantities exceed the parent available quantity
|
152
|
-
def derive(
|
162
|
+
def derive(opts=Hash::EMPTY_HASH)
|
153
163
|
# add defaults
|
154
164
|
add_defaults if specimen_class.nil?
|
155
|
-
# copy the
|
156
|
-
|
165
|
+
# copy the option hash
|
166
|
+
opts = opts.dup
|
157
167
|
# standardize the requirement param, if any
|
158
|
-
rqmt =
|
159
|
-
|
168
|
+
rqmt = opts.delete(:requirement)
|
169
|
+
opts[:specimen_requirement] ||= rqmt if rqmt
|
160
170
|
# the default specimen parameters
|
161
|
-
unless
|
162
|
-
|
163
|
-
|
171
|
+
unless opts.has_key?(:specimen_requirement) then
|
172
|
+
opts[:specimen_class] ||= self.specimen_class ||= infer_specimen_class
|
173
|
+
opts[:specimen_type] ||= self.specimen_type
|
164
174
|
end
|
165
|
-
unless Class ===
|
166
|
-
|
175
|
+
unless Class === opts[:specimen_class] then
|
176
|
+
opts[:specimen_class] = infer_class(opts)
|
167
177
|
end
|
168
|
-
count =
|
178
|
+
count = opts.delete(:count)
|
169
179
|
count ||= 1
|
170
180
|
aliquot_flag = false
|
171
|
-
if count > 1 and
|
181
|
+
if count > 1 and opts[:specimen_class] == self.class and opts[:specimen_type] == self.specimen_type then
|
172
182
|
# aliquots share the specimen_characteristics
|
173
|
-
child_chr =
|
183
|
+
child_chr = opts[:specimen_characteristics] ||= specimen_characteristics
|
174
184
|
aliquot_flag = child_chr == specimen_characteristics
|
175
185
|
end
|
176
186
|
# set aliquot parameters if necessary
|
177
|
-
if aliquot_flag then set_aliquot_parameters(
|
187
|
+
if aliquot_flag then set_aliquot_parameters(opts, count) end
|
178
188
|
# make the derived specimens
|
179
|
-
count == 1 ? create_derived(
|
189
|
+
count == 1 ? create_derived(opts) : Array.new(count) { create_derived(opts) }
|
180
190
|
end
|
181
191
|
|
182
192
|
# Returns whether this AbstractSpecimen is minimally consistent with the other specimen.
|
183
|
-
# This method augments the
|
193
|
+
# This method augments the +Jinx::Resource.minimal_match?+ with an additional restriction
|
184
194
|
# that the other specimen is the same type as this specimen and
|
185
195
|
# is a tolerant match on specimen class, specimen type and pathological status.
|
186
196
|
# A _tolerant_ match condition holds if the other attribute value is equal to this
|
187
197
|
# AbstractSpecimen's attribute value or the other value is the default 'Not Specified'.
|
188
198
|
#
|
189
|
-
# @param (see
|
190
|
-
# @return (see
|
199
|
+
# @param (see Jinx::Resource#minimal_match?)
|
200
|
+
# @return (see Jinx::Resource#minimal_match?)
|
191
201
|
def minimal_match?(other)
|
192
202
|
super and tolerant_match?(other, TOLERANT_MATCH_ATTRS)
|
193
203
|
end
|
@@ -206,12 +216,12 @@ module CaTissue
|
|
206
216
|
# @param [Integer] count the number of aliquots
|
207
217
|
def set_aliquot_parameters(params, count); end
|
208
218
|
|
209
|
-
# Overrides
|
219
|
+
# Overrides +Jinx::Resource.each_defaultable_reference} to visit the {CaTissue::SpecimenCharacteristics+.
|
210
220
|
# The characteristics are not dependent since they can be shared among aliquots.
|
211
221
|
# However, the defaults should be added to them. Do so here.
|
212
222
|
#
|
213
|
-
# @yield (see
|
214
|
-
def
|
223
|
+
# @yield (see Jinx::Resource#each_defaultable_reference)
|
224
|
+
def each_defaultable_reference
|
215
225
|
super { |dep| yield dep }
|
216
226
|
yield characteristics if characteristics
|
217
227
|
end
|
@@ -228,11 +238,11 @@ module CaTissue
|
|
228
238
|
self.characteristics ||= default_characteristics
|
229
239
|
end
|
230
240
|
|
231
|
-
# Returns the Class from the given params hash.If the
|
241
|
+
# Returns the Class from the given params hash.If the +:specimen_class+ parameter
|
232
242
|
# is set to a Class, then this method returns that Class. Otherwise, if the parameter is a
|
233
243
|
# String or Symbol, then the Class is formed from the parameter as a prefix and 'Specimen' or
|
234
244
|
# 'SpecimenRequirement' depending on this AbstractSpecimen's subclass. If the
|
235
|
-
# :specimen_class parameter is missing and there is a
|
245
|
+
# :specimen_class parameter is missing and there is a +:specimen_requirement+ parameter,
|
236
246
|
# then the specimen requirement specimen_class attribute value is used.
|
237
247
|
#
|
238
248
|
# @param [{Symbol => Object}] params the specimen attribute => value hash
|
@@ -251,19 +261,23 @@ module CaTissue
|
|
251
261
|
CaTissue.const_get(cls_nm)
|
252
262
|
end
|
253
263
|
|
254
|
-
# Creates a derived specimen.
|
264
|
+
# Creates a derived specimen. The options is an attribute => value hash. The options
|
265
|
+
# can also include a +:specimen_requirement+. The non-domain attribute values of the
|
266
|
+
# new derived specimen are determined according to the following precedence rule:
|
267
|
+
# 1. The attribute => value option.
|
268
|
+
# 2. The requirement property value.
|
269
|
+
# 3. This specimen's property value.
|
255
270
|
#
|
256
|
-
# @param [{Symbol => Object}]
|
257
|
-
# @return [
|
258
|
-
def create_derived(
|
271
|
+
# @param [{Symbol => Object}] opts the derived specimen attribute => value hash
|
272
|
+
# @return [AbstractSpecimen] the derived specimen or requirement
|
273
|
+
def create_derived(opts)
|
259
274
|
# Merge the non-domain attribute values from this specimen, unless there is a requirement.
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
# set the parent
|
275
|
+
opts = value_hash(DERIVED_MERGEABLE_ATTRS).merge!(opts) unless opts.has_key?(:specimen_requirement)
|
276
|
+
# Copy this specimen's characteristics, if not already given in the options.
|
277
|
+
opts[:specimen_characteristics] ||= default_derived_characteristics
|
278
|
+
# Make the new specimen.
|
279
|
+
spc = Specimen.create_specimen(opts)
|
280
|
+
# The derived specimen's parent is this specimen.
|
267
281
|
spc.parent = self
|
268
282
|
spc
|
269
283
|
end
|
@@ -274,8 +288,8 @@ module CaTissue
|
|
274
288
|
# @return [CaTissue::SpecimenCharacteristics, nil] a copy of this Specimen's specimen_characteristics, or nil if none
|
275
289
|
def default_derived_characteristics
|
276
290
|
chrs = specimen_characteristics || return
|
277
|
-
|
278
|
-
chrs.copy(
|
291
|
+
pas = chrs.class.nondomain_attributes.reject { |pa| pa == :identifier }
|
292
|
+
chrs.copy(pas)
|
279
293
|
end
|
280
294
|
|
281
295
|
# @return a copy of the parent characteristics, if any, or a new SpecimenCharacteristics otherwise
|
@@ -1,6 +1,4 @@
|
|
1
1
|
module CaTissue
|
2
|
-
resource_import Java::edu.wustl.catissuecore.domain.AbstractSpecimenCollectionGroup
|
3
|
-
|
4
2
|
class AbstractSpecimenCollectionGroup
|
5
3
|
add_attribute_aliases(:diagnosis => :clinical_diagnosis, :site => :specimen_collection_site, :collection_site => :specimen_collection_site)
|
6
4
|
|
@@ -8,14 +6,13 @@ module CaTissue
|
|
8
6
|
|
9
7
|
add_mandatory_attributes(:activity_status)
|
10
8
|
|
11
|
-
# Overrides
|
9
|
+
# Overrides +Jinx::Resource.each_dependent+ to exclude Specimens or SpecimenRequirements with a parent,
|
12
10
|
# since parent is the immediate Specimen or SpecimenRequirement owner.
|
13
11
|
#
|
14
|
-
# @yield (see
|
15
|
-
# @yieldparam (see
|
12
|
+
# @yield (see Jinx::Resource#each_dependent)
|
13
|
+
# @yieldparam (see Jinx::Resource#each_dependent)
|
16
14
|
def each_dependent
|
17
15
|
super { |dep| yield dep unless AbstractSpecimen === dep and dep.parent }
|
18
16
|
end
|
19
|
-
|
20
17
|
end
|
21
18
|
end
|
@@ -1,8 +1,6 @@
|
|
1
|
-
require 'caruby/
|
1
|
+
require 'caruby/helpers/coordinate'
|
2
2
|
|
3
3
|
module CaTissue
|
4
|
-
resource_import Java::edu.wustl.catissuecore.domain.Capacity
|
5
|
-
|
6
4
|
class Capacity
|
7
5
|
# Sets the first dimension to the specified value. If value is nil, then the dimension is set to default one.
|
8
6
|
def one_dimension_capacity=(value)
|
@@ -24,7 +22,7 @@ module CaTissue
|
|
24
22
|
|
25
23
|
add_mandatory_attributes(:one_dimension_capacity, :two_dimension_capacity)
|
26
24
|
|
27
|
-
# Returns the read-only Coordinate with this
|
25
|
+
# Returns the read-only Coordinate with this capacity's rows and columns.
|
28
26
|
def bounds
|
29
27
|
@bounds ||= Coordinate.new(columns, rows)
|
30
28
|
end
|
@@ -1,17 +1,12 @@
|
|
1
|
-
require 'catissue/
|
2
|
-
require 'caruby/util/validation'
|
1
|
+
require 'catissue/helpers/collectible_event_parameters'
|
3
2
|
|
4
3
|
module CaTissue
|
5
|
-
# import the Java class
|
6
|
-
resource_import Java::edu.wustl.catissuecore.domain.CollectionEventParameters
|
7
|
-
|
8
4
|
class CollectionEventParameters
|
9
5
|
include CollectibleEventParameters
|
10
6
|
|
11
7
|
add_attribute_defaults(:collection_procedure => 'Not Specified', :container => 'Not Specified')
|
12
8
|
|
13
9
|
# An auto-generated CEP must fetch the user.
|
14
|
-
qualify_attribute(:user, :
|
15
|
-
|
10
|
+
qualify_attribute(:user, :fetch_saved)
|
16
11
|
end
|
17
12
|
end
|
@@ -1,13 +1,10 @@
|
|
1
1
|
require 'date'
|
2
|
-
require 'catissue/
|
2
|
+
require 'catissue/helpers/hash_code'
|
3
3
|
|
4
4
|
module CaTissue
|
5
|
-
# import the Java class
|
6
|
-
resource_import Java::edu.wustl.catissuecore.domain.CollectionProtocol
|
7
|
-
|
8
5
|
# The CollectionProtocol domain class.
|
9
6
|
#
|
10
|
-
# @quirk caTissue Augment the standard metadata
|
7
|
+
# @quirk caTissue Augment the standard metadata savable reference attributes to work around caTissue Bug #150:
|
11
8
|
# Create CollectionProtocol in API ignores startDate.
|
12
9
|
class CollectionProtocol
|
13
10
|
include HashCode
|
@@ -30,15 +27,15 @@ module CaTissue
|
|
30
27
|
|
31
28
|
add_dependent_attribute(:consent_tiers)
|
32
29
|
|
33
|
-
# @quirk caTissue Augment the standard metadata
|
30
|
+
# @quirk caTissue Augment the standard metadata savable reference attributes to work around caTissue Bug #150:
|
34
31
|
# Create CollectionProtocol in API ignores startDate.
|
35
32
|
qualify_attribute(:start_date, :update_only)
|
36
33
|
|
37
|
-
# @quirk caTissue Augment the standard metadata
|
34
|
+
# @quirk caTissue Augment the standard metadata savable reference attributes to work around caTissue Bug #150:
|
38
35
|
# Create CollectionProtocol in API ignores startDate.
|
39
36
|
set_attribute_type(:coordinators, CaTissue::User)
|
40
37
|
|
41
|
-
# @quirk caTissue Augment the standard metadata
|
38
|
+
# @quirk caTissue Augment the standard metadata savable reference attributes to work around caTissue Bug #150:
|
42
39
|
# Create CollectionProtocol in API ignores startDate.
|
43
40
|
qualify_attribute(:coordinators, :fetched)
|
44
41
|
|
@@ -67,9 +64,9 @@ module CaTissue
|
|
67
64
|
registrations.detect { |registration| registration.participant == participant }
|
68
65
|
end
|
69
66
|
|
70
|
-
# Returns
|
71
|
-
def
|
72
|
-
events.sort_by { |
|
67
|
+
# Returns this protocol's events sorted by study calendar event point.
|
68
|
+
def sorted_events
|
69
|
+
events.sort_by { |ev| ev.event_point || CollectionProtocolEvent::DEFAULT_EVENT_POINT }
|
73
70
|
end
|
74
71
|
|
75
72
|
# Returns the specimens collected from the given participant for this CollectionProtocol,
|
@@ -83,7 +80,7 @@ module CaTissue
|
|
83
80
|
# Adds specimens to this protocol. The following parameter options are supported:
|
84
81
|
# * :participant - the Participant from whom the specimen is collected
|
85
82
|
# * :biospecimens - the collected top-level underived specimens
|
86
|
-
# * additional SCG parameters as described in {SpecimenCollectionGroup#
|
83
|
+
# * additional SCG parameters as described in {CaTissue::SpecimenCollectionGroup#merge_attributes}.
|
87
84
|
#
|
88
85
|
# If the options does not include a +:collection_protocol_event+, then the SCG is assigned
|
89
86
|
# to the first collection event in this protocol.
|
@@ -98,7 +95,7 @@ module CaTissue
|
|
98
95
|
#
|
99
96
|
# @param [(<Specimen>, {Symbol => Object})] specimens_and_params the specimens to add followed
|
100
97
|
# by the required parameter hash
|
101
|
-
# @return [SpecimenCollectionGroup] a new SCG for the given participant containing the specimens
|
98
|
+
# @return [CaTissue::SpecimenCollectionGroup] a new SCG for the given participant containing the specimens
|
102
99
|
# @raise [ArgumentError] if the {SpecimenCollectionGroup} does not include all required attributes
|
103
100
|
def add_specimens(*specimens_and_params)
|
104
101
|
params = specimens_and_params.pop
|
@@ -164,10 +161,8 @@ module CaTissue
|
|
164
161
|
def add_default_site
|
165
162
|
if coordinators.size == 1 then
|
166
163
|
site = coordinators.first.sites.first
|
167
|
-
else
|
168
|
-
site = CaTissue::Site.default_site
|
169
|
-
site.find unless site.identifier
|
170
164
|
end
|
165
|
+
site ||= CaTissue::Site.default_site
|
171
166
|
sites << site
|
172
167
|
end
|
173
168
|
|