caruby-tissue 1.3.6 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/History.txt +20 -7
  2. data/README.md +28 -81
  3. data/conf/wustl/log4j.properties +40 -0
  4. data/examples/galena/README.md +34 -23
  5. data/examples/galena/conf/migration/annotation_defaults.yaml +2 -0
  6. data/examples/galena/conf/migration/annotation_fields.yaml +8 -0
  7. data/examples/galena/conf/migration/frozen_defaults.yaml +1 -0
  8. data/examples/galena/conf/migration/participant_fields.yaml +4 -0
  9. data/examples/galena/conf/migration/registration_fields.yaml +4 -0
  10. data/examples/galena/data/annotation.csv +1 -0
  11. data/examples/galena/data/participant.csv +1 -0
  12. data/examples/galena/data/registration.csv +1 -0
  13. data/examples/galena/lib/galena/{migration → tissue/migration}/filter_shims.rb +2 -3
  14. data/examples/galena/lib/galena/{migration → tissue/migration}/frozen_shims.rb +0 -10
  15. data/examples/galena/lib/galena/{seed → tissue/seed}/defaults.rb +24 -8
  16. data/examples/pcbin/README.md +44 -0
  17. data/examples/pcbin/conf/adjuvant_hormone_defaults.yaml +1 -0
  18. data/examples/pcbin/conf/adjuvant_radiation_defaults.yaml +2 -0
  19. data/examples/pcbin/conf/biopsy_defaults.yaml +3 -0
  20. data/examples/pcbin/conf/biopsy_fields.yaml +9 -0
  21. data/examples/pcbin/conf/neoadjuvant_hormone_defaults.yaml +1 -0
  22. data/examples/pcbin/conf/neoadjuvant_radiation_defaults.yaml +2 -0
  23. data/examples/pcbin/conf/patient_defaults.yaml +2 -0
  24. data/examples/pcbin/conf/patient_fields.yaml +5 -0
  25. data/examples/pcbin/conf/surgery_defaults.yaml +3 -0
  26. data/examples/pcbin/conf/surgery_fields.yaml +15 -0
  27. data/examples/pcbin/conf/t_stage_defaults.yaml +1 -0
  28. data/examples/pcbin/conf/t_stage_fields.yaml +4 -0
  29. data/examples/pcbin/conf/therapy_fields.yaml +5 -0
  30. data/examples/pcbin/data/adjuvant_hormone.csv +1 -0
  31. data/examples/pcbin/data/adjuvant_radiation.csv +1 -0
  32. data/examples/pcbin/data/biopsy.csv +1 -0
  33. data/examples/pcbin/data/neoadjuvant_hormone.csv +1 -0
  34. data/examples/pcbin/data/neoadjuvant_radiation.csv +1 -0
  35. data/examples/pcbin/data/patient.csv +1 -0
  36. data/examples/pcbin/data/surgery.csv +1 -0
  37. data/examples/pcbin/data/t_stage.csv +1 -0
  38. data/examples/pcbin/lib/pcbin/biopsy_shims.rb +15 -0
  39. data/examples/pcbin/lib/pcbin/surgery_shims.rb +15 -0
  40. data/lib/catissue.rb +0 -1
  41. data/lib/catissue/annotation/annotatable.rb +8 -1
  42. data/lib/catissue/annotation/annotatable_class.rb +40 -25
  43. data/lib/catissue/annotation/annotation.rb +8 -4
  44. data/lib/catissue/annotation/annotation_class.rb +83 -61
  45. data/lib/catissue/annotation/annotation_module.rb +56 -20
  46. data/lib/catissue/annotation/de_integration.rb +22 -0
  47. data/lib/catissue/annotation/proxy_class.rb +12 -2
  48. data/lib/catissue/cli/migrate.rb +1 -1
  49. data/lib/catissue/database.rb +198 -55
  50. data/lib/catissue/database/annotation/annotation_service.rb +17 -13
  51. data/lib/catissue/database/annotation/annotator.rb +6 -8
  52. data/lib/catissue/database/annotation/entity_facade.rb +65 -35
  53. data/lib/catissue/database/annotation/id_generator.rb +2 -2
  54. data/lib/catissue/database/annotation/integration_service.rb +12 -33
  55. data/lib/catissue/database/annotation/integrator.rb +38 -0
  56. data/lib/catissue/database/annotation/record_entry_integrator.rb +62 -0
  57. data/lib/catissue/database/controlled_values.rb +4 -18
  58. data/lib/catissue/domain/abstract_position.rb +2 -2
  59. data/lib/catissue/domain/abstract_specimen.rb +31 -23
  60. data/lib/catissue/domain/abstract_specimen_collection_group.rb +2 -4
  61. data/lib/catissue/domain/address.rb +1 -3
  62. data/lib/catissue/domain/cancer_research_group.rb +1 -3
  63. data/lib/catissue/domain/capacity.rb +1 -3
  64. data/lib/catissue/domain/check_in_check_out_event_parameter.rb +2 -5
  65. data/lib/catissue/domain/collection_event_parameters.rb +9 -5
  66. data/lib/catissue/domain/collection_protocol.rb +12 -11
  67. data/lib/catissue/domain/collection_protocol_event.rb +3 -3
  68. data/lib/catissue/domain/collection_protocol_registration.rb +23 -19
  69. data/lib/catissue/domain/consent_tier_response.rb +1 -3
  70. data/lib/catissue/domain/consent_tier_status.rb +1 -3
  71. data/lib/catissue/domain/container.rb +33 -33
  72. data/lib/catissue/domain/container_position.rb +4 -4
  73. data/lib/catissue/domain/container_type.rb +20 -9
  74. data/lib/catissue/domain/department.rb +1 -3
  75. data/lib/catissue/domain/disposal_event_parameters.rb +2 -4
  76. data/lib/catissue/domain/embedded_event_parameters.rb +2 -4
  77. data/lib/catissue/domain/external_identifier.rb +1 -3
  78. data/lib/catissue/domain/frozen_event_parameters.rb +2 -4
  79. data/lib/catissue/domain/institution.rb +1 -3
  80. data/lib/catissue/domain/new_specimen_array_order_item.rb +2 -4
  81. data/lib/catissue/domain/order_details.rb +2 -4
  82. data/lib/catissue/domain/participant.rb +5 -5
  83. data/lib/catissue/domain/participant_medical_identifier.rb +5 -3
  84. data/lib/catissue/domain/password.rb +1 -3
  85. data/lib/catissue/domain/race.rb +3 -4
  86. data/lib/catissue/domain/received_event_parameters.rb +7 -4
  87. data/lib/catissue/domain/site.rb +5 -3
  88. data/lib/catissue/domain/specimen.rb +68 -29
  89. data/lib/catissue/domain/specimen/pathology/prostate_specimen_pathology_annotation.rb +15 -0
  90. data/lib/catissue/domain/specimen/pathology/specimen_base_solid_tissue_pathology_annotation.rb +15 -0
  91. data/lib/catissue/domain/specimen/pathology/specimen_histologic_type.rb +13 -0
  92. data/lib/catissue/domain/specimen_array.rb +1 -3
  93. data/lib/catissue/domain/specimen_array_content.rb +2 -2
  94. data/lib/catissue/domain/specimen_array_type.rb +7 -4
  95. data/lib/catissue/domain/specimen_characteristics.rb +1 -3
  96. data/lib/catissue/domain/specimen_collection_group.rb +29 -108
  97. data/lib/catissue/domain/specimen_event_parameters.rb +16 -6
  98. data/lib/catissue/domain/specimen_position.rb +2 -4
  99. data/lib/catissue/domain/specimen_protocol.rb +1 -3
  100. data/lib/catissue/domain/specimen_requirement.rb +5 -5
  101. data/lib/catissue/domain/storage_container.rb +22 -9
  102. data/lib/catissue/domain/storage_type.rb +8 -3
  103. data/lib/catissue/domain/transfer_event_parameters.rb +2 -4
  104. data/lib/catissue/domain/user.rb +18 -8
  105. data/lib/catissue/extract/delta.rb +2 -2
  106. data/lib/catissue/migration/migratable.rb +20 -0
  107. data/lib/catissue/migration/migrator.rb +17 -9
  108. data/lib/catissue/migration/shims.rb +9 -6
  109. data/lib/catissue/migration/uniquify.rb +2 -2
  110. data/lib/catissue/resource.rb +22 -22
  111. data/lib/catissue/util/collectible.rb +114 -0
  112. data/lib/catissue/util/collectible_event_parameters.rb +71 -0
  113. data/lib/catissue/util/location.rb +1 -1
  114. data/lib/catissue/util/storable.rb +6 -5
  115. data/lib/catissue/{domain → util}/uniquify.rb +4 -0
  116. data/lib/catissue/version.rb +2 -2
  117. data/lib/catissue/wustl/logger.rb +60 -0
  118. data/test/fixtures/lib/catissue/defaults_test_fixture.rb +6 -4
  119. data/test/fixtures/lib/examples/galena/migration/alt_key_shims.rb +7 -0
  120. data/test/lib/catissue/domain/address_test.rb +14 -35
  121. data/test/lib/catissue/domain/base_haemotology_pathology_test.rb +8 -9
  122. data/test/lib/catissue/domain/ca_tissue_test_defaults_test.rb +0 -1
  123. data/test/lib/catissue/domain/collection_event_parameters_test.rb +29 -12
  124. data/test/lib/catissue/domain/collection_protocol_event_test.rb +0 -1
  125. data/test/lib/catissue/domain/collection_protocol_registration_test.rb +0 -1
  126. data/test/lib/catissue/domain/collection_protocol_test.rb +0 -1
  127. data/test/lib/catissue/domain/container_position_test.rb +0 -1
  128. data/test/lib/catissue/domain/disposal_event_parameters_test.rb +0 -1
  129. data/test/lib/catissue/domain/external_identifier_test.rb +23 -0
  130. data/test/lib/catissue/domain/location_test.rb +0 -1
  131. data/test/lib/catissue/domain/participant_test.rb +41 -18
  132. data/test/lib/catissue/domain/site_test.rb +0 -1
  133. data/test/lib/catissue/domain/specimen_array_test.rb +0 -1
  134. data/test/lib/catissue/domain/specimen_characteristics_test.rb +0 -1
  135. data/test/lib/catissue/domain/specimen_collection_group_test.rb +83 -24
  136. data/test/lib/catissue/domain/specimen_event_parameters_test.rb +3 -18
  137. data/test/lib/catissue/domain/specimen_position_test.rb +0 -1
  138. data/test/lib/catissue/domain/specimen_requirement_test.rb +0 -1
  139. data/test/lib/catissue/domain/specimen_test.rb +122 -32
  140. data/test/lib/catissue/domain/storage_container_test.rb +35 -34
  141. data/test/lib/catissue/domain/storage_type_test.rb +0 -1
  142. data/test/lib/catissue/domain/transfer_event_parameters_test.rb +0 -1
  143. data/test/lib/catissue/domain/user_test.rb +0 -1
  144. data/test/lib/catissue/test_case.rb +24 -6
  145. data/test/lib/examples/galena/{domain → tissue/domain}/examples_test.rb +1 -1
  146. data/test/lib/examples/galena/tissue/migration/annotation_test.rb +27 -0
  147. data/test/lib/examples/galena/tissue/migration/filter_test.rb +29 -0
  148. data/test/lib/examples/galena/tissue/migration/frozen_test.rb +36 -0
  149. data/test/lib/examples/galena/tissue/migration/general_test.rb +56 -0
  150. data/test/lib/examples/galena/tissue/migration/participant_test.rb +61 -0
  151. data/test/lib/examples/galena/tissue/migration/registration_test.rb +23 -0
  152. data/test/lib/examples/galena/{migration/uniquify.rb → tissue/migration/seedify.rb} +30 -4
  153. data/test/lib/examples/galena/tissue/migration/simple_test.rb +30 -0
  154. data/test/lib/examples/galena/tissue/migration/test_case.rb +68 -0
  155. data/test/lib/examples/pcbin/migration_test.rb +132 -0
  156. metadata +259 -201
  157. data/examples/galena/data/minimal.csv +0 -1
  158. data/lib/catissue/domain/abstract_domain_object.rb +0 -8
  159. data/lib/catissue/domain/scg_event_parameters.rb +0 -11
  160. data/lib/catissue/util/log.rb +0 -30
  161. data/test/lib/catissue/database/database_test.rb +0 -28
  162. data/test/lib/catissue/domain/metadata_test.rb +0 -62
  163. data/test/lib/examples/galena/migration/catissue.log +0 -0
  164. data/test/lib/examples/galena/migration/filter_test.rb +0 -26
  165. data/test/lib/examples/galena/migration/frozen_test.rb +0 -28
  166. data/test/lib/examples/galena/migration/general_test.rb +0 -44
  167. data/test/lib/examples/galena/migration/simple_test.rb +0 -29
  168. data/test/lib/examples/galena/migration/test_case.rb +0 -52
