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
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
module Galena::Annotation
|
4
|
+
TARGET = CaTissue::SpecimenCollectionGroup::Pathology::RadicalProstatectomyPathologyAnnotation
|
5
|
+
|
6
|
+
describe 'migration' do
|
7
|
+
include_context 'a migration'
|
8
|
+
|
9
|
+
before(:all) do
|
10
|
+
@pth = migrate(:annotation, :target => TARGET).first
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should save the annotation' do
|
14
|
+
@pth.should_not be nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should set the comment' do
|
18
|
+
@pth.comment.should_not be nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should migrate the Gleason score' do
|
22
|
+
gls = @pth.gleason_score
|
23
|
+
gls.should_not be nil
|
24
|
+
gls.primary_pattern_score.should == '3'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should migrate the grades' do
|
28
|
+
grd = @pth.histologic_grades.first
|
29
|
+
grd.should_not be nil
|
30
|
+
grd.grade.should == '2'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'migration to database' do
|
35
|
+
include_context 'a migration'
|
36
|
+
|
37
|
+
before(:all) do
|
38
|
+
@pth = migrate_to_database(:annotation, :target => TARGET).first
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should save the annotation' do
|
42
|
+
@pth.should_not be nil
|
43
|
+
@pth.identifier.should_not be nil
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Galena::Filter
|
5
|
+
RESULTS = File.dirname(__FILE__) + '/../results'
|
6
|
+
|
7
|
+
# The rejects file.
|
8
|
+
REJECTS = RESULTS + '/filter/rejects.csv'
|
9
|
+
|
10
|
+
# The migration options.
|
11
|
+
OPTS = {:target => CaTissue::TissueSpecimen, :bad => REJECTS}
|
12
|
+
|
13
|
+
describe 'migration' do
|
14
|
+
include_context 'a migration'
|
15
|
+
|
16
|
+
before(:all) do
|
17
|
+
FileUtils.rm_rf RESULTS
|
18
|
+
@spcs = migrate(:filter, OPTS)
|
19
|
+
end
|
20
|
+
|
21
|
+
after(:all) do
|
22
|
+
FileUtils.rm_rf RESULTS
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should migrate the valid specimens' do
|
26
|
+
@spcs.size.should be 3
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should reject the invalid specimens' do
|
30
|
+
File.readlines(REJECTS).to_a.size.should be 1
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should infer the fixed specimen' do
|
34
|
+
@spcs.select { |spc| spc.specimen_type == 'Fixed Tissue' }.size.should be 1
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should infer the frozen specimens' do
|
38
|
+
@spcs.select { |spc| spc.specimen_type == 'Frozen Tissue' }.size.should be 2
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'specimen' do
|
42
|
+
subject { @spcs.first }
|
43
|
+
|
44
|
+
it 'should set the quantity' do
|
45
|
+
subject.initial_quantity.should == 3.4
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should reference a SCG with a SPN' do
|
49
|
+
scg = subject.specimen_collection_group
|
50
|
+
scg.should_not be nil
|
51
|
+
scg.surgical_pathology_number.should == '4001'
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should register a participant with the name given by the parsed initials' do
|
55
|
+
reg = subject.specimen_collection_group.registration
|
56
|
+
reg.should_not be nil
|
57
|
+
pnt = reg.participant
|
58
|
+
pnt.should_not be nil
|
59
|
+
pnt.first_name.should == 'U'
|
60
|
+
pnt.last_name.should == 'Z'
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should set the received date' do
|
64
|
+
rep = subject.received_event_parameters
|
65
|
+
rep.should_not be nil
|
66
|
+
rep.timestamp.year.should == 2007
|
67
|
+
rep.timestamp.month.should == 1
|
68
|
+
rep.timestamp.day.should == 4
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'migration to database' do
|
74
|
+
include_context 'a migration'
|
75
|
+
|
76
|
+
before(:all) do
|
77
|
+
FileUtils.rm_rf RESULTS
|
78
|
+
@spcs = migrate_to_database(:filter, OPTS)
|
79
|
+
end
|
80
|
+
|
81
|
+
after(:all) do
|
82
|
+
FileUtils.rm_rf RESULTS
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'should save the valid specimens' do
|
86
|
+
@spcs.size.should be 3
|
87
|
+
@spcs.each { |spc| spc.identifier.should_not be nil }
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should reject the invalid specimens' do
|
91
|
+
File.readlines(REJECTS).size.should be 1
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
module Galena::Frozen
|
4
|
+
describe 'migration' do
|
5
|
+
include_context 'a migration'
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@spc = migrate(:frozen, :target => CaTissue::TissueSpecimen).first
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should migrate the specimen' do
|
12
|
+
@spc.should_not be nil
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should set the specimen type to frozen' do
|
16
|
+
@spc.specimen_type.should == 'Frozen Tissue'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should store the specimen' do
|
20
|
+
pos = @spc.position
|
21
|
+
pos.should_not be nil
|
22
|
+
pos.holder.should_not be nil
|
23
|
+
pos.occupant.should be @spc
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'migration to database' do
|
28
|
+
include_context 'a migration'
|
29
|
+
|
30
|
+
before(:all) do
|
31
|
+
@spc = migrate_to_database(:frozen, :target => CaTissue::TissueSpecimen).first
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should save the specimen' do
|
35
|
+
@spc.should_not be nil
|
36
|
+
@spc.identifier.should_not be nil
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
module Galena::General
|
4
|
+
describe 'migration' do
|
5
|
+
include_context 'a migration'
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
# The general migration does not have defaults.
|
9
|
+
@spc = migrate(:general, :defaults => nil, :target => CaTissue::TissueSpecimen).first
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should migrate the specimen' do
|
13
|
+
@spc.should_not be nil
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should set the specimen type to frozen' do
|
17
|
+
@spc.specimen_type.should == 'Frozen Tissue'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should set the quantity' do
|
21
|
+
@spc.initial_quantity.should == 3.4
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should set the SPN' do
|
25
|
+
scg = @spc.specimen_collection_group
|
26
|
+
scg.should_not be nil
|
27
|
+
scg.surgical_pathology_number.should == '3001'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should set the PPI' do
|
31
|
+
reg = @spc.specimen_collection_group.registration
|
32
|
+
reg.should_not be nil
|
33
|
+
reg.protocol_participant_identifier.should == '301'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should set the participant name' do
|
37
|
+
pnt = @spc.specimen_collection_group.registration.participant
|
38
|
+
pnt.should_not be nil
|
39
|
+
pnt.first_name.should == 'Rufus'
|
40
|
+
pnt.last_name.should == 'Firefly'
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should set the MRN' do
|
44
|
+
pmi = @spc.specimen_collection_group.registration.participant.participant_medical_identifiers.first
|
45
|
+
pmi.should_not be nil
|
46
|
+
pmi.medical_record_number.should == '30001'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe 'migration to database' do
|
51
|
+
include_context 'a migration'
|
52
|
+
|
53
|
+
before(:all) do
|
54
|
+
@spc = migrate_to_database(:general, :defaults => nil, :target => CaTissue::TissueSpecimen).first
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should save the specimen' do
|
58
|
+
@spc.should_not be nil
|
59
|
+
@spc.identifier.should_not be nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
module Galena::Registration
|
4
|
+
describe 'migration' do
|
5
|
+
include_context 'a migration'
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@reg = migrate(:registration, :target => CaTissue::CollectionProtocolRegistration).first
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should migrate the registration' do
|
12
|
+
@reg.should_not be nil
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should set the PPI to the MRN' do
|
16
|
+
pnt = @reg.participant
|
17
|
+
pnt.should_not be nil
|
18
|
+
pmi = pnt.participant_medical_identifiers.first
|
19
|
+
pmi.should_not be nil
|
20
|
+
pmi.medical_record_number.should == '10001'
|
21
|
+
pmi.medical_record_number.should == @reg.protocol_participant_identifier
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'migration to database' do
|
26
|
+
include_context 'a migration'
|
27
|
+
|
28
|
+
before(:all) do
|
29
|
+
@reg = migrate_to_database(:registration, :target => CaTissue::CollectionProtocolRegistration).first
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should save the registration' do
|
33
|
+
@reg.should_not be nil
|
34
|
+
@reg.identifier.should_not be nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'jinx/helpers/inflector'
|
2
|
+
require 'jinx/migration/migratable'
|
3
|
+
require 'galena/seed'
|
4
|
+
|
5
|
+
module CaTissue
|
6
|
+
# Augment the classes below with sufficient content to pass the create mandatory attribute validation.
|
7
|
+
# This simulates an existing administrative object for testing purposes.
|
8
|
+
#
|
9
|
+
# This file is not placed in the specs support directory, since it is dynamically loaded as a shim.
|
10
|
+
shims CollectionProtocol, CollectionProtocolEvent, Site, StorageContainer, User
|
11
|
+
|
12
|
+
class CollectionProtocol
|
13
|
+
# Augments +Jinx::Migratable.migrate+ for the Galena example by adding the following defaults:
|
14
|
+
# * the CP principal_investigator defaults to the {Galena::Seed#protocol} PI
|
15
|
+
# * if the sites is empty, then the {Galena::Seed#tissue_bank} is added
|
16
|
+
# to the CP sites
|
17
|
+
#
|
18
|
+
# @param (see Jinx::Migratable#migrate)
|
19
|
+
def migrate(row, migrated)
|
20
|
+
super
|
21
|
+
self.title ||= Galena.administrative_objects.protocol.title
|
22
|
+
self.principal_investigator ||= Galena.administrative_objects.protocol.principal_investigator
|
23
|
+
sites << Galena.administrative_objects.tissue_bank if sites.empty?
|
24
|
+
coordinators << Galena.administrative_objects.tissue_bank.coordinator if coordinators.empty?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class CollectionProtocolEvent
|
29
|
+
# Augments +Jinx::Migratable.migrate+ for the example by adding the following defaults:
|
30
|
+
# * create a {CaTissue::TissueSpecimenRequirement}
|
31
|
+
# * copy the event point from {Galena::Seed}
|
32
|
+
#
|
33
|
+
# @param (see Jinx::Migratable#migrate)
|
34
|
+
def migrate(row, migrated)
|
35
|
+
super
|
36
|
+
cpe = Galena.administrative_objects.protocol.events.first
|
37
|
+
self.event_point ||= cpe.event_point
|
38
|
+
rqmt = cpe.requirements.first
|
39
|
+
CaTissue::TissueSpecimenRequirement.new(:collection_event => self, :specimen_type => rqmt.specimen_type)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class Site
|
44
|
+
# Augments +Jinx::Migratable.migrate+ for the example by merging the content of the
|
45
|
+
# {Galena::Seed} site which matches on this Site's name, if any.
|
46
|
+
#
|
47
|
+
# @param (see Jinx::Migratable#migrate)
|
48
|
+
def migrate(row, migrated)
|
49
|
+
super
|
50
|
+
# Match the site by name. Account for uniquification by a partial match, e.g.
|
51
|
+
# 'Galena_Hospital_41893443' matches the site named 'Galena Hospital'.
|
52
|
+
tmpl = TEMPLATES.detect { |site| name[site.name.gsub('_', ' ')] }
|
53
|
+
# merge the default mandatory attribute values
|
54
|
+
if tmpl then merge(tmpl, mandatory_attributes) end
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
TEMPLATES ||= [Galena.administrative_objects.hospital, Galena.administrative_objects.tissue_bank]
|
60
|
+
end
|
61
|
+
|
62
|
+
class StorageContainer
|
63
|
+
# Augments +Jinx::Migratable.migrate+ for the example by setting the
|
64
|
+
# the container site and type to the {Galena::Seed}
|
65
|
+
# box site and type, resp.
|
66
|
+
#
|
67
|
+
# @param (see Jinx::Migratable#migrate)
|
68
|
+
def migrate(row, migrated)
|
69
|
+
super
|
70
|
+
self.site ||= Galena.administrative_objects.tissue_bank
|
71
|
+
self.storage_type ||= Galena.administrative_objects.box_type
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class SpecimenEventParameters
|
76
|
+
# Fills in the event parameters user details.
|
77
|
+
#
|
78
|
+
# @param (see Jinx::Migratable#migrate)
|
79
|
+
def migrate(row, migrated)
|
80
|
+
user.migrate(row, migrated) if user
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class User
|
85
|
+
# Augments +Jinx::Migratable.migrate+ for the example as follows:
|
86
|
+
# * infer the first and last name from the email address
|
87
|
+
# * copy the address and organizations from the tissue bank coordinator
|
88
|
+
#
|
89
|
+
# @param (see Jinx::Migratable#migrate)
|
90
|
+
def migrate(row, migrated)
|
91
|
+
super
|
92
|
+
# Invent the mandatory name fields based on the login, if necessary.
|
93
|
+
if login_name then
|
94
|
+
last, first = login_name[/[^@]+/].split('.').reverse.map { |s| s.capitalize }
|
95
|
+
first ||= 'Oscar'
|
96
|
+
self.first_name ||= first
|
97
|
+
self.last_name ||= last
|
98
|
+
end
|
99
|
+
# the coordinator serves as the User content template
|
100
|
+
coord = Galena.administrative_objects.hospital.coordinator
|
101
|
+
# deep copy of the address
|
102
|
+
self.address ||= coord.address.copy
|
103
|
+
# shallow copy of the mandatory references
|
104
|
+
merge(coord, [:cancer_research_group, :department, :institution])
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
module Galena::Simple
|
4
|
+
describe 'migration' do
|
5
|
+
include_context 'a migration'
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@spc = migrate(:simple, :target => CaTissue::TissueSpecimen).first
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should save the specimen' do
|
12
|
+
@spc.should_not be nil
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should set the quantity' do
|
16
|
+
@spc.initial_quantity.should == 3.0
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should reference a SCG which includes the specimen' do
|
20
|
+
scg = @spc.specimen_collection_group
|
21
|
+
scg.should_not be nil
|
22
|
+
scg.specimens.size.should be 1
|
23
|
+
scg.specimens.first.should be @spc
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should register a participant with last name the same as the MRN' do
|
27
|
+
reg = @spc.specimen_collection_group.registration
|
28
|
+
reg.should_not be nil
|
29
|
+
pnt = reg.participant
|
30
|
+
pnt.should_not be nil
|
31
|
+
pnt.participant_medical_identifiers.size.should be 1
|
32
|
+
pmi = pnt.participant_medical_identifiers.first
|
33
|
+
pmi.medical_record_number.should == '20001'
|
34
|
+
pnt.last_name.should == pmi.medical_record_number
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should set the received date' do
|
38
|
+
rep = @spc.received_event_parameters
|
39
|
+
rep.should_not be nil
|
40
|
+
rep.timestamp.year.should == 2007
|
41
|
+
rep.timestamp.month.should == 12
|
42
|
+
rep.timestamp.day.should == 4
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'migration to database' do
|
47
|
+
include_context 'a migration'
|
48
|
+
|
49
|
+
before(:all) do
|
50
|
+
@spc = migrate_to_database(:simple, :target => CaTissue::TissueSpecimen).first
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should save the specimen' do
|
54
|
+
@spc.should_not be nil
|
55
|
+
@spc.identifier.should_not be nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|