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,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class CollectionProtocolTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -22,7 +22,7 @@ class CollectionProtocolTest < Test::Unit::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_alias
|
25
|
-
assert(CaTissue::CollectionProtocol.method_defined?(:events), "
|
25
|
+
assert(CaTissue::CollectionProtocol.method_defined?(:events), "Protocol alias not recogized: events")
|
26
26
|
end
|
27
27
|
|
28
28
|
# Tests the work-around for caTissue bug - CollectionProtocol and CollectionProtocolEvent are equal in caTissue 1.1.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class SpecimenPositionTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -22,7 +22,10 @@ class SpecimenPositionTest < Test::Unit::TestCase
|
|
22
22
|
assert_same(@pos, @pos.occupant.position, "Container position not set")
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
# Passes in caTissue 1.1.2, but fails in caTissue 1.2, which does not allow updating
|
26
|
+
# a container position.
|
27
|
+
# TODO - why is a position updated?
|
28
|
+
# def test_save
|
29
|
+
# verify_save(@pos)
|
30
|
+
# end
|
28
31
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require '
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
|
+
require 'jinx/helpers/uniquifier'
|
3
3
|
|
4
4
|
class CaTissueDepartmentTest < Test::Unit::TestCase
|
5
5
|
include CaTissue::TestCase
|
@@ -18,4 +18,4 @@ class CaTissueDepartmentTest < Test::Unit::TestCase
|
|
18
18
|
def test_save
|
19
19
|
verify_save(department)
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class ExternalIdentifierTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -9,6 +9,10 @@ class ExternalIdentifierTest < Test::Unit::TestCase
|
|
9
9
|
@eid = CaTissue::ExternalIdentifier.new(:name => 'Test Name'.uniquify, :value => 'Test Value'.uniquify, :specimen => spc)
|
10
10
|
end
|
11
11
|
|
12
|
+
def test_defaults
|
13
|
+
verify_defaults(@eid)
|
14
|
+
end
|
15
|
+
|
12
16
|
# Exercises the CaTissue::Specimen external_identifiers logical dependency work-around.
|
13
17
|
def test_save
|
14
18
|
# create the EID
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class LocationTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -21,10 +21,10 @@ class LocationTest < Test::Unit::TestCase
|
|
21
21
|
assert_not_nil(successor, "Successor location not created")
|
22
22
|
assert_not_same(@loc, successor, "Location same as successor")
|
23
23
|
assert_same(@loc.container, successor.container, "Location container differs from successor container")
|
24
|
-
assert_not_nil(successor.row, "Successor row not set")
|
25
24
|
assert_not_nil(successor.column, "Successor column not set")
|
26
|
-
|
27
|
-
assert_equal(
|
25
|
+
assert_not_nil(successor.row, "Successor row not set")
|
26
|
+
assert_equal(0, successor.column, "Successor row incorrect")
|
27
|
+
assert_equal(1, successor.row, "Successor column incorrect")
|
28
28
|
assert_nil(successor.succ, "Location out of bounds")
|
29
29
|
end
|
30
30
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class ParticipantMedicalIdentifierTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -15,12 +15,12 @@ class ParticipantMedicalIdentifierTest < Test::Unit::TestCase
|
|
15
15
|
|
16
16
|
# Tests creating and fetching a participant.
|
17
17
|
def test_save
|
18
|
-
@pmi.medical_record_number = Uniquifier.qualifier
|
18
|
+
@pmi.medical_record_number = Jinx::Uniquifier.qualifier
|
19
19
|
@pmi.site = defaults.tissue_bank
|
20
20
|
@pmi.participant = CaTissue::Participant.new(:name => 'Test Participant'.uniquify)
|
21
21
|
verify_save(@pmi)
|
22
22
|
# update the PMI
|
23
|
-
@pmi.medical_record_number = Uniquifier.qualifier
|
23
|
+
@pmi.medical_record_number = Jinx::Uniquifier.qualifier
|
24
24
|
verify_save(@pmi)
|
25
25
|
end
|
26
26
|
end
|
@@ -1,7 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require '
|
3
|
-
|
4
|
-
require 'json'
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
|
+
require 'jinx/helpers/uniquifier'
|
5
3
|
|
6
4
|
class ParticipantTest < Test::Unit::TestCase
|
7
5
|
include CaTissue::TestCase
|
@@ -27,11 +25,21 @@ class ParticipantTest < Test::Unit::TestCase
|
|
27
25
|
def test_key
|
28
26
|
mrn = '5555'
|
29
27
|
pmi = @pnt.add_mrn(defaults.tissue_bank, '5555')
|
30
|
-
assert_equal(pmi, @pnt.key, 'Person key is not the MRN')
|
28
|
+
assert_equal(pmi.key, @pnt.key, 'Person key is not the MRN')
|
31
29
|
# add the preferred SSN key
|
32
30
|
expected = @pnt.social_security_number = '555-55-5555'
|
33
31
|
assert_equal(expected, @pnt.key, 'Person key is not the SSN')
|
34
32
|
end
|
33
|
+
|
34
|
+
def test_phantom_mrn_filter
|
35
|
+
pnt = defaults.registration.participant
|
36
|
+
pmis = pnt.participant_medical_identifiers
|
37
|
+
pmi = pmis.first
|
38
|
+
pmi.medical_record_number = nil
|
39
|
+
CaTissue::Participant.remove_phantom_medical_identifier(pmis)
|
40
|
+
assert_nil(pmi.participant, "#{@pmi} participant not unset")
|
41
|
+
assert_nil(pmis.first, "#{@pmi} not cleared from #{pnt}")
|
42
|
+
end
|
35
43
|
|
36
44
|
def test_treatment_annotation
|
37
45
|
trt = CaTissue::Participant::Clinical::TreatmentAnnotation.new
|
@@ -50,6 +58,8 @@ class ParticipantTest < Test::Unit::TestCase
|
|
50
58
|
|
51
59
|
def test_exposure_annotation
|
52
60
|
exp = CaTissue::Participant::Clinical::EnvironmentalExposuresHealthAnnotation.new
|
61
|
+
assert(exp.class.primary?, "#{exp.class} is not primary.")
|
62
|
+
assert(exp.respond_to?(:participant), "Proxy reference attribute was not added to #{exp.class}")
|
53
63
|
exp.merge_attributes(:years_agent_free => 2, :participant => @pnt)
|
54
64
|
cln = @pnt.clinical.first
|
55
65
|
assert_not_nil(cln, "Clinical annotation not added to participant")
|
@@ -82,18 +92,6 @@ class ParticipantTest < Test::Unit::TestCase
|
|
82
92
|
assert_same(@pnt, lab.hook, "Lab proxy hook not set")
|
83
93
|
end
|
84
94
|
|
85
|
-
def test_radiation_annotation
|
86
|
-
if CaTissue::Participant::Clinical::RadiationTherapy != CaTissue::Participant::Clinical::RadRXAnnotation then
|
87
|
-
assert_raises(CaTissue::AnnotationError, "RadiationTherapy is not deprecated.") { CaTissue::Participant::Clinical::RadiationTherapy.new}
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_chemotherapy_annotation
|
92
|
-
if CaTissue::Participant::Clinical::Chemotherapy != CaTissue::Participant::Clinical::ChemoRXAnnotation then
|
93
|
-
assert_raises(CaTissue::AnnotationError, "Chemotherapy is not deprecated.") { CaTissue::Participant::Clinical::Chemotherapy.new}
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
95
|
def test_json
|
98
96
|
CaTissue::Race.new(:participant => @pnt, :race_name => 'White')
|
99
97
|
dup = JSON[@pnt.to_json]
|
@@ -105,9 +103,24 @@ class ParticipantTest < Test::Unit::TestCase
|
|
105
103
|
|
106
104
|
## DATABASE TEST CASES
|
107
105
|
|
108
|
-
|
109
|
-
|
106
|
+
# Tests creating a participant.
|
107
|
+
def test_save
|
108
|
+
verify_save(@pnt)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Exercises the phantom PMI fetch filter on a patient with an MRN.
|
112
|
+
def test_find_phantom_mrn_filter
|
113
|
+
# add an MRN
|
114
|
+
site = defaults.registration.participant.participant_medical_identifiers.first.site
|
115
|
+
@pnt.add_mrn(site, Jinx::Uniquifier.qualifier)
|
116
|
+
# save the patient
|
110
117
|
verify_save(@pnt)
|
118
|
+
# fetch the saved patient
|
119
|
+
svd = @pnt.copy(:identifier)
|
120
|
+
svd.find
|
121
|
+
# the phantom PMI should be removed
|
122
|
+
phantom = @pnt.participant_medical_identifiers.detect { |pmi| pmi.medical_record_number.nil? }
|
123
|
+
assert_nil(phantom, "#{svd} phantom PMI #{phantom} was not filtered out")
|
111
124
|
end
|
112
125
|
|
113
126
|
def test_save_alcohol_annotation
|
@@ -182,4 +195,4 @@ class ParticipantTest < Test::Unit::TestCase
|
|
182
195
|
exam.merge_attributes(:name_of_procedure => 'Prostatectomy', :clinical_diagnosis => 'Malignant melanoma - NOS', :participant => @pnt)
|
183
196
|
verify_save(exam)
|
184
197
|
end
|
185
|
-
end
|
198
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
|
+
require 'jinx/helpers/validation'
|
3
|
+
|
4
|
+
class ReceivedEventParametersTest < Test::Unit::TestCase
|
5
|
+
include CaTissue::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
super
|
9
|
+
@scg = defaults.specimen_collection_group
|
10
|
+
@spc = defaults.specimen
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_exclusive_owner_validation
|
14
|
+
@spc.collect(:receiver => @scg.receiver)
|
15
|
+
rep = @spc.received_event_parameters
|
16
|
+
assert_nothing_raised("Owner conflict unexpectedly disallowed") { rep.specimen_collection_group = @scg }
|
17
|
+
assert_raises(Jinx::ValidationError, "Owner conflict allowed") { rep.validate }
|
18
|
+
end
|
19
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class SiteTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -26,4 +26,4 @@ class SiteTest < Test::Unit::TestCase
|
|
26
26
|
assert_equal(zip_code, @site.address.zip_code.to_i, "Updated zip code incorrect.")
|
27
27
|
assert_equal(identifier, @site.address.identifier, "Address replaced rather than updated.")
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require '
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
|
+
require 'jinx/helpers/uniquifier'
|
3
3
|
|
4
4
|
class SpecimenArrayTest < Test::Unit::TestCase
|
5
5
|
include CaTissue::TestCase
|
@@ -34,4 +34,4 @@ class SpecimenArrayTest < Test::Unit::TestCase
|
|
34
34
|
# def test_save
|
35
35
|
# verify_save(@array)
|
36
36
|
# end
|
37
|
-
end
|
37
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require '
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
|
+
require 'jinx/helpers/uniquifier'
|
3
3
|
|
4
4
|
class SpecimenArrayTypeTest < Test::Unit::TestCase
|
5
5
|
include CaTissue::TestCase
|
@@ -7,7 +7,7 @@ class SpecimenArrayTypeTest < Test::Unit::TestCase
|
|
7
7
|
def setup
|
8
8
|
super
|
9
9
|
@type = CaTissue::SpecimenArrayType.new(:name => 'SpecimenArrayType'.uniquify,
|
10
|
-
:specimen_class => 'Frozen Tissue', :columns => 5,
|
10
|
+
:specimen_class => 'Frozen Tissue', :columns => 5, :rows => 5)
|
11
11
|
@type.specimen_types << 'Tissue'
|
12
12
|
end
|
13
13
|
|
@@ -15,8 +15,8 @@ class SpecimenArrayTypeTest < Test::Unit::TestCase
|
|
15
15
|
verify_defaults(@type)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
array = @type.
|
18
|
+
def test_new_container
|
19
|
+
array = @type.new_container
|
20
20
|
assert_same(CaTissue::SpecimenArray, array.class, "Created instance class incorrect")
|
21
21
|
assert_same(@type, array.container_type, "Created array type incorrect")
|
22
22
|
end
|
@@ -24,4 +24,4 @@ class SpecimenArrayTypeTest < Test::Unit::TestCase
|
|
24
24
|
def test_save
|
25
25
|
verify_save(@type)
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class SpecimenCollectionGroupTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -8,8 +8,8 @@ class SpecimenCollectionGroupTest < Test::Unit::TestCase
|
|
8
8
|
@scg = defaults.specimen_collection_group
|
9
9
|
end
|
10
10
|
|
11
|
-
# This test case exercises the
|
12
|
-
def
|
11
|
+
# This test case exercises the secondary_key method for a domain class with a secondary key.
|
12
|
+
def test_key
|
13
13
|
@scg.name = 'Test SCG'
|
14
14
|
assert_equal(@scg.name, @scg.key, 'Key incorrect')
|
15
15
|
end
|
@@ -32,6 +32,16 @@ class SpecimenCollectionGroupTest < Test::Unit::TestCase
|
|
32
32
|
@scg.add_defaults
|
33
33
|
assert_equal(collection_event, @scg.collection_event, 'Collection event not set to default')
|
34
34
|
end
|
35
|
+
|
36
|
+
def test_haemotology_annotation
|
37
|
+
pth = CaTissue::SpecimenCollectionGroup::Pathology::BaseHaematologyPathologyAnnotation.new(:specimen_collection_group => @scg)
|
38
|
+
hst = CaTissue::SpecimenCollectionGroup::Pathology::HistologicType.new(:base_pathology_annotation => pth, :histologic_type => 'Adenocarcinoma - NOS')
|
39
|
+
fnd = CaTissue::SpecimenCollectionGroup::Pathology::AdditionalFinding.new(:base_pathology_annotation => pth, :pathologic_finding => 'Test finding')
|
40
|
+
dtl = CaTissue::SpecimenCollectionGroup::Pathology::Details.new(:additional_finding => fnd, :detail => 'Test detail')
|
41
|
+
assert_equal([hst], pth.histologic_types.to_a, "#{pth} histologic types incorrect")
|
42
|
+
assert_equal([fnd], pth.additional_findings.to_a, "#{pth} additional findings incorrect")
|
43
|
+
assert_equal([dtl], fnd.details.to_a, "#{fnd} details incorrect")
|
44
|
+
end
|
35
45
|
|
36
46
|
def test_prostatectomy_annotation
|
37
47
|
assert(CaTissue::SpecimenCollectionGroup.annotation_attribute?(:pathology))
|
@@ -112,18 +122,18 @@ class SpecimenCollectionGroupTest < Test::Unit::TestCase
|
|
112
122
|
## DATABASE TEST CASES ##
|
113
123
|
|
114
124
|
def test_save
|
115
|
-
logger.debug { "Verifying
|
125
|
+
logger.debug { "Verifying #{@scg} create..." }
|
116
126
|
verify_save(@scg)
|
117
127
|
assert_equal('Complete', @scg.collection_status, "Collection status after store incorrect")
|
118
|
-
assert_equal(2, @scg.
|
128
|
+
assert_equal(2, @scg.event_parameters.size, "#{@scg} events size incorrect")
|
119
129
|
tmpl = @scg.copy(:identifier)
|
120
|
-
verify_query(tmpl, :
|
130
|
+
verify_query(tmpl, :event_parameters) do |fetched|
|
121
131
|
assert_equal(2, fetched.size, "#{@scg} fetched events size incorrect")
|
122
132
|
end
|
123
133
|
assert_equal(1, @scg.specimens.size, "#{@scg} specimens size incorrect")
|
124
134
|
spc = @scg.specimens.first
|
125
|
-
assert_equal(2, spc.
|
126
|
-
verify_query(spc, :
|
135
|
+
assert_equal(2, spc.event_parameters.size, "#{@scg} #{spc} events size incorrect")
|
136
|
+
verify_query(spc, :event_parameters) do |fetched|
|
127
137
|
assert_equal(2, fetched.size, "#{@scg} #{spc} events query result size incorrect")
|
128
138
|
end
|
129
139
|
|
@@ -135,7 +145,7 @@ class SpecimenCollectionGroupTest < Test::Unit::TestCase
|
|
135
145
|
verify_save(@scg)
|
136
146
|
|
137
147
|
# query the specimens
|
138
|
-
logger.debug { "Verifying #{@scg
|
148
|
+
logger.debug { "Verifying #{@scg} specimens query..." }
|
139
149
|
tmpl = @scg.copy(@scg.class.secondary_key_attributes)
|
140
150
|
verify_query(tmpl, :specimens) do |fetched|
|
141
151
|
assert_equal(1, fetched.size, "#{@scg} specimens query result size incorrect")
|
@@ -152,15 +162,24 @@ class SpecimenCollectionGroupTest < Test::Unit::TestCase
|
|
152
162
|
assert_not_nil(fcep, "Collection event missing")
|
153
163
|
assert_equal('Test Comment', fcep.comment, "Collection event comment not saved")
|
154
164
|
end
|
165
|
+
|
166
|
+
# test update CEP from a partial template
|
167
|
+
tmpl = @scg.copy(:identifier)
|
168
|
+
tcep = CaTissue::SpecimenEventParameters.create_parameters(:collection, tmpl, :comment => 'Updated Test Comment')
|
169
|
+
verify_save(tmpl)
|
170
|
+
ceps = tmpl.specimen_event_parameters.select { |ep| CaTissue::CollectionEventParameters === ep }
|
171
|
+
assert(ceps.include?(tcep), "#{tmpl} is missing #{tcep}")
|
172
|
+
assert_equal(1, ceps.size, "#{tmpl} has extraneous CEPs: #{ceps.qp}")
|
173
|
+
assert(Jinx::Resource.value_equal?(cep.date, tcep.date), "#{tmpl} event parameters #{tcep} date #{tcep.date} not merged from #{cep} date #{cep.date}")
|
155
174
|
|
156
175
|
# update the comment
|
157
|
-
logger.debug { "
|
176
|
+
logger.debug { "#{self.class.qp} verifying #{@scg} update..." }
|
158
177
|
@scg.comment = comment = 'Test Comment'
|
159
178
|
verify_save(@scg)
|
160
179
|
@scg.comment = nil
|
161
180
|
database.find(@scg)
|
162
181
|
assert_equal(comment, @scg.comment, "Comment not updated in database")
|
163
|
-
logger.debug { "Verified #{@scg
|
182
|
+
logger.debug { "Verified #{@scg} store." }
|
164
183
|
|
165
184
|
# create a new SCG with two specimens
|
166
185
|
logger.debug { "Verifying second SCG create..." }
|
@@ -181,11 +200,20 @@ class SpecimenCollectionGroupTest < Test::Unit::TestCase
|
|
181
200
|
assert(spc_ids.include?(spc1.identifier), "#{scg} specimen #{spc1} not found")
|
182
201
|
assert(spc_ids.include?(spc2.identifier), "#{scg} specimen #{spc2} not found")
|
183
202
|
end
|
203
|
+
|
204
|
+
def test_save_without_consent
|
205
|
+
ctr = defaults.registration.consent_tier_responses.first
|
206
|
+
defaults.registration.consent_tier_responses.delete(ctr)
|
207
|
+
verify_save(@scg)
|
208
|
+
assert_nil(@scg.consent_tier_statuses.first, "#{@scg} has a consent tier status although there is no registration consent tier response")
|
209
|
+
# restore the response
|
210
|
+
defaults.registration.consent_tier_responses << ctr
|
211
|
+
end
|
184
212
|
|
185
213
|
# This test follows caTissue SCG, SEP and Specimen auto-generation as follows:
|
186
214
|
# * Create CPR => SCG auto-generated with status Pending, new Specimen, no SCG SEP
|
187
215
|
# * Update SCG status to Complete => SCG SEP created
|
188
|
-
def
|
216
|
+
def test_save_autogenerated
|
189
217
|
# make a new registration
|
190
218
|
pnt = CaTissue::Participant.new(:name => 'Test Participant'.uniquify)
|
191
219
|
pcl = defaults.protocol
|
@@ -263,6 +291,14 @@ class SpecimenCollectionGroupTest < Test::Unit::TestCase
|
|
263
291
|
verify_save(scg)
|
264
292
|
end
|
265
293
|
|
294
|
+
def test_save_haemotology_annotation
|
295
|
+
pth = CaTissue::SpecimenCollectionGroup::Pathology::BaseHaematologyPathologyAnnotation.new(:specimen_collection_group => @scg)
|
296
|
+
hst = CaTissue::SpecimenCollectionGroup::Pathology::HistologicType.new(:base_pathology_annotation => pth, :histologic_type => 'Adenocarcinoma - NOS')
|
297
|
+
fnd = CaTissue::SpecimenCollectionGroup::Pathology::AdditionalFinding.new(:base_pathology_annotation => pth, :pathologic_finding => 'Test finding')
|
298
|
+
dtl = CaTissue::SpecimenCollectionGroup::Pathology::Details.new(:additional_finding => fnd, :detail => 'Test detail')
|
299
|
+
verify_save(pth)
|
300
|
+
end
|
301
|
+
|
266
302
|
def test_save_prostatectomy_annotation
|
267
303
|
pa = CaTissue::SpecimenCollectionGroup::Pathology::RadicalProstatectomyPathologyAnnotation.new
|
268
304
|
pa.specimen_collection_group = @scg
|
@@ -273,7 +309,7 @@ class SpecimenCollectionGroupTest < Test::Unit::TestCase
|
|
273
309
|
invn = CaTissue::SpecimenCollectionGroup::Pathology::Invasion.new
|
274
310
|
invn.merge_attributes(:lymphatic_invasion => 'Present', :base_solid_tissue_pathology_annotation => pa)
|
275
311
|
gleason = CaTissue::SpecimenCollectionGroup::Pathology::GleasonScore.new
|
276
|
-
gleason.merge_attributes(:primary_pattern_score => 3, :secondary_pattern_score => 4, :prostate_pathology_annotation => pa)
|
312
|
+
gleason.merge_attributes(:primary_pattern_score => 3, :secondary_pattern_score => 4, :tertiary_pattern_score => 4, :prostate_pathology_annotation => pa)
|
277
313
|
margin = CaTissue::SpecimenCollectionGroup::Pathology::RadicalProstatectomyMargin.new
|
278
314
|
margin.merge_attributes(:margin_status => 'Benign glands at surgical Margin', :radical_prostatectomy_pathology_annotation => pa)
|
279
315
|
verify_save(pa)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class SpecimenEventParametersTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -15,7 +15,7 @@ class SpecimenEventParametersTest < Test::Unit::TestCase
|
|
15
15
|
|
16
16
|
def test_missing_scg
|
17
17
|
@sep.specimen_collection_group = nil
|
18
|
-
assert_raises(ValidationError, "Parameters without SCG passes SCG validation") { @sep.validate }
|
18
|
+
assert_raises(Jinx::ValidationError, "Parameters without SCG passes SCG validation") { @sep.validate }
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_java_date
|
@@ -36,11 +36,11 @@ class SpecimenEventParametersTest < Test::Unit::TestCase
|
|
36
36
|
|
37
37
|
## DATABASE TESTS ##
|
38
38
|
|
39
|
-
def
|
39
|
+
def test_save_specimen_sep
|
40
40
|
verify_save(@sep)
|
41
41
|
# update the freeze method
|
42
42
|
@sep.freeze_method = 'Cryostat'
|
43
|
-
logger.debug { "#{self.class.qp} updating #{@
|
43
|
+
logger.debug { "#{self.class.qp} updating #{@sep.qp}..." }
|
44
44
|
verify_save(@sep)
|
45
45
|
end
|
46
46
|
end
|