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,9 +1,6 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
module CaTissue
|
4
|
-
# import the Java class
|
5
|
-
resource_import Java::edu.wustl.catissuecore.domain.SpecimenArray
|
6
|
-
|
7
4
|
class SpecimenArray
|
8
5
|
# @quirk caTissue the superclass Container occupied_positions does not apply to SpecimenArray.
|
9
6
|
remove_attribute(:occupied_positions)
|
@@ -1,9 +1,6 @@
|
|
1
|
-
require 'catissue/
|
1
|
+
require 'catissue/helpers/position'
|
2
2
|
|
3
3
|
module CaTissue
|
4
|
-
# import the Java class
|
5
|
-
resource_import Java::edu.wustl.catissuecore.domain.SpecimenArrayContent
|
6
|
-
|
7
4
|
# @quirk caTissue #{CaTissue::SpecimenArrayContent} should be derived from
|
8
5
|
# {CaTissue::AbstractPosition} but isn't (cf. {CaTissue::ContainerType}).
|
9
6
|
# Partially rectify this by including the {Position} mix-in in common with
|
@@ -1,8 +1,5 @@
|
|
1
1
|
module CaTissue
|
2
|
-
|
3
|
-
resource_import Java::edu.wustl.catissuecore.domain.SpecimenArrayType
|
4
|
-
|
5
|
-
class SpecimenArrayType < CaTissue::ContainerType
|
2
|
+
class SpecimenArrayType
|
6
3
|
add_mandatory_attributes(:specimen_class, :specimen_types)
|
7
4
|
|
8
5
|
# Returns SpecimenArray.
|
@@ -1,9 +1,7 @@
|
|
1
1
|
module CaTissue
|
2
2
|
class SpecimenCollectionGroup
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
class BasePathologyAnnotation
|
3
|
+
module Pathology
|
4
|
+
class BasePathologyAnnotation
|
7
5
|
# @quirk caTissue The BasePathologyAnnotation => HistologicType collection
|
8
6
|
# property is misnamed as histologicType rather than histologicTypeCollection. This misnaming
|
9
7
|
# prevents caRuby from inferring the attribute domain type and inverse. Work-around is to set
|
@@ -1,9 +1,7 @@
|
|
1
1
|
module CaTissue
|
2
2
|
class SpecimenCollectionGroup
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
class BaseSolidTissuePathologyAnnotation
|
3
|
+
module Pathology
|
4
|
+
class BaseSolidTissuePathologyAnnotation
|
7
5
|
# @quirk caTissue The BaseSolidTissuePathologyAnnotation => HistologicGrade collection
|
8
6
|
# property is misnamed as histologicGrade rather than histologicGradeCollection. This misnaming
|
9
7
|
# prevents caRuby from inferring the attribute domain type and inverse. Work-around is to set
|
@@ -1,16 +1,13 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require 'catissue/
|
1
|
+
require 'jinx/helpers/transitive_closure'
|
2
|
+
require 'jinx/helpers/validation'
|
3
|
+
require 'catissue/helpers/collectible'
|
4
4
|
|
5
5
|
module CaTissue
|
6
|
-
# import the Java class
|
7
|
-
resource_import Java::edu.wustl.catissuecore.domain.SpecimenCollectionGroup
|
8
|
-
|
9
6
|
# The SpecimenCollectionGroup domain class.
|
10
7
|
#
|
11
8
|
# _Note_: the SpecimenCollectionGroup name attribute is auto-generated on create in caTissue 1.1 API and should not
|
12
9
|
# be set by API clients when creating a new SpecimenCollectionGroup in the database.
|
13
|
-
class SpecimenCollectionGroup
|
10
|
+
class SpecimenCollectionGroup
|
14
11
|
include Collectible
|
15
12
|
|
16
13
|
# @quirk caTissue Bug #64: Some domain collection properties not initialized.
|
@@ -42,8 +39,8 @@ module CaTissue
|
|
42
39
|
end
|
43
40
|
|
44
41
|
add_attribute_aliases(:collection_event => :collection_protocol_event,
|
42
|
+
:event => :collection_protocol_event,
|
45
43
|
:event_parameters => :specimen_event_parameters,
|
46
|
-
:events => :specimen_event_parameters,
|
47
44
|
:registration => :collection_protocol_registration)
|
48
45
|
|
49
46
|
# @quirk caTissue Bug #116: specimen_collection_site is incorrectly attached in the caTissue class
|
@@ -57,7 +54,7 @@ module CaTissue
|
|
57
54
|
|
58
55
|
set_secondary_key_attributes(:name)
|
59
56
|
|
60
|
-
set_alternate_key_attributes(:surgical_pathology_number, :
|
57
|
+
set_alternate_key_attributes(:surgical_pathology_number, :specimen_collection_site)
|
61
58
|
|
62
59
|
# @quirk caTissue An auto-generated or created SCG auto-generates a ConsentTierStatus for each
|
63
60
|
# ConsentTierResponse defined in the SCG owner CPR.
|
@@ -65,22 +62,21 @@ module CaTissue
|
|
65
62
|
# @quirk caTissue SCG consent_tier_statuses is cascaded but not fetched.
|
66
63
|
add_dependent_attribute(:consent_tier_statuses, :autogenerated, :unfetched)
|
67
64
|
|
68
|
-
# SCG event parameters are disjoint, since they are owned by either a SCG
|
69
|
-
# An auto-generated SCG also auto-generates the Collection
|
70
|
-
# A SCG SEP is only created as a dependent when the SCG is created.
|
71
|
-
# cannot be created for an existing SCG. By contrast, a Specimen SEP can only
|
72
|
-
# created, not updated.
|
65
|
+
# @quirk caTissue SCG event parameters are disjoint, since they are owned by either a SCG
|
66
|
+
# or a Specimen, but not both. An auto-generated SCG also auto-generates the Collection
|
67
|
+
# and Received SEPs. A SCG SEP is only created as a dependent when the SCG is created.
|
68
|
+
# A SCG SEP cannot be created for an existing SCG. By contrast, a Specimen SEP can only
|
69
|
+
# be created, not updated.
|
73
70
|
#
|
74
|
-
# @quirk caTissue
|
75
|
-
#
|
76
|
-
# first update, and an SEP cannot be added to an existing, updated SCG.
|
77
|
-
# to update the SCG template without the parameters,
|
71
|
+
# @quirk caTissue Update of an auto-generated SpecimenCollectionGroup ignores the referenced
|
72
|
+
# collection and received event parameters and instead creates new parameters. This occurs
|
73
|
+
# only on the first update, and an SEP cannot be added to an existing, updated SCG.
|
74
|
+
# Work-around is to update the SCG template without the parameters, merge the auto-generated
|
75
|
+
# SEP into the referenced SEP, then save the SEPs separately.
|
78
76
|
#
|
79
77
|
# @quirk caTissue although SpecimenCollectionGroup auto-generated update ignores referenced
|
80
|
-
#
|
81
|
-
|
82
|
-
# to mark the attribute to handle this quirk.
|
83
|
-
add_dependent_attribute(:specimen_event_parameters, :autogenerated_on_update, :disjoint)
|
78
|
+
# collection and received event parameters, these parameters are mandatory for the update.
|
79
|
+
add_dependent_attribute(:specimen_event_parameters, :disjoint, :fetch_saved)
|
84
80
|
|
85
81
|
# SCG Specimens are auto-generated from SpecimenRequirement templates when the SCG is created.
|
86
82
|
# The Specimens are not cascaded.
|
@@ -92,9 +88,6 @@ module CaTissue
|
|
92
88
|
# within the SCG scope.
|
93
89
|
add_dependent_attribute(:specimens, :logical, :autogenerated)
|
94
90
|
|
95
|
-
# The CPE-SCG association is bi-directional.
|
96
|
-
set_attribute_inverse(:collection_protocol_event, :specimen_collection_groups)
|
97
|
-
|
98
91
|
# CPE is fetched but not cascaded.
|
99
92
|
qualify_attribute(:collection_protocol_event, :fetched)
|
100
93
|
|
@@ -108,12 +101,9 @@ module CaTissue
|
|
108
101
|
# @quirk caTissue Bug #65: Although SCG name uniquely identifies a SCG, the SCG name is auto-generated on create
|
109
102
|
# and cannnot be set by the client. Therefore, name is marked as update_only.
|
110
103
|
qualify_attribute(:name, :autogenerated, :update_only)
|
111
|
-
|
112
|
-
# The SCG proxy class.
|
113
|
-
self.annotation_proxy_class_name = 'SCGRecordEntry'
|
114
104
|
|
115
105
|
# The SCG pathology annotation.
|
116
|
-
add_annotation('Pathology', :package => 'pathology_scg', :service => 'pathologySCG')
|
106
|
+
add_annotation('Pathology', :package => 'pathology_scg', :service => 'pathologySCG', :proxy_name => 'SCGRecordEntry')
|
117
107
|
|
118
108
|
# @quirk caTissue Bug #64: Initialize the SCG consent_tier_statuses to an empty set.
|
119
109
|
def initialize
|
@@ -123,7 +113,7 @@ module CaTissue
|
|
123
113
|
end
|
124
114
|
|
125
115
|
# @return [CollectionProtocol] the SCG CPE CP
|
126
|
-
|
116
|
+
def collection_protocol
|
127
117
|
collection_protocol_event.collection_protocol if collection_protocol_event
|
128
118
|
end
|
129
119
|
|
@@ -153,10 +143,10 @@ module CaTissue
|
|
153
143
|
end
|
154
144
|
|
155
145
|
# Merges the other object into this SpecimenCollectionGroup. This method augments
|
156
|
-
#
|
146
|
+
# +Jinx::Resource.merge_attributes+ as follows:
|
157
147
|
# * Adds the transitive closure of each non-derived Specimen in other.
|
158
148
|
#
|
159
|
-
# @param (see
|
149
|
+
# @param (see Jinx::Resource#merge_attributes)
|
160
150
|
# @option (see CaTissue::Collectible#merge_attributes)
|
161
151
|
def merge_attributes(other, attributes=nil)
|
162
152
|
if Hash === other then
|
@@ -185,7 +175,7 @@ module CaTissue
|
|
185
175
|
super and event_point == other.event_point
|
186
176
|
end
|
187
177
|
|
188
|
-
# Overrides
|
178
|
+
# Overrides +Jinx::Resource.direct_dependents+ in the case of the _specimens_ attribute to select
|
189
179
|
# only top-level Specimens not derived from another Specimen.
|
190
180
|
def direct_dependents(attribute)
|
191
181
|
if attribute == :specimens then
|
@@ -198,28 +188,28 @@ module CaTissue
|
|
198
188
|
CONSENT_TIER_STATUS_ATTRS = [:consent_tier_statuses]
|
199
189
|
|
200
190
|
def mandatory_attributes
|
201
|
-
|
191
|
+
pas = super
|
202
192
|
if registration and not registration.consent_tier_responses.empty? then
|
203
|
-
|
193
|
+
pas + CONSENT_TIER_STATUS_ATTRS
|
204
194
|
else
|
205
|
-
|
195
|
+
pas
|
206
196
|
end
|
207
197
|
end
|
208
198
|
|
209
|
-
# Relaxes the
|
199
|
+
# Relaxes the +CaRuby::Persistable.saved_attributes_to_fetch+ condition for a SCG as follows:
|
210
200
|
# * If the SCG status was updated from +Pending+ to +Collected+, then fetch the saved SCG event parameters.
|
211
201
|
#
|
212
|
-
# @param (see CaRuby::Persistable#
|
213
|
-
# @return (see CaRuby::Persistable#
|
214
|
-
def
|
202
|
+
# @param (see CaRuby::Persistable#saved_attributes_to_fetch)
|
203
|
+
# @return (see CaRuby::Persistable#saved_attributes_to_fetch)
|
204
|
+
def saved_attributes_to_fetch(operation)
|
215
205
|
operation == :update && status_changed_to_complete? ? EVENT_PARAM_ATTRS : super
|
216
206
|
end
|
217
207
|
|
218
|
-
# Relaxes the
|
208
|
+
# Relaxes the +CaRuby::Persistable.saved_attributes_to_fetch+ condition for a SCG as follows:
|
219
209
|
# * If the SCG status was updated from +Pending+ to +Collected+, then fetch the saved SCG event parameters.
|
220
210
|
#
|
221
|
-
# @param (see CaRuby::Persistable#
|
222
|
-
# @return (see CaRuby::Persistable#
|
211
|
+
# @param (see CaRuby::Persistable#saved_attributes_to_fetch)
|
212
|
+
# @return (see CaRuby::Persistable#saved_attributes_to_fetch)
|
223
213
|
def autogenerated?(operation)
|
224
214
|
operation == :update && status_changed_to_complete? ? EVENT_PARAM_ATTRS : super
|
225
215
|
end
|
@@ -233,8 +223,8 @@ module CaTissue
|
|
233
223
|
validate_consent
|
234
224
|
validate_event_parameters
|
235
225
|
end
|
236
|
-
|
237
|
-
# @see #
|
226
|
+
|
227
|
+
# @see #autogenerated?
|
238
228
|
def status_changed_to_complete?
|
239
229
|
if collected? and snapshot and snapshot[:collection_status] == 'Pending' then
|
240
230
|
logger.debug { "Saved #{qp} event parameters must be fetched from the database to reflect the current database state, since the status was changed from Pending to Complete." }
|
@@ -254,7 +244,7 @@ module CaTissue
|
|
254
244
|
# 'Complete' and there is no other ReceivedEventParameters. The receiver is an arbitrary
|
255
245
|
# protocol coordinator.
|
256
246
|
#
|
257
|
-
# @raise [ValidationError] if the default ReceivedEventParameters could not be created because
|
247
|
+
# @raise [Jinx::ValidationError] if the default ReceivedEventParameters could not be created because
|
258
248
|
# there is no protocol or protocol coordinator
|
259
249
|
# @see CollectionProtocol#first_event
|
260
250
|
def add_defaults_local
|
@@ -317,7 +307,7 @@ module CaTissue
|
|
317
307
|
pcl = registration.protocol || return
|
318
308
|
# if no protocol event, then add the default event
|
319
309
|
pcl.add_defaults if pcl.events.empty?
|
320
|
-
ev = pcl.
|
310
|
+
ev = pcl.sorted_events.first || return
|
321
311
|
logger.debug { "Default #{qp} collection event is the registration protocol #{pcl.qp} first event #{ev.qp}." }
|
322
312
|
ev
|
323
313
|
end
|
@@ -325,11 +315,11 @@ module CaTissue
|
|
325
315
|
def create_default_received_event_parameters
|
326
316
|
cp = collection_protocol
|
327
317
|
if cp.nil? then
|
328
|
-
raise ValidationError.new("SCG with status Complete default CollectionEventParameters could not be created since there is no collection protocol: #{self}")
|
318
|
+
raise Jinx::ValidationError.new("SCG with status Complete default CollectionEventParameters could not be created since there is no collection protocol: #{self}")
|
329
319
|
end
|
330
320
|
rcvr = cp.coordinators.first
|
331
321
|
if rcvr.nil? then
|
332
|
-
raise ValidationError.new("SCG with status Complete default CollectionEventParameters could not be created since there is no collection protocol coordinator: #{self}")
|
322
|
+
raise Jinx::ValidationError.new("SCG with status Complete default CollectionEventParameters could not be created since there is no collection protocol coordinator: #{self}")
|
333
323
|
end
|
334
324
|
# make the REP
|
335
325
|
ev = CaTissue::SpecimenEventParameters.create_parameters(:received, self, :user => rcvr)
|
@@ -347,7 +337,7 @@ module CaTissue
|
|
347
337
|
ev
|
348
338
|
end
|
349
339
|
|
350
|
-
# @raise [ValidationError] if there is a registration consent tier response without a corresponding SCG consent tier status
|
340
|
+
# @raise [Jinx::ValidationError] if there is a registration consent tier response without a corresponding SCG consent tier status
|
351
341
|
def validate_consent
|
352
342
|
return unless registration
|
353
343
|
# the default consent statuses
|
@@ -355,15 +345,15 @@ module CaTissue
|
|
355
345
|
registration.consent_tier_responses.each do |ctr|
|
356
346
|
ct = ctr.consent_tier
|
357
347
|
unless ctses.include?(ct) then
|
358
|
-
raise ValidationError.new("#{self} is missing a ConsentTierStatus for consent statement #{ct.statement}")
|
348
|
+
raise Jinx::ValidationError.new("#{self} is missing a ConsentTierStatus for consent statement #{ct.statement}")
|
359
349
|
end
|
360
350
|
end
|
361
351
|
end
|
362
352
|
|
363
|
-
# @raise [ValidationError] if the SCG has neither an identifier nor Received and Collection event parameters
|
353
|
+
# @raise [Jinx::ValidationError] if the SCG has neither an identifier nor Received and Collection event parameters
|
364
354
|
def validate_event_parameters
|
365
355
|
if identifier.nil? and event_parameters.empty? then
|
366
|
-
raise ValidationError.new("#{self} create is missing the required Received and Collection event parameters")
|
356
|
+
raise Jinx::ValidationError.new("#{self} create is missing the required Received and Collection event parameters")
|
367
357
|
end
|
368
358
|
end
|
369
359
|
end
|
@@ -1,11 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require 'catissue/
|
1
|
+
require 'jinx/helpers/validation'
|
2
|
+
require 'jinx/helpers/inflector'
|
3
|
+
require 'catissue/helpers/collectible'
|
4
4
|
|
5
5
|
module CaTissue
|
6
|
-
# import the Java class
|
7
|
-
resource_import Java::edu.wustl.catissuecore.domain.SpecimenEventParameters
|
8
|
-
|
9
6
|
class SpecimenEventParameters
|
10
7
|
# date is a synonym for the more accurately titled timestamp attribute.
|
11
8
|
add_attribute_aliases(:date => :timestamp)
|
@@ -15,14 +12,6 @@ module CaTissue
|
|
15
12
|
# specimen is abstract but unfetched.
|
16
13
|
qualify_attribute(:specimen, :unfetched)
|
17
14
|
|
18
|
-
private
|
19
|
-
|
20
|
-
def self.allocate
|
21
|
-
raise NotImplementedError.new("SpecimenEventParameters is abstract; use the create method to make a new instance")
|
22
|
-
end
|
23
|
-
|
24
|
-
public
|
25
|
-
|
26
15
|
# Creates a SpecimenEventParameters of the specified subclass type. The type is a
|
27
16
|
# SpecimenEventParameters subclass name without the +EventParameters+ suffix, e.g.
|
28
17
|
# +Collection+. Lower-case, underscore symbols are supported and preferred, e.g. the
|
@@ -33,25 +22,29 @@ module CaTissue
|
|
33
22
|
#
|
34
23
|
# The optional params argument are attribute => value associations, e.g.
|
35
24
|
# SpecimenEventParameters.create_parameters(:collection, scg, :user => collector, :timestamp => DateTime.now)
|
25
|
+
#
|
26
|
+
# @param [String, Symbol] type the event type
|
27
|
+
# @param [SpecimenCollectionGroup, Specimen] scg_or_specimen the event owner
|
28
|
+
# @param [{Symbol => Object}, nil] params the attribute => value associations
|
36
29
|
def self.create_parameters(type, scg_or_specimen, params=Hash::EMPTY_HASH)
|
37
30
|
# make the class name by joining the camel-cased type prefix to the subclass suffix.
|
38
|
-
# classify converts a lower_case, underscore type to a valid class name,
|
39
|
-
# becomes CheckInCheckOut
|
31
|
+
# classify converts a lower_case, underscore type to a valid class name,
|
32
|
+
# e.g. +:check_in_check_out+ becomes +CheckInCheckOut+.
|
40
33
|
class_name = type.to_s.classify + SUBCLASS_SUFFIX
|
41
34
|
begin
|
42
35
|
klass = CaTissue.const_get(class_name.to_sym)
|
43
36
|
rescue
|
44
37
|
raise ArgumentError.new("Unsupported event parameters type: #{type}; #{class_name} must be a subtype of #{self}")
|
45
38
|
end
|
46
|
-
|
39
|
+
ep = klass.new(params)
|
47
40
|
case scg_or_specimen
|
48
|
-
when SpecimenCollectionGroup then
|
49
|
-
when Specimen then
|
50
|
-
when nil then raise ArgumentError.new("Missing SpecimenEventParameters
|
41
|
+
when CaTissue::SpecimenCollectionGroup then ep.specimen_collection_group = scg_or_specimen
|
42
|
+
when CaTissue::Specimen then ep.specimen = scg_or_specimen
|
43
|
+
when nil then raise ArgumentError.new("Missing SpecimenEventParameters SCG or Specimen owner argument")
|
51
44
|
else
|
52
45
|
raise ArgumentError.new("Unsupported SpecimenEventParameters factory argument - expected SpecimenCollectionGroup or Specimen, found #{scg_or_specimen.class}")
|
53
46
|
end
|
54
|
-
|
47
|
+
ep
|
55
48
|
end
|
56
49
|
|
57
50
|
# @return [CaTissue::Collectible] specimen or SCG to which this event is attached
|
@@ -73,24 +66,20 @@ module CaTissue
|
|
73
66
|
specimen_collection_group.collection_protocol if specimen_collection_group
|
74
67
|
end
|
75
68
|
|
76
|
-
def saved_fetch_attributes(operation)
|
77
|
-
attrs = super
|
78
|
-
# TODO - KLUDGE!!!! simple_test migration test fails to set user ---- FIX!!!!
|
79
|
-
if identifier and not attrs.include?(:user) then
|
80
|
-
attrs + [:user]
|
81
|
-
else
|
82
|
-
attrs
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
69
|
private
|
87
70
|
|
71
|
+
# The class name suffix for all event parameter classes.
|
88
72
|
SUBCLASS_SUFFIX = 'EventParameters'
|
89
73
|
|
74
|
+
def self.allocate
|
75
|
+
raise NotImplementedError.new("SpecimenEventParameters is abstract; use the create method to make a new instance")
|
76
|
+
end
|
77
|
+
|
78
|
+
# @raise [Jinx::ValidationError] if the subject is missing or there is both a SCG and a Specimen owner
|
90
79
|
def validate_local
|
91
80
|
super
|
92
81
|
if subject.nil? then
|
93
|
-
raise ValidationError.new("Both specimen_collection_group and specimen are missing in SpecimenEventParameters #{self}")
|
82
|
+
raise Jinx::ValidationError.new("Both specimen_collection_group and specimen are missing in SpecimenEventParameters #{self}")
|
94
83
|
end
|
95
84
|
end
|
96
85
|
|
@@ -103,7 +92,10 @@ module CaTissue
|
|
103
92
|
self.user ||= default_user
|
104
93
|
end
|
105
94
|
|
95
|
+
# @return [CaTissue::User] the SCG receiver
|
106
96
|
def default_user
|
97
|
+
user = specimen.receiver if specimen
|
98
|
+
return user if user
|
107
99
|
scg = specimen_collection_group || (specimen.specimen_collection_group if specimen)
|
108
100
|
scg.receiver if scg
|
109
101
|
end
|
@@ -1,8 +1,5 @@
|
|
1
1
|
module CaTissue
|
2
|
-
|
3
|
-
resource_import Java::edu.wustl.catissuecore.domain.SpecimenPosition
|
4
|
-
|
5
|
-
class SpecimenPosition < CaTissue::AbstractPosition
|
2
|
+
class SpecimenPosition
|
6
3
|
add_mandatory_attributes(:storage_container)
|
7
4
|
|
8
5
|
add_attribute_aliases(:holder => :storage_container, :container => :storage_container, :occupant => :specimen)
|
@@ -22,7 +19,13 @@ module CaTissue
|
|
22
19
|
# Creating a TransferEventParameters sets the SpecimenPosition as a side-effect. Therefore,
|
23
20
|
# SpecimenPosition save is accomplished by creating a proxy TransferEventParameters instead.
|
24
21
|
def saver_proxy
|
25
|
-
|
22
|
+
# Look for a transfer event that matches the position.
|
23
|
+
xfr = specimen.event_parameters.detect do |sep|
|
24
|
+
CaTissue::TransferEventParameters === sep and sep.to == location
|
25
|
+
end
|
26
|
+
# Create a new transfer event, if necessary.
|
27
|
+
xfr ||= CaTissue::TransferEventParameters.new(:specimen => specimen, :to => location)
|
28
|
+
# If this position changed, then copy the original position to the transfer event from attributes.
|
26
29
|
if snapshot and changed? then
|
27
30
|
xfr.from_storage_container = snapshot[:storage_container]
|
28
31
|
xfr.from_position_dimension_one = snapshot[:position_dimension_one]
|
@@ -1,21 +1,18 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
3
|
module CaTissue
|
4
|
-
# import the Java class
|
5
|
-
resource_import Java::edu.wustl.catissuecore.domain.SpecimenProtocol
|
6
|
-
|
7
4
|
# The SpecimenProtocol domain class.
|
8
5
|
class SpecimenProtocol
|
9
6
|
set_secondary_key_attributes(:title)
|
10
7
|
|
11
|
-
# @quirk caTissue Bug #155:
|
8
|
+
# @quirk caTissue Bug #155: Enrollment is incorrectly defined in SpecimenProtocol rather
|
12
9
|
# than CollectionProtocol. It is defaulted here until this defect is fixed.
|
13
10
|
add_attribute_defaults(:activity_status => 'Active', :enrollment => 0)
|
14
11
|
|
15
12
|
add_mandatory_attributes(:principal_investigator, :activity_status, :start_date, :short_title)
|
16
13
|
|
17
|
-
# @quirk caTissue Augment the standard metadata
|
18
|
-
# Create CollectionProtocol in API ignores startDate
|
14
|
+
# @quirk caTissue Augment the standard metadata savable reference attributes to work around caTissue Bug #150:
|
15
|
+
# Create CollectionProtocol in the caTissue API ignores +startDate+.
|
19
16
|
qualify_attribute(:start_date, :update_only)
|
20
17
|
|
21
18
|
private
|