caruby-tissue 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. data/History.txt +4 -0
  2. data/bin/crtdump +11 -3
  3. data/bin/{seed → crtseed} +0 -0
  4. data/conf/annotation/pathology_scg/AdditionalFinding.hbm.xml +19 -0
  5. data/conf/annotation/pathology_scg/BasePathologyAnnotation.hbm.xml +260 -0
  6. data/conf/annotation/pathology_scg/BreastMargin.hbm.xml +21 -0
  7. data/conf/annotation/pathology_scg/BreastMarginInvolved.hbm.xml +15 -0
  8. data/conf/annotation/pathology_scg/BreastMarginUninvolved.hbm.xml +14 -0
  9. data/conf/annotation/pathology_scg/CNSMargin.hbm.xml +19 -0
  10. data/conf/annotation/pathology_scg/CNSMarginLocation.hbm.xml +14 -0
  11. data/conf/annotation/pathology_scg/CarcinomaInSituStatus.hbm.xml +14 -0
  12. data/conf/annotation/pathology_scg/ColorectalLocalExcisionMarginUninvolved.hbm.xml +15 -0
  13. data/conf/annotation/pathology_scg/ColorectalResectedMarginUninvolved.hbm.xml +22 -0
  14. data/conf/annotation/pathology_scg/Cytogenetics.hbm.xml +15 -0
  15. data/conf/annotation/pathology_scg/DeepMelanomaMargin.hbm.xml +16 -0
  16. data/conf/annotation/pathology_scg/Details.hbm.xml +14 -0
  17. data/conf/annotation/pathology_scg/DirectExtensionOfTumor.hbm.xml +14 -0
  18. data/conf/annotation/pathology_scg/DistalMargin.hbm.xml +15 -0
  19. data/conf/annotation/pathology_scg/DistanceFromAnalVerge.hbm.xml +23 -0
  20. data/conf/annotation/pathology_scg/DistantMetastasis.hbm.xml +19 -0
  21. data/conf/annotation/pathology_scg/ExcionalBiopsyMarginUninvolved.hbm.xml +15 -0
  22. data/conf/annotation/pathology_scg/ExcisionalBiopsyColorectalDeepMargin.hbm.xml +15 -0
  23. data/conf/annotation/pathology_scg/ExcisionalBiopsyColorectalLateralOrMucosalMargin.hbm.xml +15 -0
  24. data/conf/annotation/pathology_scg/ExtraprostaticExtension.hbm.xml +20 -0
  25. data/conf/annotation/pathology_scg/ExtraprostaticExtensionTissueSites.hbm.xml +14 -0
  26. data/conf/annotation/pathology_scg/GleasonScore.hbm.xml +16 -0
  27. data/conf/annotation/pathology_scg/HistologicGrade.hbm.xml +16 -0
  28. data/conf/annotation/pathology_scg/HistologicType.hbm.xml +19 -0
  29. data/conf/annotation/pathology_scg/HistologicVariantType.hbm.xml +14 -0
  30. data/conf/annotation/pathology_scg/ImmunoPhenotyping.hbm.xml +16 -0
  31. data/conf/annotation/pathology_scg/Invasion.hbm.xml +16 -0
  32. data/conf/annotation/pathology_scg/KidneyMarginLocation.hbm.xml +15 -0
  33. data/conf/annotation/pathology_scg/KidneyNephrectomyMargin.hbm.xml +19 -0
  34. data/conf/annotation/pathology_scg/LateralMelanomaMargin.hbm.xml +16 -0
  35. data/conf/annotation/pathology_scg/LocalExcisionColorectalDeepMargin.hbm.xml +15 -0
  36. data/conf/annotation/pathology_scg/LocalExcisionColorectalLateralMargin.hbm.xml +20 -0
  37. data/conf/annotation/pathology_scg/LungResectionMargin.hbm.xml +17 -0
  38. data/conf/annotation/pathology_scg/LungResectionMarginsUninvolved.hbm.xml +14 -0
  39. data/conf/annotation/pathology_scg/MacroscopicExtentOfTumor.hbm.xml +14 -0
  40. data/conf/annotation/pathology_scg/MesentricMargin.hbm.xml +15 -0
  41. data/conf/annotation/pathology_scg/MetastasisTissueSite.hbm.xml +15 -0
  42. data/conf/annotation/pathology_scg/Microcalcification.hbm.xml +14 -0
  43. data/conf/annotation/pathology_scg/NottinghamHistologicScore.hbm.xml +17 -0
  44. data/conf/annotation/pathology_scg/OtherResectedOrgans.hbm.xml +15 -0
  45. data/conf/annotation/pathology_scg/PancreasMargin.hbm.xml +20 -0
  46. data/conf/annotation/pathology_scg/PancreasMarginInvolvedByInvasiveCarcinoma.hbm.xml +15 -0
  47. data/conf/annotation/pathology_scg/PancreasMarginUninvolvedByInvasiveCarcinoma.hbm.xml +20 -0
  48. data/conf/annotation/pathology_scg/PathologicalStaging.hbm.xml +16 -0
  49. data/conf/annotation/pathology_scg/PolypConfiguration.hbm.xml +15 -0
  50. data/conf/annotation/pathology_scg/PrimaryTumorStage.hbm.xml +14 -0
  51. data/conf/annotation/pathology_scg/ProstateMarginLocation.hbm.xml +15 -0
  52. data/conf/annotation/pathology_scg/ProximalMargin.hbm.xml +15 -0
  53. data/conf/annotation/pathology_scg/RadialMargin.hbm.xml +15 -0
  54. data/conf/annotation/pathology_scg/RadicalProstatectomyMargin.hbm.xml +20 -0
  55. data/conf/annotation/pathology_scg/RegionalLymphNode.hbm.xml +19 -0
  56. data/conf/annotation/pathology_scg/SatelliteNodule.hbm.xml +14 -0
  57. data/conf/annotation/pathology_scg/SpecimenCollectionGroup.hbm.xml +87 -0
  58. data/conf/annotation/pathology_scg/SpecimenIntegrity.hbm.xml +15 -0
  59. data/conf/annotation/pathology_scg/SpecimenSize.hbm.xml +17 -0
  60. data/conf/annotation/pathology_scg/TissueSide.hbm.xml +14 -0
  61. data/conf/annotation/pathology_scg/TumorSize.hbm.xml +29 -0
  62. data/conf/annotation/pathology_scg/TumorTissueSite.hbm.xml +20 -0
  63. data/conf/annotation/pathology_scg/UninvolvedMelanomaMargin.hbm.xml +15 -0
  64. data/conf/annotation/pathology_specimen/AdditionalFinding.hbm.xml +19 -0
  65. data/conf/annotation/pathology_specimen/AdditionalPathologicFinding.hbm.xml +18 -0
  66. data/conf/annotation/pathology_specimen/Details.hbm.xml +15 -0
  67. data/conf/annotation/pathology_specimen/GleasonScore.hbm.xml +16 -0
  68. data/conf/annotation/pathology_specimen/HistologicGrade.hbm.xml +16 -0
  69. data/conf/annotation/pathology_specimen/HistologicType.hbm.xml +19 -0
  70. data/conf/annotation/pathology_specimen/HistologicVariantType.hbm.xml +14 -0
  71. data/conf/annotation/pathology_specimen/Invasion.hbm.xml +16 -0
  72. data/conf/annotation/pathology_specimen/NottinghamHistologicScore.hbm.xml +17 -0
  73. data/conf/annotation/pathology_specimen/Specimen.hbm.xml +52 -0
  74. data/conf/annotation/pathology_specimen/SpecimenBaseSolidTissuePathologyAnnotation.hbm.xml +73 -0
  75. data/examples/galena/lib/galena/cli/seed.rb +0 -21
  76. data/examples/galena/lib/galena/migration/frozen_shims.rb +6 -5
  77. data/examples/galena/lib/galena/seed/defaults.rb +0 -5
  78. data/{lib → examples/galena/lib}/galena.rb +0 -0
  79. data/lib/catissue/annotation/annotatable.rb +37 -0
  80. data/lib/catissue/annotation/annotatable_class.rb +255 -0
  81. data/lib/catissue/annotation/annotation.rb +49 -0
  82. data/lib/catissue/annotation/annotation_class.rb +277 -0
  83. data/lib/catissue/annotation/annotation_module.rb +77 -0
  84. data/lib/catissue/annotation/hibernate_mapping.rb +46 -0
  85. data/lib/catissue/annotation/proxy.rb +28 -0
  86. data/lib/catissue/annotation/proxy_class.rb +68 -0
  87. data/lib/catissue/cli/migrate.rb +2 -2
  88. data/lib/catissue/cli/smoke.rb +6 -4
  89. data/lib/catissue/database/annotation/annotation_service.rb +75 -61
  90. data/lib/catissue/database/annotation/annotator.rb +17 -76
  91. data/lib/catissue/database/annotation/entity_facade.rb +265 -0
  92. data/lib/catissue/database/annotation/id_generator.rb +62 -0
  93. data/lib/catissue/database/annotation/integration_service.rb +105 -59
  94. data/lib/catissue/database/annotation/reference_writer.rb +150 -0
  95. data/lib/catissue/database/controlled_values.rb +12 -12
  96. data/lib/catissue/database.rb +148 -58
  97. data/lib/catissue/domain/abstract_specimen.rb +40 -14
  98. data/lib/catissue/domain/abstract_specimen_collection_group.rb +1 -3
  99. data/lib/catissue/domain/collection_protocol.rb +13 -5
  100. data/lib/catissue/domain/collection_protocol_event.rb +1 -14
  101. data/lib/catissue/domain/consent_tier_response.rb +2 -0
  102. data/lib/catissue/domain/consent_tier_status.rb +5 -3
  103. data/lib/catissue/domain/container.rb +14 -10
  104. data/lib/catissue/domain/container_position.rb +8 -0
  105. data/lib/catissue/domain/container_type.rb +13 -6
  106. data/lib/catissue/domain/participant.rb +15 -10
  107. data/lib/catissue/domain/site.rb +9 -3
  108. data/lib/catissue/domain/specimen.rb +79 -40
  109. data/lib/catissue/domain/specimen_array.rb +11 -1
  110. data/lib/catissue/domain/specimen_collection_group.rb +79 -41
  111. data/lib/catissue/domain/specimen_event_parameters.rb +5 -8
  112. data/lib/catissue/domain/specimen_position.rb +0 -2
  113. data/lib/catissue/domain/specimen_requirement.rb +1 -1
  114. data/lib/catissue/domain/storage_container.rb +109 -48
  115. data/lib/catissue/domain/storage_type.rb +1 -1
  116. data/lib/catissue/migration/migrator.rb +6 -14
  117. data/lib/catissue/resource.rb +18 -8
  118. data/lib/catissue/util/position.rb +11 -1
  119. data/lib/catissue/util/storable.rb +18 -11
  120. data/lib/catissue/util/storage_type_holder.rb +44 -6
  121. data/lib/catissue/version.rb +1 -1
  122. metadata +86 -35
  123. data/bin/migrate.rb +0 -42
  124. data/bin/seed.rb +0 -43
  125. data/examples/galena/doc/CaTissue/Participant.html +0 -241
  126. data/examples/galena/doc/CaTissue/SpecimenCollectionGroup.html +0 -190
  127. data/examples/galena/doc/CaTissue/StorageContainer.html +0 -179
  128. data/examples/galena/doc/CaTissue/TissueSpecimen.html +0 -320
  129. data/examples/galena/doc/CaTissue.html +0 -93
  130. data/examples/galena/doc/Galena/Seed/Defaults.html +0 -650
  131. data/examples/galena/doc/Galena/Seed.html +0 -203
  132. data/examples/galena/doc/Galena.html +0 -172
  133. data/examples/galena/doc/_index.html +0 -181
  134. data/examples/galena/doc/class_list.html +0 -36
  135. data/examples/galena/doc/css/common.css +0 -1
  136. data/examples/galena/doc/css/full_list.css +0 -53
  137. data/examples/galena/doc/css/style.css +0 -307
  138. data/examples/galena/doc/file.README.html +0 -153
  139. data/examples/galena/doc/file_list.html +0 -38
  140. data/examples/galena/doc/frames.html +0 -13
  141. data/examples/galena/doc/index.html +0 -153
  142. data/examples/galena/doc/js/app.js +0 -202
  143. data/examples/galena/doc/js/full_list.js +0 -149
  144. data/examples/galena/doc/js/jquery.js +0 -154
  145. data/examples/galena/doc/method_list.html +0 -163
  146. data/examples/galena/doc/top-level-namespace.html +0 -112
  147. data/lib/README.html +0 -33
  148. data/lib/catissue/database/annotation/annotatable_service.rb +0 -25
  149. data/lib/catissue/database/annotation/entity_manager.rb +0 -10
  150. data/lib/galena/cli/seed.rb +0 -43
  151. data/lib/galena/migration/filter_shims.rb +0 -43
  152. data/lib/galena/migration/frozen_shims.rb +0 -53
  153. data/lib/galena/seed/defaults.rb +0 -109
