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,29 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_case')
|
2
|
-
|
3
|
-
module Galena
|
4
|
-
module Tissue
|
5
|
-
class AnnotationTest < Test::Unit::TestCase
|
6
|
-
include MigrationTestCase
|
7
|
-
|
8
|
-
def test_target
|
9
|
-
verify_target(:annotation, :target => CaTissue::SpecimenCollectionGroup) do |scg|
|
10
|
-
pth = scg.pathology.first
|
11
|
-
assert_not_nil(pth, "Missing #{scg} pathology annotation proxy")
|
12
|
-
pst = pth.radical_prostatectomy_pathology_annotations.first
|
13
|
-
assert_not_nil(pst, "Missing #{scg} prostate annotation")
|
14
|
-
assert_not_nil(pst.comment, "Missing #{pst} comments")
|
15
|
-
gls = pst.gleason_score
|
16
|
-
assert_not_nil(pst, "Missing #{pst} gleason score")
|
17
|
-
assert_equal('3', gls.primary_pattern_score, "Gleason score incorrect")
|
18
|
-
grd = pst.histologic_grades.first
|
19
|
-
assert_not_nil(grd, "Missing #{pst} grade")
|
20
|
-
assert_equal('2', grd.grade, "Grade incorrect")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_save
|
25
|
-
verify_save(:annotation, :target => CaTissue::SpecimenCollectionGroup)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_case')
|
2
|
-
|
3
|
-
module Galena
|
4
|
-
module Tissue
|
5
|
-
class FilterMigrationTest < Test::Unit::TestCase
|
6
|
-
include Galena::Tissue::MigrationTestCase
|
7
|
-
|
8
|
-
def test_filter
|
9
|
-
verify_target(:filter, :bad => BAD_FILE) do |spc|
|
10
|
-
assert_not_nil(spc.initial_quantity, "Missing quantity")
|
11
|
-
scg = spc.specimen_collection_group
|
12
|
-
assert_not_nil(scg, "Missing SCG")
|
13
|
-
pnt = scg.registration.participant
|
14
|
-
assert_not_nil(pnt, "Missing Participant")
|
15
|
-
assert_not_nil(pnt.first_name, "Missing first name")
|
16
|
-
assert_not_nil(pnt.last_name, "Missing last name")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_save
|
21
|
-
verify_save(:filter, :bad => BAD_FILE)
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
BAD_FILE = 'test/results/examples/galena/bad.csv'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_case')
|
2
|
-
require 'galena/tissue/seed/defaults'
|
3
|
-
|
4
|
-
module Galena
|
5
|
-
module Tissue
|
6
|
-
class FrozenMigrationTest < Test::Unit::TestCase
|
7
|
-
include MigrationTestCase
|
8
|
-
|
9
|
-
# Makes the {Galena::Defaults#freezer_type} container type hierarchy, if necessary.
|
10
|
-
def setup
|
11
|
-
super
|
12
|
-
defaults.freezer_type.find(:create)
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_target
|
16
|
-
verify_target(:frozen) do |spc|
|
17
|
-
assert_equal('Frozen Tissue', spc.specimen_type, "#{spc} type incorrect")
|
18
|
-
pos = spc.position
|
19
|
-
assert_not_nil(pos, "#{spc} missing position")
|
20
|
-
assert_not_nil(pos.holder, "#{pos} missing storage container")
|
21
|
-
assert_same(spc, pos.occupant,"#{pos} occupant incorrect")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_save
|
26
|
-
# rename the target box
|
27
|
-
box = CaTissue::StorageContainer.new(:name => 'Galena Box 7')
|
28
|
-
if box.find then
|
29
|
-
box.name = box.name.uniquify
|
30
|
-
box.save
|
31
|
-
end
|
32
|
-
verify_save(:frozen)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_case')
|
2
|
-
|
3
|
-
module Galena
|
4
|
-
module Tissue
|
5
|
-
class GeneralMigrationTest < Test::Unit::TestCase
|
6
|
-
include Galena::Tissue::MigrationTestCase
|
7
|
-
|
8
|
-
def test_target
|
9
|
-
verify_target(:general) do |spc|
|
10
|
-
assert_not_nil(spc.initial_quantity, "Missing quantity")
|
11
|
-
scg = spc.specimen_collection_group
|
12
|
-
assert_not_nil(scg, "Missing SCG")
|
13
|
-
pnt = scg.registration.participant
|
14
|
-
assert_not_nil(pnt, "Missing Participant")
|
15
|
-
pmi = pnt.participant_medical_identifiers.first
|
16
|
-
assert_not_nil(pmi, "Missing PMI")
|
17
|
-
mrn = pmi.medical_record_number
|
18
|
-
assert_not_nil(mrn, "Missing MRN")
|
19
|
-
rep = scg.received_event_parameters
|
20
|
-
assert_not_nil(rep, "Missing REP")
|
21
|
-
assert_not_nil(rep.timestamp, "Missing received date")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_save
|
26
|
-
# Clear a space for the specimen
|
27
|
-
box = CaTissue::StorageContainer.new(:name => 'Galena Box 1')
|
28
|
-
if box.find then
|
29
|
-
box.name = box.name.uniquify
|
30
|
-
box.save
|
31
|
-
end
|
32
|
-
|
33
|
-
# Make the surgeon user, if necessary, by copying the required attributes from the coordinator.
|
34
|
-
crd = defaults.tissue_bank.coordinator
|
35
|
-
srg = defaults.tissue_bank.coordinator.copy(:cancer_research_group, :department, :institution)
|
36
|
-
srg.address = crd.address.copy
|
37
|
-
srg.email_address = 'serge.on@galena.edu'
|
38
|
-
srg.first_name = 'Serge'
|
39
|
-
srg.last_name = 'On'
|
40
|
-
srg.find(:create)
|
41
|
-
|
42
|
-
# migrate the Specimen input record
|
43
|
-
verify_save(:general) do |spc|
|
44
|
-
logger.debug { "Verifying saved #{spc}..." }
|
45
|
-
assert_equal('Frozen Tissue', spc.specimen_type, "#{spc} specimen type incorrect")
|
46
|
-
scg = spc.specimen_collection_group
|
47
|
-
assert_not_nil(scg, "#{spc} missing SCG")
|
48
|
-
assert_equal('Complete', scg.collection_status, "#{scg} collection status incorrect")
|
49
|
-
spcs = scg.specimens
|
50
|
-
assert_equal(1, spcs.size, "#{scg} specimen count incorrect")
|
51
|
-
assert_same(spc, spcs.first, "#{scg} specimen incorrect")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_case')
|
2
|
-
|
3
|
-
module Galena
|
4
|
-
module Tissue
|
5
|
-
class ParticipantMigrationTest < Test::Unit::TestCase
|
6
|
-
include MigrationTestCase
|
7
|
-
|
8
|
-
def test_target
|
9
|
-
verify_target(:participant, :target => CaTissue::Participant)
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_save
|
13
|
-
clear
|
14
|
-
# test the create
|
15
|
-
verify_save(:participant, :target => CaTissue::Participant)
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_create
|
19
|
-
clear
|
20
|
-
# make the test participant
|
21
|
-
pnt = CaTissue::Participant.new(:social_security_number => '333-66-9999')
|
22
|
-
pnt.create
|
23
|
-
migrate_to_database(:participant, :target => CaTissue::Participant, :create=>true)
|
24
|
-
# Verify that the name was not updated.
|
25
|
-
pnt.identifier = nil
|
26
|
-
pnt.find
|
27
|
-
assert_nil(pnt.last_name, "Existing participant was updated despite the migration :create flag")
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_create_with_alternate_id
|
31
|
-
clear
|
32
|
-
# make the test participant
|
33
|
-
pnt = CaTissue::Participant.new(:first_name => 'Rufus', :last_name => 'Firefly')
|
34
|
-
# move aside duplicates
|
35
|
-
pnt.query.each do |dup|
|
36
|
-
dup.last_name = dup.last_name.uniquify
|
37
|
-
dup.save
|
38
|
-
end
|
39
|
-
pnt.create
|
40
|
-
migrate_to_database(:participant, :target => CaTissue::Participant, :shims => [ALT_ID_SHIM], :create=>true)
|
41
|
-
# Verify that the SSN was not updated.
|
42
|
-
pnt.identifier = nil
|
43
|
-
pnt.find
|
44
|
-
assert_nil(pnt.social_security_number, "Existing participant with alternate key was updated despite the migration :create flag")
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
ALT_ID_SHIM = 'test/fixtures/lib/examples/galena/migration/alt_key_shims.rb'
|
50
|
-
|
51
|
-
def clear
|
52
|
-
# push aside the existing test participant
|
53
|
-
pnt = CaTissue::Participant.new(:social_security_number => '333-66-9999')
|
54
|
-
if pnt.find then
|
55
|
-
pnt.social_security_number = nil
|
56
|
-
pnt.update
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_case')
|
2
|
-
|
3
|
-
module Galena
|
4
|
-
module Tissue
|
5
|
-
class RegistrationTest < Test::Unit::TestCase
|
6
|
-
include MigrationTestCase
|
7
|
-
|
8
|
-
def test_target
|
9
|
-
verify_target(:registration, :target => CaTissue::SpecimenCollectionGroup)
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_save
|
13
|
-
verify_save(:registration, :target => CaTissue::SpecimenCollectionGroup)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,119 +0,0 @@
|
|
1
|
-
require 'caruby/util/inflector'
|
2
|
-
require 'caruby/migration/migratable'
|
3
|
-
require 'galena/tissue/seed/defaults'
|
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
|
-
shims CollectionProtocol, CollectionProtocolEvent, Site, StorageContainer, User
|
9
|
-
|
10
|
-
class CollectionProtocol
|
11
|
-
# Augments {CaRuby::Migratable#migrate} for the Galena example by adding the following defaults:
|
12
|
-
# * the CP principal_investigator defaults to the {Galena::Seed::Defaults#protocol} PI
|
13
|
-
# * if the sites is empty, then the {Galena::Seed::Defaults#tissue_bank} is added
|
14
|
-
# to the CP sites
|
15
|
-
#
|
16
|
-
# @param (see CaRuby::Migratable#migrate)
|
17
|
-
def migrate(row, migrated)
|
18
|
-
super
|
19
|
-
self.title ||= migration_default_title(migrated)
|
20
|
-
self.principal_investigator ||= Galena::Seed.defaults.protocol.principal_investigator
|
21
|
-
sites << Galena::Seed.defaults.tissue_bank if sites.empty?
|
22
|
-
coordinators << Galena::Seed.defaults.tissue_bank.coordinator if coordinators.empty?
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
# @param (see #migrate)
|
28
|
-
# @return [String, nil] the short title of the {Galena::Seed::Defaults} protocol which
|
29
|
-
# matches this protocol's event, or nil if no match
|
30
|
-
def migration_default_title(migrated)
|
31
|
-
cpe = migrated.detect { |obj| CaTissue::CollectionProtocolEvent === obj } || return
|
32
|
-
pcl = Galena::Seed.defaults.protocols.detect { |p| p.events.first.label == cpe.label } || return
|
33
|
-
pcl.title
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class CollectionProtocolEvent
|
38
|
-
# Augments {CaRuby::Migratable#migrate} for the example by adding the following defaults:
|
39
|
-
# * create a {CaTissue::TissueSpecimenRequirement}
|
40
|
-
# * copy the event point from the matching {Galena::Seed::Defaults} CPE, if any
|
41
|
-
#
|
42
|
-
# @param (see CaRuby::Migratable#migrate)
|
43
|
-
def migrate(row, migrated)
|
44
|
-
super
|
45
|
-
match = Galena::Seed.defaults.protocols.detect_value do |pcl|
|
46
|
-
cpe = pcl.events.first
|
47
|
-
cpe if cpe.label == label
|
48
|
-
end
|
49
|
-
if match then
|
50
|
-
self.event_point ||= match.event_point
|
51
|
-
rqmt = match.requirements.first
|
52
|
-
CaTissue::TissueSpecimenRequirement.new(:collection_event => self, :specimen_type => rqmt.specimen_type)
|
53
|
-
else
|
54
|
-
CaTissue::TissueSpecimenRequirement.new(:collection_event => self)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class Site
|
60
|
-
# Augments {CaRuby::Migratable#migrate} for the example by merging the content of the
|
61
|
-
# {Galena::Seed::Defaults} site which matches on this Site's name, if any.
|
62
|
-
#
|
63
|
-
# @param (see CaRuby::Migratable#migrate)
|
64
|
-
def migrate(row, migrated)
|
65
|
-
super
|
66
|
-
# Match the site by name. Account for uniquification by a partial match, e.g.
|
67
|
-
# 'Galena_Hospital_41893443' matches the site named 'Galena Hospital'.
|
68
|
-
tmpl = TEMPLATES.detect { |site| name[site.name.gsub('_', ' ')] }
|
69
|
-
# merge the default mandatory attribute values
|
70
|
-
if tmpl then merge(tmpl, mandatory_attributes) end
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
|
75
|
-
TEMPLATES = [Galena::Seed.defaults.hospital, Galena::Seed.defaults.tissue_bank]
|
76
|
-
end
|
77
|
-
|
78
|
-
class StorageContainer
|
79
|
-
# Augments {CaRuby::Migratable#migrate} for the example by setting the
|
80
|
-
# the container site and type to the {Galena::Seed::Defaults}
|
81
|
-
# box site and type, resp.
|
82
|
-
#
|
83
|
-
# @param (see CaRuby::Migratable#migrate)
|
84
|
-
def migrate(row, migrated)
|
85
|
-
super
|
86
|
-
self.site ||= Galena::Seed.defaults.tissue_bank
|
87
|
-
self.storage_type ||= Galena::Seed.defaults.box_type
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
class User
|
92
|
-
# Augments {CaRuby::Migratable#migrate} for the example as follows:
|
93
|
-
# * infer the first and last name from the email address
|
94
|
-
# * copy the address and organizations from the tissue bank coordinator
|
95
|
-
#
|
96
|
-
# @param (see CaRuby::Migratable#migrate)
|
97
|
-
def migrate(row, migrated)
|
98
|
-
super
|
99
|
-
# invent the mandatory name fields based on the email address, if necessary
|
100
|
-
if email_address then
|
101
|
-
n1, n2 = email_address[/[^@]+/].split('.')
|
102
|
-
if n2 then
|
103
|
-
first, last = n1, n2
|
104
|
-
else
|
105
|
-
first = 'Oscar'
|
106
|
-
last = n1.capitalize
|
107
|
-
end
|
108
|
-
self.first_name = n1.capitalize
|
109
|
-
self.last_name = n2.capitalize
|
110
|
-
end
|
111
|
-
# the coordinator serves as the User content template
|
112
|
-
coord = Galena::Seed.defaults.hospital.coordinator
|
113
|
-
# deep copy of the address
|
114
|
-
self.address = coord.address.copy
|
115
|
-
# shallow copy of the mandatory references
|
116
|
-
merge(coord, [:cancer_research_group, :department, :institution])
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_case')
|
2
|
-
|
3
|
-
module Galena
|
4
|
-
module Tissue
|
5
|
-
class SimpleTest < Test::Unit::TestCase
|
6
|
-
include MigrationTestCase
|
7
|
-
|
8
|
-
def test_target
|
9
|
-
verify_target(:simple) do |spc|
|
10
|
-
assert_not_nil(spc.initial_quantity, "Missing quantity")
|
11
|
-
scg = spc.specimen_collection_group
|
12
|
-
assert_not_nil(scg, "Missing SCG")
|
13
|
-
pnt = scg.registration.participant
|
14
|
-
assert_not_nil(pnt, "Missing Participant")
|
15
|
-
pmi = pnt.participant_medical_identifiers.first
|
16
|
-
assert_not_nil(pmi, "Missing PMI")
|
17
|
-
mrn = pmi.medical_record_number
|
18
|
-
assert_not_nil(mrn, "Missing MRN")
|
19
|
-
rep = spc.received_event_parameters
|
20
|
-
assert_not_nil(rep, "Missing REP")
|
21
|
-
assert_not_nil(rep.timestamp, "Missing received date")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_save
|
26
|
-
verify_save(:simple)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
$:.unshift 'examples/galena/lib'
|
2
|
-
|
3
|
-
require 'test/lib/catissue/migration/test_case'
|
4
|
-
require 'galena/tissue/seed/defaults'
|
5
|
-
|
6
|
-
# Inject migrate methods that simulate administrative setup.
|
7
|
-
require File.join(File.dirname(__FILE__), 'seedify')
|
8
|
-
|
9
|
-
module Galena
|
10
|
-
module Tissue
|
11
|
-
# Tests the Galena example migration.
|
12
|
-
module MigrationTestCase
|
13
|
-
include CaTissue::MigrationTestCase
|
14
|
-
|
15
|
-
# The default migration input data directory.
|
16
|
-
FIXTURES = 'examples/galena/data'
|
17
|
-
|
18
|
-
# The default migration shims directory.
|
19
|
-
SHIMS = 'examples/galena/lib/galena/tissue/migration'
|
20
|
-
|
21
|
-
# The dfault migration configuration directory.
|
22
|
-
CONFIGS = 'examples/galena/conf/migration'
|
23
|
-
|
24
|
-
# The migration options are obtained from the file named _fixture_+_migration.yaml+
|
25
|
-
# in the {CONFIGS} directory.
|
26
|
-
#
|
27
|
-
# @param [String, nil] the fixtures directory (default {FIXTURES})
|
28
|
-
def setup(fixtures=FIXTURES)
|
29
|
-
super(fixtures)
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
# @return [Galena::Seed::Defaults] the {Galena::Seed.defaults}
|
35
|
-
def defaults
|
36
|
-
@defaults ||= Galena::Seed.defaults
|
37
|
-
end
|
38
|
-
|
39
|
-
# Adds the +:target+, +:mapping+ and +:shims+ to the options and delegates
|
40
|
-
# to the superclass.
|
41
|
-
#
|
42
|
-
# @see {CaTissue::MigrationTestCase#create_migrator}
|
43
|
-
def create_migrator(fixture, opts={})
|
44
|
-
opts[:target] ||= CaTissue::TissueSpecimen
|
45
|
-
opts[:mapping] ||= File.join(CONFIGS, "#{fixture}_fields.yaml")
|
46
|
-
unless opts.has_key?(:defaults) then
|
47
|
-
f = File.join(CONFIGS, "#{fixture}_defaults.yaml")
|
48
|
-
if File.exists?(f) then opts[:defaults] = f end
|
49
|
-
end
|
50
|
-
unless opts.has_key?(:filters) then
|
51
|
-
f = File.join(CONFIGS, "#{fixture}_values.yaml")
|
52
|
-
if File.exists?(f) then opts[:filters] = f end
|
53
|
-
end
|
54
|
-
unless opts.has_key?(:shims) then
|
55
|
-
f = File.join(SHIMS, "#{fixture}_shims.rb")
|
56
|
-
if File.exists?(f) then
|
57
|
-
opts[:shims] = [f]
|
58
|
-
end
|
59
|
-
end
|
60
|
-
mgtr = super
|
61
|
-
if opts[:unique] then
|
62
|
-
defaults.protocols.each do |pcl|
|
63
|
-
pcl.uniquify
|
64
|
-
pcl.events.each { |cpe| cpe.uniquify }
|
65
|
-
end
|
66
|
-
end
|
67
|
-
mgtr
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|