data/History.txt CHANGED
@@ -1,22 +1,25 @@
1
+ This history lists major release themes. See the GitHub source (https://github.com/caruby/tissue)
2
+ for change details.
3
+
1
4
  === 1.2.1 / 2010-11-23
2
5
 
3
6
  * Initial public release.
4
7
 
5
8
  === 1.2.2 / 2010-11-30
6
9
 
7
- * Enable Galena example.
10
+ * Galena example.
8
11
 
9
12
  === 1.2.3 / 2011-02-18
10
13
 
11
- * Support Dynamic Extensions.
14
+ * Dynamic Extensions Support.
12
15
 
13
16
  === 1.3.1 / 2011-02-18
14
17
 
15
- * Full PCBIN DE support.
18
+ * Prostate Spore PCBIN DE support.
16
19
 
17
20
  === 1.3.2 / 2011-02-25
18
21
 
19
- * Minor migration bug fixes.
22
+ * Migration bug fixes.
20
23
 
21
24
  === 1.3.3 / 2011-02-26
22
25
 
@@ -28,10 +31,20 @@
28
31
 
29
32
  === 1.3.5 / 2011-03-04
30
33
 
31
- * Support annotation migration.
32
-
34
+ * Annotation migration.
33
35
 
34
36
  === 1.3.6 / 2011-03-04
35
37
 
36
- * Specify caruby-core version dependency.
38
+ * Specify caruby-core gem version dependency.
39
+
40
+ === 1.4.1 / 2011-05-03
41
+
42
+ * caTissue 1.2 support.
43
+
44
+ * embed Java-caRuby bridge subproject.
45
+
46
+ === 1.4.2 / 2011-05-04
47
+
48
+ * Add registration and PCBIN examples.
49
+
37
50
 
data/README.md CHANGED
@@ -1,99 +1,46 @@
1
- Galena caRuby Tissue example
2
- ============================
1
+ caRuby Tissue: Simplifying caTissue
2
+ ===================================
3
+
4
+ **Home**: [http://caruby.rubyforge.org/catissue.html](http://caruby.rubyforge.org/catissue.html)
5
+ **Git**: [http://github.com/caruby/tissue](http://github.com/caruby/tissue)
6
+ **Author**: OHSU Knight Cancer Institute
7
+ **Copyright**: 2010, 2011
8
+ **License**: MIT License
3
9
 
4
10
  Synopsis
5
11
  --------
6
- This directory contains the caRuby Tissue example for the hypothetical Galena Cancer Center.
7
- The example files are a useful template for building your own migrator.
8
-
9
- The Galena example demonstrates how to load the content of a custom tissue bank into caTissue.
10
- The use cases illustrate several common migration impediments:
11
-
12
- * Different terminology than caTissue
13
- * Different associations than caTissue
14
- * Incomplete input for caTissue
15
- * Denormalized input
16
- * Inconsistent input
17
- * Input data scrubbing
18
- * Aliquot inference
19
- * Pre-defined caTissue protocol
20
-
21
- Setup
22
- -----
23
- 1. Run the `crtexample --list` command to display the Galena example location.
24
-
25
- 2. Copy the example into a location of your choosing.
26
12
 
27
- 3. Configure a caTissue client to connect to a test caTissue instance, as described in the
28
- caTissue Technical Guide.
13
+ caRuby Tissue presents a JRuby facade that simplifies interaction with the
14
+ [caTissue](https://cabig-kc.nci.nih.gov/Biospecimen/KC/index.php/CaTissue_Suite) application.
29
15
 
30
- 4. Define the caRuby Tissue access property file as described in the configuration
31
- [FAQ](how-do-i-configure-caruby-to-work-with-catissue).
32
-
33
- Migration
34
- ---------
35
- The example migration input data resides in the `data` directory.
36
- Each CSV input file holds one row for each specimen.
16
+ Feature List
17
+ ------------
37
18
 
38
- Each example has a field mapping configuration in the `conf/migration` directory.
39
- For example, the `simple.csv` input file is migrated into caTissue using the
40
- `simple_migration.yaml` configuration file.
19
+ 1. Declarative JRuby API that reduces caTissue API complexity.
41
20
 
42
- Migrate the Galena `simple` example as follows:
21
+ 2. Data migration and extraction.
43
22
 
44
- 1. Open a console in the copied Galena example location.
23
+ See the project [Home](http://caruby.rubyforge.org/catissue.html) Page for a more complete feature list.
45
24
 
46
- 2. Run the following:
47
-
48
- bin/seed
49
-
50
- This command initializes the administrative objects in the Galena test database,
51
- including the Galena collection protocol, site, cancer center, tissue bank and coordinator.
52
-
53
- 3. Run the following:
54
-
55
- crtmigrate --target TissueSpecimen --mapping conf/migration/simple_fields.yaml data/simple.csv
56
-
57
- This command migrates the CSV record in the `simple.csv` input file into a caTissue
58
- `TissueSpecimen` based on the `simple_fields.yaml` mapping file.
59
- The command will take a couple of minutes to finish, since the less information
60
- you provide caRuby the more it works to fill in the missing bits. In the meantime,
61
- peruse the configuration and data files to see which data are migrated and
62
- where this data ends up in caTissue.
63
-
64
- 4. Open the caTissue application on the test server and verify the content of the
65
- Galena CP collection protocol.
66
-
67
- The other examples are run in a similar manner. Each example demonstrates different
68
- features of the caRuby Migration utility as follows:
25
+ Installing
26
+ ----------
27
+ caRuby Tissue is installed as a JRuby gem:
28
+ sudo jgem install caruby-tissue
69
29
 
70
- * simple - a good starting point with limited input fields
71
- * minimal - the fewest possible input fields without writing custom Ruby shim code
72
- * general - lots of input fields, no custom Ruby code
73
- * filter - a smattering of custom Ruby shim code to convert input values to caTissue values
74
- * frozen - an example demonstrating how to import storage locations
30
+ The caRuby Tissue [FAQ](https://caruby.tenderapp.com/dashboard/sections/tissue) describes how to
31
+ configure caRuby to access your caTissue instance.
75
32
 
76
- Try running an example with the `--debug` flag and look at the `log/migration.log` file to see
77
- what caRuby is up to behind the scenes (hint: a lot!).
33
+ Usage
34
+ -----
78
35
 
79
- Input data
80
- ----------
81
- The sample Galena Tissue Bank CSV input files hold one row for each specimen.
82
- Common fields are as follows:
36
+ The [Galena Example](https://github.com/caruby/tissue/blob/master/examples/galena/README.md) presents
37
+ a migration use case.
83
38
 
84
- * MRN - Patient Medical Record Number
85
- * Initials - Patient name initials
86
- * Frozen? - Flag indicating whether the specimen is frozen
87
- * SPN - Surgical Pathology Number
88
- * Collection Date - Date the specimen was acquired by the tissue bank
89
- * Received Date - Date the specimen was donated by the participant
90
- * Quantity - Amount collected
91
- * Box - Tissue storage container
92
- * X - the tissue box column
93
- * Y - the tissue box row
39
+ The caRuby Tissue [FAQ](https://caruby.tenderapp.com/dashboard/sections/tissue) contains caRuby Tissue API examples.
94
40
 
95
41
  Copyright
96
42
  ---------
97
43
 
98
44
  caRuby © 2010, 2011 by [Oregon Health & Science University](http://www.ohsu.edu/xd/health/services/cancer/index.cfm).
99
- caRuby is licensed under the MIT license. Please see the LICENSE and LEGAL files for more information.
45
+ caRuby is licensed under the MIT license. Please see the LICENSE and LEGAL
46
+ files for more information.
@@ -0,0 +1,40 @@
1
+ log4j.rootLogger==ERROR, clientLog, catissuecoreclientLog
2
+
3
+ log4j.appender.clientLog=org.apache.log4j.FileAppender
4
+ log4j.appender.clientLog.File=./log/client.log
5
+ log4j.appender.clientLog.layout=org.apache.log4j.PatternLayout
6
+ log4j.appender.clientLog.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
7
+
8
+ log4j.appender.catissuecoreclientLog=org.apache.log4j.FileAppender
9
+ log4j.appender.catissuecoreclientLog.File=./log/catissuecoreclient.log
10
+ log4j.appender.catissuecoreclientLog.layout=org.apache.log4j.PatternLayout
11
+ log4j.appender.catissuecoreclientLog.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1} - %m%n
12
+
13
+ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
14
+ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
15
+ log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
16
+
17
+ ### set log levels - for more verbose logging change 'info' to 'debug' ###
18
+
19
+ log4j.rootLogger=warn, clientLog
20
+
21
+ log4j.logger.org.hibernate=info
22
+
23
+ ## log the SQL
24
+ log4j.logger.org.hibernate.SQL=debug
25
+
26
+ ### log JDBC bind parameters ###
27
+ log4j.logger.org.hibernate.type=info
28
+
29
+ ### log schema export/update ###
30
+ log4j.logger.org.hibernate.tool.hbm2ddl=debug
31
+
32
+ ### log cache activity ###
33
+ #log4j.logger.org.hibernate.cache=debug
34
+
35
+ ### log JDBC resource acquisition
36
+ #log4j.logger.org.hibernate.jdbc=debug
37
+
38
+ ### enable the following line if you want to track down connection ###
39
+ ### leakages when using DriverManagerConnectionProvider ###
40
+ #log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
@@ -4,9 +4,9 @@ Galena caRuby Tissue example
4
4
  Synopsis
5
5
  --------
6
6
  This directory contains the caRuby Tissue example for the hypothetical Galena Cancer Center.
7
- The example files are a useful template for building your own migrator.
7
+ The example files are a useful starting point for configuring your own migration.
8
8
 
9
- The Galena example demonstrates how to load the content of a custom tissue bank into caTissue.
9
+ The Galena example demonstrates how to load the content of a source tissue bank into caTissue.
10
10
  The use cases illustrate several common migration impediments:
11
11
 
12
12
  * Different terminology than caTissue
@@ -15,8 +15,8 @@ The use cases illustrate several common migration impediments:
15
15
  * Denormalized input
16
16
  * Inconsistent input
17
17
  * Input data scrubbing
18
+ * Specimen annotations
18
19
  * Aliquot inference
19
- * Pre-defined caTissue protocol
20
20
 
21
21
  Setup
22
22
  -----
@@ -56,9 +56,7 @@ Migrate the Galena `simple` example as follows:
56
56
 
57
57
  This command migrates the CSV record in the `simple.csv` input file into a caTissue
58
58
  `TissueSpecimen` based on the `simple_fields.yaml` mapping file.
59
- The command will take a couple of minutes to finish, since the less information
60
- you provide caRuby the more it works to fill in the missing bits. In the meantime,
61
- peruse the configuration and data files to see which data are migrated and
59
+ Peruse the configuration and data files to see which data are migrated and
62
60
  where this data ends up in caTissue.
63
61
 
64
62
  4. Open the caTissue application on the test server and verify the content of the
@@ -67,11 +65,20 @@ Migrate the Galena `simple` example as follows:
67
65
  The other examples are run in a similar manner. Each example demonstrates different
68
66
  features of the caRuby Migration utility as follows:
69
67
 
70
- * simple - a good starting point with limited input fields
71
- * minimal - the fewest possible input fields without writing custom Ruby shim code
72
- * general - lots of input fields, no custom Ruby code
73
- * filter - a smattering of custom Ruby shim code to convert input values to caTissue values
74
- * frozen - an example demonstrating how to import storage locations
68
+ * `simple` - a good starting point with limited input fields
69
+ `crtmigrate --target TissueSpecimen --mapping conf/migration/simple_fields.yaml data/simple.csv`
70
+
71
+ * `general` - lots of input fields, no custom Ruby code
72
+ `crtmigrate --target TissueSpecimen --mapping conf/migration/general_fields.yaml data/general.csv`
73
+
74
+ * `filter` - a smattering of custom Ruby shim code to convert input values to caTissue values
75
+ `crtmigrate --target TissueSpecimen --mapping conf/migration/filter_fields.yaml data/filter.csv`
76
+
77
+ * `frozen` - an example demonstrating how to import storage locations
78
+ `crtmigrate --target TissueSpecimen --mapping conf/migration/frozen_fields.yaml --defaults conf/migration/frozen_defaults.yaml data/frozen.csv`
79
+
80
+ * `annotation` - an example demonstrating how to import annotations
81
+ `crtmigrate --target TissueSpecimen --mapping conf/migration/annotation_fields.yaml --defaults conf/migration/annotation_defaults.yaml data/annotation.csv `
75
82
 
76
83
  Try running an example with the `--debug` flag and look at the `log/migration.log` file to see
77
84
  what caRuby is up to behind the scenes (hint: a lot!).
@@ -79,15 +86,19 @@ what caRuby is up to behind the scenes (hint: a lot!).
79
86
  Input data
80
87
  ----------
81
88
  The sample Galena Tissue Bank CSV input files hold one row for each specimen.
82
- Common fields are as follows:
83
-
84
- * MRN - Patient Medical Record Number
85
- * Initials - Patient name initials
86
- * Frozen? - Flag indicating whether the specimen is frozen
87
- * SPN - Surgical Pathology Number
88
- * Collection Date - Date the specimen was acquired by the tissue bank
89
- * Received Date - Date the specimen was donated by the participant
90
- * Quantity - Amount collected
91
- * Box - Tissue storage container
92
- * X - the tissue box column
93
- * Y - the tissue box row
89
+ The following input fields are included in the examples:
90
+
91
+ * `Protocol` - Collection Protocol title
92
+ * `MRN` - Patient Medical Record Number
93
+ * `Initials` - Patient name initials
94
+ * `Frozen?` - Flag indicating whether the specimen is frozen
95
+ * `SPN` - Surgical Pathology Number
96
+ * `Collection Date` - Date the specimen was acquired by the tissue bank
97
+ * `Received Date` - Date the specimen was donated by the participant
98
+ * `Quantity` - Amount collected
99
+ * `Box` - Tissue storage container
100
+ * `X` - the tissue box column
101
+ * `Y` - the tissue box row
102
+ * `Gleason`: Specimen primary gleason score
103
+ * `Grade`: Specimen histologic WHO grade
104
+
@@ -0,0 +1,2 @@
1
+ SpecimenCollectionGroup::Pathology::RadicalProstatectomyPathologyAnnotation.comment: Imported annotation
2
+ SpecimenCollectionGroup::Pathology::HistologicGrade.grading_system_name: WHO Grade I
@@ -0,0 +1,8 @@
1
+ # This is the Galena annotation example migration field mapping file.
2
+ # This example extends the simple migration with annotation fields.
3
+
4
+ Protocol: CollectionProtocol.short_title
5
+ MRN: ParticipantMedicalIdentifier.medical_record_number, Participant.last_name
6
+ SPN: SpecimenCollectionGroup.surgical_pathology_number
7
+ Gleason: SpecimenCollectionGroup::Pathology::GleasonScore.primary_pattern_score
8
+ Grade: SpecimenCollectionGroup::Pathology::HistologicGrade.grade
@@ -0,0 +1 @@
1
+ TissueSpecimen.specimen_type: Frozen Tissue
@@ -0,0 +1,4 @@
1
+ SSN: Participant.social_security_number
2
+ First: Participant.first_name
3
+ Middle: Participant.middle_name
4
+ Last: Participant.last_name
@@ -0,0 +1,4 @@
1
+ Patient: ParticipantMedicalIdentifier.medical_record_number
2
+ Collection Point: CollectionProtocolEvent.collection_point_label
3
+ Received: ReceivedEventParameters.timestamp
4
+ SCG Name: SpecimenCollectionGroup.name
@@ -0,0 +1 @@
1
+ Protocol,MRN,SPN,Gleason,Grade
@@ -0,0 +1 @@
1
+ SSN,First,Middle,Last
@@ -0,0 +1 @@
1
+ Patient,Collection Point,Received,SCG Name
@@ -1,19 +1,18 @@
1
1
  require 'uom'
2
2
 
3
3
  module CaTissue
4
-
5
4
  # Declares the classes modified for migration.
6
5
  shims Participant, TissueSpecimen, SpecimenCollectionGroup
7
6
 
8
7
  class Participant
9
8
  # Extracts the Participant first name from the +Initials+ input field.
10
9
  def migrate_first_name(value, row)
11
- self.first_name = value[0, 1]
10
+ value[0, 1]
12
11
  end
13
12
 
14
13
  # Extracts the Participant last name from the +Initials+ input field.
15
14
  def migrate_last_name(value, row)
16
- self.last_name = value[-1, 1]
15
+ value[-1, 1]
17
16
  end
18
17
  end
19
18
 
@@ -4,16 +4,6 @@ require File.join(File.dirname(__FILE__), '..', 'seed', 'defaults')
4
4
  module CaTissue
5
5
  # Declares the classes modified for migration.
6
6
  shims TissueSpecimen, CollectionProtocolRegistration, StorageContainer
7
-
8
- class TissueSpecimen
9
- # Sets the specimen type to +Frozen Tissue+.
10
- #
11
- # @param (see CaRuby::Migratable#migrate)
12
- def migrate(row, migrated)
13
- super
14
- self.specimen_type = 'Frozen Tissue'
15
- end
16
- end
17
7
 
18
8
  class StorageContainer
19
9
  # Creates the migrated box in the database, if necessary.
@@ -28,20 +28,26 @@ module Galena
28
28
  class Defaults
29
29
  include Singleton
30
30
 
31
- attr_reader :protocol, :hospital, :tissue_bank, :freezer_type, :box_type
31
+ attr_reader :protocols, :hospital, :tissue_bank, :freezer_type, :box_type
32
32
 
33
33
  # Creates the Galena example Defaults singleton and populates the attributes.
34
34
  def initialize
35
35
  super
36
+ @protocols = []
36
37
  populate
37
38
  end
38
39
 
39
40
  # Creates the Galena example administrative objects as necessary.
40
41
  def ensure_exists
41
- @protocol.find(:create)
42
+ @protocols.each { |pcl| pcl.find(:create) }
42
43
  @hospital.find(:create)
43
44
  @surgeon.find(:create)
44
- @box.find(:create)
45
+ @box_type.find(:create)
46
+ end
47
+
48
+ # @return [CaTissue::CollectionProtocol] the primary example protocol
49
+ def protocol
50
+ @protocols.first
45
51
  end
46
52
 
47
53
  private
@@ -65,11 +71,11 @@ module Galena
65
71
 
66
72
  @hospital = CaTissue::Site.new(
67
73
  :site_type => CaTissue::Site::SiteType::COLLECTION, :name => 'Galena Hospital',
68
- :address => addr, :coordinator => coord)
74
+ :address => addr.copy, :coordinator => coord)
69
75
 
70
76
  @tissue_bank = CaTissue::Site.new(
71
77
  :site_type => CaTissue::Site::SiteType::REPOSITORY, :name => 'Galena Tissue Bank',
72
- :address => addr, :coordinator => coord)
78
+ :address => addr.copy, :coordinator => coord)
73
79
 
74
80
  pi = CaTissue::User.new(
75
81
  :email_address => 'vesta.gator@galena.edu',
@@ -81,16 +87,26 @@ module Galena
81
87
  :first_name => 'Serge', :last_name => 'On', :address => addr.copy,
82
88
  :institution => galena, :department => dept, :cancer_research_group => crg)
83
89
 
84
- @protocol = CaTissue::CollectionProtocol.new(:short_title => 'Galena Migration',
90
+ @protocols << pcl = CaTissue::CollectionProtocol.new(:short_title => 'Galena Migration',
85
91
  :principal_investigator => pi, :sites => [@tissue_bank])
86
92
 
87
93
  # CPE has default 1.0 event point and label
88
- cpe = CaTissue::CollectionProtocolEvent.new(:collection_protocol => @protocol)
94
+ cpe = CaTissue::CollectionProtocolEvent.new(:collection_protocol => pcl, :event_point => 1.0, :label => 'Galena Migration_1')
89
95
 
90
- # the sole specimen requirement. Setting the requirement collection_event attribute to a CPE automatically
96
+ # The sole specimen requirement. Setting the requirement collection_event attribute to a CPE automatically
91
97
  # sets the CPE requirement inverse attribute in caRuby.
92
98
  CaTissue::TissueSpecimenRequirement.new(:collection_event => cpe, :specimen_type => 'Fixed Tissue')
93
99
 
100
+ @protocols << pcl2 = CaTissue::CollectionProtocol.new(:short_title => 'Galena Migration 2',
101
+ :principal_investigator => pi, :sites => [@tissue_bank])
102
+ cpe2 = CaTissue::CollectionProtocolEvent.new(:collection_protocol => pcl2, :event_point => 2.0, :label => 'Galena Migration_2')
103
+ CaTissue::TissueSpecimenRequirement.new(:collection_event => cpe2, :specimen_type => 'Frozen Tissue')
104
+
105
+ @protocols << pcl3 = CaTissue::CollectionProtocol.new(:short_title => 'Galena Migration 3',
106
+ :principal_investigator => pi, :sites => [@tissue_bank])
107
+ cpe3 = CaTissue::CollectionProtocolEvent.new(:collection_protocol => pcl3, :event_point => 3.0, :label => 'Galena Migration_3')
108
+ CaTissue::TissueSpecimenRequirement.new(:collection_event => cpe3, :specimen_type => 'Frozen Tissue')
109
+
94
110
  # the storage container type hierarchy
95
111
  @freezer_type = CaTissue::StorageType.new(:name => 'GTB Freezer', :columns => 10, :rows => 1, :column_label => 'Rack')
96
112
  rack_type = CaTissue::StorageType.new(:name => 'GTB Rack', :columns => 10, :rows => 10)