@@ -1,25 +0,0 @@
1
- require 'delegate'
2
- require 'caruby/database/persistence_service'
3
-
4
- module CaTissue
5
- module Annotation
6
- # An AnnotatableService queries and saves domain classes which hold annotation attributes.
7
- class AnnotatableService < DelegateClass(CaRuby::PersistenceService)
8
- def initialize(database, app_service, integration_service)
9
- super(app_service)
10
- @database = database
11
- @integration_service = integration_service
12
- end
13
- #
14
- # def create(obj)
15
- # super
16
- # # TODO - refactor CaRuby::Database to remove Annotation cases; iterate over each annotation attribute here
17
- # end
18
- #
19
- # def update(obj)
20
- # super
21
- # # TODO - refactor CaRuby::Database to remove Annotation cases; iterate over each annotation attribute here
22
- # end
23
- end
24
- end
25
- end
@@ -1,10 +0,0 @@
1
- require 'caruby/import/java'
2
-
3
- module CaTissue
4
- module Annotation
5
- # EntityManager dependencies
6
- java_import('edu.wustl.common.security.exceptions.UserNotAuthorizedException')
7
- # EntityManager is the caTissue singleton Winnebago object for persisting annotations.
8
- java_import('edu.common.dynamicextensions.entitymanager.EntityManager')
9
- end
10
- end
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env jruby
2
- #
3
- # == Synopsis
4
- #
5
- # catissue-seed-galena.rb: seeds the Galena example administrative objects in the database
6
- #
7
- # == Usage
8
- #
9
- # catissue-seed-galena.rb [options] file
10
- #
11
- # --help, -h:
12
- # print this help message and exit
13
- #
14
- # --log file, -l file:
15
- # log file (default ./log/migration.log)
16
- #
17
- # --debug, -d:
18
- # print debug messages to log (optional)
19
- #
20
- # == License
21
- #
22
- # This program is licensed under the terms of the +LEGAL+ file in
23
- # the source distribution.
24
-
25
- # load the required gems
26
- require 'rubygems'
27
- begin
28
- gem 'caruby-tissue'
29
- rescue LoadError
30
- # if the gem is not available, then try a local source
31
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
32
- $:.unshift File.join(File.dirname(__FILE__), '..', 'examples', 'galena', 'lib')
33
- end
34
-
35
- # the default log file
36
- DEF_LOG_FILE = 'log/migration.log'
37
-
38
- require 'catissue'
39
- require 'catissue/cli/command'
40
-
41
- require 'galena/seed/defaults'
42
-
43
- CaTissue::Command.new.execute { Galena::Seed.defaults.ensure_exists }
@@ -1,43 +0,0 @@
1
- require 'uom'
2
-
3
- module CaTissue
4
-
5
- # Declares the classes modified for migration.
6
- shims Participant, TissueSpecimen, SpecimenCollectionGroup
7
-
8
- class Participant
9
- # Extracts the Participant first name from the +Initials+ input field.
10
- def migrate_first_name(value, row)
11
- self.first_name = value[0, 1]
12
- end
13
-
14
- # Extracts the Participant last name from the +Initials+ input field.
15
- def migrate_last_name(value, row)
16
- self.last_name = value[-1, 1]
17
- end
18
- end
19
-
20
- class TissueSpecimen
21
- # Transforms the +Frozen?+ flag input field to the caTissue specimen type +Frozen Tissue+ value.
22
- def migrate_specimen_type(value, row)
23
- 'Frozen Tissue' if value =~ /TRUE/i
24
- end
25
-
26
- # Parses the source field as a UOM::Measurement if it is a string.
27
- # Otherwises, returns the source value.
28
- def migrate_initial_quantity(value, row)
29
- # if value is not a string, then use it as is
30
- return value unless value.is_a?(String)
31
- # the value has a unit qualifier; parse the measurement.
32
- # the unit is normalized to the Specimen standard unit.
33
- value.to_measurement_quantity(standard_unit)
34
- end
35
- end
36
-
37
- class SpecimenCollectionGroup
38
- # Returns whether this SCG has a SPN.
39
- def migration_valid?
40
- surgical_pathology_number
41
- end
42
- end
43
- end
@@ -1,53 +0,0 @@
1
- # load the defaults file in the seed directory
2
- require File.join(File.dirname(__FILE__), '..', 'seed', 'defaults')
3
-
4
- module CaTissue
5
- # Declares the classes modified for migration.
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
-
18
- class CollectionProtocolRegistration
19
- # Sets this CPR's protocol to the pre-defined {Galena::Migration::Defaults#protocol}.
20
- #
21
- # @param (see CaRuby::Migratable#migrate)
22
- def migrate(row, migrated)
23
- super
24
- self.protocol = Galena::Seed.defaults.protocol
25
- end
26
- end
27
-
28
- class StorageContainer
29
- # Creates the migrated box in the database, if necessary.
30
- #
31
- # @param (see CaRuby::Migratable#migrate)
32
- def migrate(row, migrated)
33
- super
34
- find or create_box
35
- end
36
-
37
- private
38
-
39
- # Creates a new box of type {Galena::Seed::Defaults#box_type} in a freezer of type
40
- # {Galena::Seed::Defaults#freezer_type}.
41
- #
42
- # @return [StorageContainer] the new box
43
- def create_box
44
- defs = Galena::Seed.defaults
45
- self.storage_type = defs.box_type
46
- # A freezer with a spot for the box
47
- frz = defs.freezer_type.find_available(site, :create)
48
- if frz.nil? then raise CaRuby::MigrationError.new("Freezer not available to place #{self}") end
49
- # Add this box to the first open slot in the first unfilled rack in the freezer.
50
- frz << self
51
- end
52
- end
53
- end
@@ -1,109 +0,0 @@
1
- require 'singleton'
2
- require 'catissue'
3
-
4
- module Galena
5
- # Creates the {Galena::Seed::Defaults} administrative objects as necessary.
6
- def self.seed
7
- Seed.defaults.ensure_exists
8
- end
9
-
10
- # Galena example utility module to populate the database with pre-defined administrative objects.
11
- module Seed
12
- # @return [Defaults] the defaults instance
13
- def self.defaults
14
- Defaults.instance
15
- end
16
-
17
- # Pre-defined Galena example administrative objects. If the Galena example is already set up
18
- # in the caTissue database, then the default object secondary key attributes can be used as a
19
- # {CaRuby::Persistable#find} template to retrieve the existing objects. Otherwise, the Defaults
20
- # attributes can be created by calling {CaRuby::Persistable#create}.
21
- #
22
- # In a real-world use case, the administrative objects are typically built in the UI before-hand.
23
- # In that case, it is only necessary to define the object secondary key rather than content, e.g.:
24
- # pcl = CaTissue::CollectionProtocol.new(:short_title => 'Galena CP')
25
- # The complete definitions are included in this method for convenience in order to seed the
26
- # example in a test database. A real-world migration might find it useful to create a similar
27
- # defaults file in order to rapidly seed an empty test or staging database.
28
- class Defaults
29
- include Singleton
30
-
31
- attr_reader :protocol, :hospital, :tissue_bank, :freezer_type, :box_type
32
-
33
- # Creates the Galena example Defaults singleton and populates the attributes.
34
- def initialize
35
- super
36
- populate
37
- end
38
-
39
- # Creates the Galena example administrative objects as necessary.
40
- def ensure_exists
41
- @protocol.find(:create)
42
- @hospital.find(:create)
43
- @surgeon.find(:create)
44
- @box.find(:create)
45
- end
46
-
47
- private
48
-
49
- # Sets the Galena example Defaults attributes to new objects.
50
- def populate
51
- galena = CaTissue::Institution.new(:name => 'Galena University')
52
-
53
- addr = CaTissue::Address.new(
54
- :city => 'Galena', :state => 'Illinois', :country => 'United States', :zipCode => '37544',
55
- :street => '411 Basin St', :phoneNumber => '311-555-5555')
56
-
57
- dept = CaTissue::Department.new(:name => 'Pathology')
58
-
59
- crg = CaTissue::CancerResearchGroup.new(:name => 'Don Thomas Cancer Center')
60
-
61
- coord = CaTissue::User.new(
62
- :email_address => 'corey.nator@galena.edu',
63
- :last_name => 'Nator', :first_name => 'Corey', :address => addr.copy,
64
- :institution => galena, :department => dept, :cancer_research_group => crg)
65
-
66
- @hospital = CaTissue::Site.new(
67
- :site_type => CaTissue::Site::SiteType::COLLECTION, :name => 'Galena Hospital',
68
- :address => addr, :coordinator => coord)
69
-
70
- @tissue_bank = CaTissue::Site.new(
71
- :site_type => CaTissue::Site::SiteType::REPOSITORY, :name => 'Galena Tissue Bank',
72
- :address => addr, :coordinator => coord)
73
-
74
- pi = CaTissue::User.new(
75
- :email_address => 'vesta.gator@galena.edu',
76
- :last_name => 'Gator', :first_name => 'Vesta', :address => addr.copy,
77
- :institution => galena, :department => dept, :cancer_research_group => crg)
78
-
79
- @surgeon = CaTissue::User.new(
80
- :email_address => 'serge.on@galena.edu',
81
- :first_name => 'Serge', :last_name => 'On', :address => addr.copy,
82
- :institution => galena, :department => dept, :cancer_research_group => crg)
83
-
84
- @protocol = CaTissue::CollectionProtocol.new(:short_title => 'Galena Migration',
85
- :principal_investigator => pi, :sites => [@tissue_bank])
86
-
87
- # CPE has default 1.0 event point and label
88
- cpe = CaTissue::CollectionProtocolEvent.new(:collection_protocol => @protocol)
89
-
90
- # the sole specimen requirement. Setting the requirement collection_event attribute to a CPE automatically
91
- # sets the CPE requirement inverse attribute in caRuby.
92
- CaTissue::TissueSpecimenRequirement.new(:collection_event => cpe, :specimen_type => 'Fixed Tissue')
93
-
94
- # the storage container type hierarchy
95
- @freezer_type = CaTissue::StorageType.new(:name => 'GTB Freezer', :columns => 10, :rows => 1, :column_label => 'Rack')
96
- rack_type = CaTissue::StorageType.new(:name => 'GTB Rack', :columns => 10, :rows => 10)
97
- @box_type = CaTissue::StorageType.new(:name => 'GTB Box', :columns => 10, :rows => 10)
98
- @freezer_type << rack_type
99
- rack_type << box_type
100
- @box_type << 'Tissue'
101
-
102
- # a sample freezer and box
103
- frz = CaTissue::StorageContainer.new(:name => 'GTB Freezer 1', :storage_type=>@freezer_type, :site=>@tissue_bank)
104
- @box = CaTissue::StorageContainer.new(:name => 'GTB Box 1', :storage_type=>@box_type)
105
- frz << @box
106
- end
107
- end
108
- end
109
- end