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.
- data/History.txt +4 -0
- data/bin/crtdump +11 -3
- data/bin/{seed → crtseed} +0 -0
- data/conf/annotation/pathology_scg/AdditionalFinding.hbm.xml +19 -0
- data/conf/annotation/pathology_scg/BasePathologyAnnotation.hbm.xml +260 -0
- data/conf/annotation/pathology_scg/BreastMargin.hbm.xml +21 -0
- data/conf/annotation/pathology_scg/BreastMarginInvolved.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/BreastMarginUninvolved.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/CNSMargin.hbm.xml +19 -0
- data/conf/annotation/pathology_scg/CNSMarginLocation.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/CarcinomaInSituStatus.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/ColorectalLocalExcisionMarginUninvolved.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/ColorectalResectedMarginUninvolved.hbm.xml +22 -0
- data/conf/annotation/pathology_scg/Cytogenetics.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/DeepMelanomaMargin.hbm.xml +16 -0
- data/conf/annotation/pathology_scg/Details.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/DirectExtensionOfTumor.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/DistalMargin.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/DistanceFromAnalVerge.hbm.xml +23 -0
- data/conf/annotation/pathology_scg/DistantMetastasis.hbm.xml +19 -0
- data/conf/annotation/pathology_scg/ExcionalBiopsyMarginUninvolved.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/ExcisionalBiopsyColorectalDeepMargin.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/ExcisionalBiopsyColorectalLateralOrMucosalMargin.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/ExtraprostaticExtension.hbm.xml +20 -0
- data/conf/annotation/pathology_scg/ExtraprostaticExtensionTissueSites.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/GleasonScore.hbm.xml +16 -0
- data/conf/annotation/pathology_scg/HistologicGrade.hbm.xml +16 -0
- data/conf/annotation/pathology_scg/HistologicType.hbm.xml +19 -0
- data/conf/annotation/pathology_scg/HistologicVariantType.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/ImmunoPhenotyping.hbm.xml +16 -0
- data/conf/annotation/pathology_scg/Invasion.hbm.xml +16 -0
- data/conf/annotation/pathology_scg/KidneyMarginLocation.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/KidneyNephrectomyMargin.hbm.xml +19 -0
- data/conf/annotation/pathology_scg/LateralMelanomaMargin.hbm.xml +16 -0
- data/conf/annotation/pathology_scg/LocalExcisionColorectalDeepMargin.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/LocalExcisionColorectalLateralMargin.hbm.xml +20 -0
- data/conf/annotation/pathology_scg/LungResectionMargin.hbm.xml +17 -0
- data/conf/annotation/pathology_scg/LungResectionMarginsUninvolved.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/MacroscopicExtentOfTumor.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/MesentricMargin.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/MetastasisTissueSite.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/Microcalcification.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/NottinghamHistologicScore.hbm.xml +17 -0
- data/conf/annotation/pathology_scg/OtherResectedOrgans.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/PancreasMargin.hbm.xml +20 -0
- data/conf/annotation/pathology_scg/PancreasMarginInvolvedByInvasiveCarcinoma.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/PancreasMarginUninvolvedByInvasiveCarcinoma.hbm.xml +20 -0
- data/conf/annotation/pathology_scg/PathologicalStaging.hbm.xml +16 -0
- data/conf/annotation/pathology_scg/PolypConfiguration.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/PrimaryTumorStage.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/ProstateMarginLocation.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/ProximalMargin.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/RadialMargin.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/RadicalProstatectomyMargin.hbm.xml +20 -0
- data/conf/annotation/pathology_scg/RegionalLymphNode.hbm.xml +19 -0
- data/conf/annotation/pathology_scg/SatelliteNodule.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/SpecimenCollectionGroup.hbm.xml +87 -0
- data/conf/annotation/pathology_scg/SpecimenIntegrity.hbm.xml +15 -0
- data/conf/annotation/pathology_scg/SpecimenSize.hbm.xml +17 -0
- data/conf/annotation/pathology_scg/TissueSide.hbm.xml +14 -0
- data/conf/annotation/pathology_scg/TumorSize.hbm.xml +29 -0
- data/conf/annotation/pathology_scg/TumorTissueSite.hbm.xml +20 -0
- data/conf/annotation/pathology_scg/UninvolvedMelanomaMargin.hbm.xml +15 -0
- data/conf/annotation/pathology_specimen/AdditionalFinding.hbm.xml +19 -0
- data/conf/annotation/pathology_specimen/AdditionalPathologicFinding.hbm.xml +18 -0
- data/conf/annotation/pathology_specimen/Details.hbm.xml +15 -0
- data/conf/annotation/pathology_specimen/GleasonScore.hbm.xml +16 -0
- data/conf/annotation/pathology_specimen/HistologicGrade.hbm.xml +16 -0
- data/conf/annotation/pathology_specimen/HistologicType.hbm.xml +19 -0
- data/conf/annotation/pathology_specimen/HistologicVariantType.hbm.xml +14 -0
- data/conf/annotation/pathology_specimen/Invasion.hbm.xml +16 -0
- data/conf/annotation/pathology_specimen/NottinghamHistologicScore.hbm.xml +17 -0
- data/conf/annotation/pathology_specimen/Specimen.hbm.xml +52 -0
- data/conf/annotation/pathology_specimen/SpecimenBaseSolidTissuePathologyAnnotation.hbm.xml +73 -0
- data/examples/galena/lib/galena/cli/seed.rb +0 -21
- data/examples/galena/lib/galena/migration/frozen_shims.rb +6 -5
- data/examples/galena/lib/galena/seed/defaults.rb +0 -5
- data/{lib → examples/galena/lib}/galena.rb +0 -0
- data/lib/catissue/annotation/annotatable.rb +37 -0
- data/lib/catissue/annotation/annotatable_class.rb +255 -0
- data/lib/catissue/annotation/annotation.rb +49 -0
- data/lib/catissue/annotation/annotation_class.rb +277 -0
- data/lib/catissue/annotation/annotation_module.rb +77 -0
- data/lib/catissue/annotation/hibernate_mapping.rb +46 -0
- data/lib/catissue/annotation/proxy.rb +28 -0
- data/lib/catissue/annotation/proxy_class.rb +68 -0
- data/lib/catissue/cli/migrate.rb +2 -2
- data/lib/catissue/cli/smoke.rb +6 -4
- data/lib/catissue/database/annotation/annotation_service.rb +75 -61
- data/lib/catissue/database/annotation/annotator.rb +17 -76
- data/lib/catissue/database/annotation/entity_facade.rb +265 -0
- data/lib/catissue/database/annotation/id_generator.rb +62 -0
- data/lib/catissue/database/annotation/integration_service.rb +105 -59
- data/lib/catissue/database/annotation/reference_writer.rb +150 -0
- data/lib/catissue/database/controlled_values.rb +12 -12
- data/lib/catissue/database.rb +148 -58
- data/lib/catissue/domain/abstract_specimen.rb +40 -14
- data/lib/catissue/domain/abstract_specimen_collection_group.rb +1 -3
- data/lib/catissue/domain/collection_protocol.rb +13 -5
- data/lib/catissue/domain/collection_protocol_event.rb +1 -14
- data/lib/catissue/domain/consent_tier_response.rb +2 -0
- data/lib/catissue/domain/consent_tier_status.rb +5 -3
- data/lib/catissue/domain/container.rb +14 -10
- data/lib/catissue/domain/container_position.rb +8 -0
- data/lib/catissue/domain/container_type.rb +13 -6
- data/lib/catissue/domain/participant.rb +15 -10
- data/lib/catissue/domain/site.rb +9 -3
- data/lib/catissue/domain/specimen.rb +79 -40
- data/lib/catissue/domain/specimen_array.rb +11 -1
- data/lib/catissue/domain/specimen_collection_group.rb +79 -41
- data/lib/catissue/domain/specimen_event_parameters.rb +5 -8
- data/lib/catissue/domain/specimen_position.rb +0 -2
- data/lib/catissue/domain/specimen_requirement.rb +1 -1
- data/lib/catissue/domain/storage_container.rb +109 -48
- data/lib/catissue/domain/storage_type.rb +1 -1
- data/lib/catissue/migration/migrator.rb +6 -14
- data/lib/catissue/resource.rb +18 -8
- data/lib/catissue/util/position.rb +11 -1
- data/lib/catissue/util/storable.rb +18 -11
- data/lib/catissue/util/storage_type_holder.rb +44 -6
- data/lib/catissue/version.rb +1 -1
- metadata +86 -35
- data/bin/migrate.rb +0 -42
- data/bin/seed.rb +0 -43
- data/examples/galena/doc/CaTissue/Participant.html +0 -241
- data/examples/galena/doc/CaTissue/SpecimenCollectionGroup.html +0 -190
- data/examples/galena/doc/CaTissue/StorageContainer.html +0 -179
- data/examples/galena/doc/CaTissue/TissueSpecimen.html +0 -320
- data/examples/galena/doc/CaTissue.html +0 -93
- data/examples/galena/doc/Galena/Seed/Defaults.html +0 -650
- data/examples/galena/doc/Galena/Seed.html +0 -203
- data/examples/galena/doc/Galena.html +0 -172
- data/examples/galena/doc/_index.html +0 -181
- data/examples/galena/doc/class_list.html +0 -36
- data/examples/galena/doc/css/common.css +0 -1
- data/examples/galena/doc/css/full_list.css +0 -53
- data/examples/galena/doc/css/style.css +0 -307
- data/examples/galena/doc/file.README.html +0 -153
- data/examples/galena/doc/file_list.html +0 -38
- data/examples/galena/doc/frames.html +0 -13
- data/examples/galena/doc/index.html +0 -153
- data/examples/galena/doc/js/app.js +0 -202
- data/examples/galena/doc/js/full_list.js +0 -149
- data/examples/galena/doc/js/jquery.js +0 -154
- data/examples/galena/doc/method_list.html +0 -163
- data/examples/galena/doc/top-level-namespace.html +0 -112
- data/lib/README.html +0 -33
- data/lib/catissue/database/annotation/annotatable_service.rb +0 -25
- data/lib/catissue/database/annotation/entity_manager.rb +0 -10
- data/lib/galena/cli/seed.rb +0 -43
- data/lib/galena/migration/filter_shims.rb +0 -43
- data/lib/galena/migration/frozen_shims.rb +0 -53
- data/lib/galena/seed/defaults.rb +0 -109
@@ -17,24 +17,18 @@ module CaTissue
|
|
17
17
|
def specimen_positions
|
18
18
|
getSpecimenPositionCollection or (self.specimen_positions = Java::JavaUtil::LinkedHashSet.new)
|
19
19
|
end
|
20
|
-
|
21
|
-
#
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
if
|
31
|
-
|
32
|
-
end
|
33
|
-
setStorageType(value)
|
34
|
-
end
|
35
|
-
|
36
|
-
def located_at_position=(value)
|
37
|
-
setLocatedAtPosition(value)
|
20
|
+
|
21
|
+
# Copies the given container type child types to this container instance child types.
|
22
|
+
#
|
23
|
+
# caTissue alert - caTissue API does not initialize the container child types to
|
24
|
+
# the container type child types. This method copies the container type child types
|
25
|
+
# to this container instance before it is created.
|
26
|
+
#
|
27
|
+
# @param [<StorageType>] type the storage type to set
|
28
|
+
def storage_type=(type)
|
29
|
+
setStorageType(type)
|
30
|
+
copy_child_types(type) if type
|
31
|
+
type
|
38
32
|
end
|
39
33
|
|
40
34
|
add_attribute_aliases(:container_type => :storage_type)
|
@@ -42,7 +36,7 @@ module CaTissue
|
|
42
36
|
# Aternative to the inherited secondary key +name+.
|
43
37
|
set_alternate_key_attributes(:site, :barcode)
|
44
38
|
|
45
|
-
add_mandatory_attributes(:
|
39
|
+
add_mandatory_attributes(:storage_type)
|
46
40
|
|
47
41
|
qualify_attribute(:collection_protocols, :fetched)
|
48
42
|
|
@@ -53,8 +47,9 @@ module CaTissue
|
|
53
47
|
set_attribute_type(:holds_storage_types, CaTissue::StorageType)
|
54
48
|
|
55
49
|
def initialize(params=nil)
|
50
|
+
# set params below to enable storage_type setter work-around
|
56
51
|
super(params)
|
57
|
-
# JRuby alert - specimen_positions is
|
52
|
+
# JRuby alert - specimen_positions is not recognized unless primed with respond_to? call
|
58
53
|
respond_to?(:specimen_positions)
|
59
54
|
# work around caTissue Bug #64
|
60
55
|
self.specimen_positions ||= Java::JavaUtil::LinkedHashSet.new
|
@@ -67,12 +62,18 @@ module CaTissue
|
|
67
62
|
|
68
63
|
alias :add_local :add
|
69
64
|
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
65
|
+
# Adds the given storable to this container. If the storable has a current position, then
|
66
|
+
# the storable is moved from that position to this container. The new position is given
|
67
|
+
# by the given coordinate, if given to this method.
|
73
68
|
#
|
74
|
-
#
|
75
|
-
#
|
69
|
+
#The default coordinate is the first available slot within this Container.
|
70
|
+
# If this container cannot hold the storable type, then the storable is added to a
|
71
|
+
# subcontainer which can hold the storable type.
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# rack << box #=> places the tissue box on the rack
|
75
|
+
# freezer << box #=> places the tissue box on a rack in the freezer
|
76
|
+
# freezer << specimen #=> places the specimen in the first available box in the freezer
|
76
77
|
#
|
77
78
|
# @param [Storable] the item to add
|
78
79
|
# @param [Coordinate] the storage location (default is first available location)
|
@@ -105,7 +106,7 @@ module CaTissue
|
|
105
106
|
box
|
106
107
|
end
|
107
108
|
|
108
|
-
# @return a new
|
109
|
+
# @return [Container] a new container with the given name and type, located in this container
|
109
110
|
def create_subcontainer(name, type)
|
110
111
|
logger.debug { "Creating #{qp} subcontainer of type #{type} with name #{name}..." }
|
111
112
|
ctr = type.create_container(:name => name, :site => site)
|
@@ -115,6 +116,17 @@ module CaTissue
|
|
115
116
|
ctr
|
116
117
|
end
|
117
118
|
|
119
|
+
# Overrides {Container#can_hold_child?} to detect account for the potential instance-specific
|
120
|
+
# {StorageTypeHolder#child_types} override allowed by caTissue.
|
121
|
+
#
|
122
|
+
# @param [Storable] (see #add)
|
123
|
+
# @return [Boolean] whether this container is not full and can hold the given item's
|
124
|
+
# {CaTissue::StorableType}
|
125
|
+
def can_hold_child?(storable)
|
126
|
+
st = storable.storable_type
|
127
|
+
not full? and child_types.any? { |ct| CaRuby::Resource.value_equal?(ct, st) }
|
128
|
+
end
|
129
|
+
|
118
130
|
protected
|
119
131
|
|
120
132
|
# Returns the the content collection to which the storable is added, specimen_positions
|
@@ -127,14 +139,33 @@ module CaTissue
|
|
127
139
|
#
|
128
140
|
# @param @storable (see #add)
|
129
141
|
# @return [StorageContainer, nil] self if added, nil otherwise
|
142
|
+
# @raise [ValidationError] if this container does not have a storage type, or if a circular
|
143
|
+
# containment reference is detected
|
130
144
|
def add_to_existing_container(storable)
|
145
|
+
if storage_type.nil? then raise ValidationError.new("Cannot add #{storable.qp} to #{qp} with missing storage type") end
|
131
146
|
# the subcontainers in column, row sort order
|
132
147
|
scs = subcontainers.sort { |sc1, sc2| sc1.position.location <=> sc2.position.location }
|
148
|
+
logger.debug { "Looking for a #{self} subcontainer from among #{scs.pp_s} to place #{storable.qp}..." } unless scs.empty?
|
133
149
|
# the first subcontainer that can hold the storable is preferred
|
134
|
-
|
150
|
+
sc = scs.detect do |sc|
|
151
|
+
# Check for circular reference. This occurred as a result of the caTissue bug described
|
152
|
+
# in CaTissue::Database#query_object. The work-around circumvents the bug for now, but
|
153
|
+
# it doesn't hurt to check again.
|
154
|
+
if identifier and sc.identifier == identifier then
|
155
|
+
raise ValidationError.new("#{self} has a circular containment reference to subcontainer #{sc}")
|
156
|
+
end
|
157
|
+
# No circular reference; add to subcontainer if possible
|
158
|
+
sc.add_to_existing_container(storable) if StorageContainer === sc
|
159
|
+
end
|
160
|
+
if sc then
|
161
|
+
logger.debug { "#{self} subcontainer #{sc} stored #{storable.qp}." }
|
135
162
|
self
|
136
163
|
elsif can_hold_child?(storable) then
|
164
|
+
logger.debug { "#{self} can hold #{storable.qp}." }
|
137
165
|
add_local(storable)
|
166
|
+
else
|
167
|
+
logger.debug { "Neither #{self} of type #{storage_type.name} nor its subcontainers can hold #{storable.qp}." }
|
168
|
+
nil
|
138
169
|
end
|
139
170
|
end
|
140
171
|
|
@@ -145,31 +176,38 @@ module CaTissue
|
|
145
176
|
def add_to_new_subcontainer(storable)
|
146
177
|
# the subcontainers in column, row sort order
|
147
178
|
scs = subcontainers.sort { |sc1, sc2| sc1.position.location <=> sc2.position.location }
|
179
|
+
logger.debug { "Looking for a #{self} subcontainer #{scs} to place a new #{storable.qp} container..." } unless scs.empty?
|
148
180
|
# the first subcontainer that can hold the new subcontainer is preferred
|
149
|
-
|
181
|
+
sc = scs.detect { |sc| sc.add_to_new_subcontainer(storable) if StorageContainer === sc }
|
182
|
+
if sc then
|
183
|
+
logger.debug { "#{self} subcontainer #{sc} stored #{storable.qp}." }
|
150
184
|
self
|
151
185
|
elsif not full? then
|
186
|
+
logger.debug { "Creating #{self} of type #{storage_type} subcontainer to hold #{storable.qp}..." }
|
152
187
|
create_subcontainer_for(storable)
|
153
188
|
end
|
154
189
|
end
|
155
190
|
|
156
|
-
|
157
|
-
|
158
|
-
def can_hold_child?(storable)
|
159
|
-
st = storable.storable_type
|
160
|
-
not full? and child_types.any? { |ct| CaRuby::Resource.value_equal?(ct, st) }
|
191
|
+
def child_types
|
192
|
+
holds_storage_types.union(holds_specimen_classes).union(holds_specimen_array_types)
|
161
193
|
end
|
162
|
-
|
194
|
+
|
163
195
|
private
|
164
|
-
|
165
|
-
#
|
166
|
-
#
|
196
|
+
|
197
|
+
# Copies the other child types into this container's child types.
|
198
|
+
#
|
199
|
+
# @param [StorageTypeHolder] other the source child type holder
|
200
|
+
# @see #storage_type=
|
201
|
+
def copy_child_types(other)
|
202
|
+
child_storage_types.merge!(other.child_storage_types)
|
203
|
+
child_specimen_array_types.merge!(other.child_specimen_array_types)
|
204
|
+
child_specimen_classes.merge!(other.child_specimen_classes)
|
205
|
+
end
|
206
|
+
|
207
|
+
# Adds the following defaults:
|
167
208
|
# * the default site is the parent container site, if any.
|
168
209
|
def add_defaults_local
|
169
210
|
super
|
170
|
-
if child_types.empty? and container_type and not container_type.child_types.empty? then
|
171
|
-
container_type.child_types.each { |type| add_child_type(type) }
|
172
|
-
end
|
173
211
|
# Although this default is set by the caTissue app, it is good practice to do so here
|
174
212
|
# for clarity.
|
175
213
|
self.site ||= parent.site if parent
|
@@ -180,23 +218,46 @@ module CaTissue
|
|
180
218
|
# the StorageType path to storable
|
181
219
|
type_path = type_path_to(storable) || return
|
182
220
|
# create a container for each type leading to storable and add it to the parent container
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
logger.debug { "Created #{qp} #{
|
187
|
-
|
221
|
+
sc = type_path.reverse.inject(storable) do |occ, type|
|
222
|
+
ctr = type.create_container
|
223
|
+
ctr.site = site
|
224
|
+
logger.debug { "Created #{qp} #{ctr.container_type.name} subcontainer #{ctr} to hold #{occ}." }
|
225
|
+
ctr << occ
|
188
226
|
end
|
189
|
-
|
227
|
+
logger.debug { "Adding #{qp} subcontainer #{sc.qp} with stored #{storable.qp}." }
|
228
|
+
add_local(sc)
|
190
229
|
end
|
191
230
|
|
192
231
|
# Returns a StorageType array from a child StorageType to a descendant StorageType which can
|
193
232
|
# hold the given storable, or nil if no such path exists.
|
233
|
+
#
|
234
|
+
# @param [Storable] the domain object to store in this container
|
235
|
+
# @return [<StorageType>] the {StorageType}s leading from this container to the storable holder
|
194
236
|
def type_path_to(storable)
|
195
237
|
holds_storage_types.detect_value { |type| type.path_to(storable) }
|
196
238
|
end
|
197
239
|
|
198
|
-
|
199
|
-
|
240
|
+
# Adds the given storage type to the set of types which can be held.
|
241
|
+
#
|
242
|
+
# @param type [StorageType] the type to add
|
243
|
+
def add_storage_type(type)
|
244
|
+
storage_types << type
|
245
|
+
end
|
246
|
+
|
247
|
+
# Adds the given speicmen array type to the set of types which can be held.
|
248
|
+
#
|
249
|
+
# @param type [SpecimenArrayType] the type to add
|
250
|
+
def add_specimen_array_type(type)
|
251
|
+
storage_types << type
|
252
|
+
end
|
253
|
+
|
254
|
+
# Adds the given specimen class to the set of types which can be held.
|
255
|
+
#
|
256
|
+
# @param type [String] the type to add
|
257
|
+
def add_specimen_class(type)
|
258
|
+
storage_types << type
|
259
|
+
end
|
260
|
+
|
200
261
|
def out_of_bounds(storable)
|
201
262
|
raise IndexError.new("Container #{name} does not have an available position for #{storable}")
|
202
263
|
end
|
@@ -41,7 +41,7 @@ module CaTissue
|
|
41
41
|
# Returns a StorageType array from this StorageType to a descendant StorageType which can
|
42
42
|
# hold the given storable, or nil if no such path exists.
|
43
43
|
def path_to(storable)
|
44
|
-
|
44
|
+
return [self] if can_hold_child?(storable)
|
45
45
|
path = holds_storage_types.detect_value { |child| child.path_to(storable) }
|
46
46
|
return path.unshift(self) if path
|
47
47
|
end
|
@@ -5,13 +5,6 @@ require 'catissue/database/controlled_values'
|
|
5
5
|
require 'catissue/database/controlled_value_finder'
|
6
6
|
|
7
7
|
module CaTissue
|
8
|
-
# Even though Migratable is included in CaRuby::Resource, the Migratable methods
|
9
|
-
# are not appended to a CaTissue Resource class since the class already includes
|
10
|
-
# CaRuby::Resource. In Ruby, A include B followed by B include C does not imply
|
11
|
-
# that A includes C. Therefore, notify CaTissue that its mixin has changed and each
|
12
|
-
# loaded class must reinclude the mixin.
|
13
|
-
CaTissue.mixin_changed
|
14
|
-
|
15
8
|
# Migrates a CSV extract to caTissue. See the {#initialize} documentation for usage options.
|
16
9
|
#
|
17
10
|
# See the Galena Cancer Center Tissue Bank Migration Example for further information
|
@@ -88,19 +81,18 @@ module CaTissue
|
|
88
81
|
def clear(target)
|
89
82
|
pcl = target_protocol(target) || return
|
90
83
|
logger.debug { "Clearing #{pcl.qp} CPR and SCG references..." }
|
91
|
-
|
84
|
+
@database.lazy_loader.suspend do
|
92
85
|
pcl.registrations.clear
|
93
|
-
pcl.events.each { |event| event.
|
86
|
+
pcl.events.each { |event| event.specimen_collection_groups.clear }
|
94
87
|
end
|
95
88
|
end
|
96
89
|
|
97
90
|
def target_protocol(target)
|
98
91
|
case target
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
target_protocol(target.specimen_collection_group)
|
92
|
+
when CaTissue::SpecimenCollectionGroup then
|
93
|
+
cpe = target.collection_protocol_event
|
94
|
+
cpe.collection_protocol if cpe
|
95
|
+
when CaTissue::Specimen then target_protocol(target.specimen_collection_group)
|
104
96
|
end
|
105
97
|
end
|
106
98
|
end
|
data/lib/catissue/resource.rb
CHANGED
@@ -1,12 +1,27 @@
|
|
1
1
|
require 'caruby/resource'
|
2
|
+
require 'caruby/domain/attribute_initializer'
|
2
3
|
require 'caruby/domain/resource_module'
|
4
|
+
require 'catissue/annotation/annotatable'
|
3
5
|
|
4
6
|
module CaTissue
|
5
7
|
extend CaRuby::ResourceModule
|
6
8
|
|
7
9
|
# The module included by all CaTissue domain classes.
|
8
10
|
module Resource
|
9
|
-
include CaRuby::Resource
|
11
|
+
include CaRuby::Resource, CaRuby::IdAlias, CaRuby::AttributeInitializer, Annotatable
|
12
|
+
|
13
|
+
# Adds the given domain class to the CaTissue domain module.
|
14
|
+
#
|
15
|
+
# @param [Class] klass the included class
|
16
|
+
def self.included(klass)
|
17
|
+
super
|
18
|
+
CaTissue.add_class(klass)
|
19
|
+
# defer loading AnnotatableClass to avoid pulling in Database, which in turn
|
20
|
+
# attempts to import java classes before the path is established. obscure
|
21
|
+
# detail, but don't know how to avoid it.
|
22
|
+
require 'catissue/annotation/annotatable_class'
|
23
|
+
klass.extend(AnnotatableClass)
|
24
|
+
end
|
10
25
|
|
11
26
|
# Returns whether each of the given attribute values either equals the
|
12
27
|
# respective other attribute value or one of the values is nil or 'Not Specified'.
|
@@ -21,7 +36,7 @@ module CaTissue
|
|
21
36
|
|
22
37
|
# Returns the CaTissue::Database which stores this object.
|
23
38
|
def database
|
24
|
-
|
39
|
+
CaTissue::Database.instance
|
25
40
|
end
|
26
41
|
|
27
42
|
protected
|
@@ -60,14 +75,9 @@ module CaTissue
|
|
60
75
|
def self.unpsecified_value?(value)
|
61
76
|
value.nil? or value == UNSPECIFIED
|
62
77
|
end
|
63
|
-
|
64
|
-
# Adds the given domain class to the CaTissue CaRuby::ResourceModule.
|
65
|
-
def self.included(klass)
|
66
|
-
CaTissue.add_class(klass)
|
67
|
-
end
|
68
78
|
end
|
69
79
|
|
70
|
-
# The
|
80
|
+
# The include mix-in module.
|
71
81
|
@mixin = Resource
|
72
82
|
|
73
83
|
# The required Java package name.
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'catissue/util/location'
|
2
|
+
require 'caruby/util/validation'
|
2
3
|
|
3
4
|
module CaTissue
|
4
5
|
# The Position mix-in encapsulates the location of an occupant in a holder.
|
5
6
|
# Classes which include Position are required to implement the column, row, occupant
|
6
|
-
# and holder methods.
|
7
|
+
# and holder methods. The occupant must be a {Storable}. The holder must be
|
8
|
+
# a {Container}.
|
7
9
|
module Position
|
8
10
|
include Comparable
|
9
11
|
|
@@ -50,5 +52,13 @@ module CaTissue
|
|
50
52
|
def to_a
|
51
53
|
[column, row]
|
52
54
|
end
|
55
|
+
|
56
|
+
# @raise [ValidationError] if the holder cannot hold the occupant type
|
57
|
+
def validate
|
58
|
+
super
|
59
|
+
unless holder.can_hold_child?(occupant) then
|
60
|
+
raise ValidationError.new("#{self} cannot be occupied by #{occupant}")
|
61
|
+
end
|
62
|
+
end
|
53
63
|
end
|
54
64
|
end
|
@@ -12,19 +12,26 @@ module CaTissue
|
|
12
12
|
position and position.container
|
13
13
|
end
|
14
14
|
|
15
|
-
# Moves this
|
16
|
-
# Coordinate coordinate. Returns the new position.
|
15
|
+
# Moves this storable from its current {Position}, if any, to the location given by the argument.
|
17
16
|
#
|
17
|
+
# @param [CaTissue::Container, CaTissue::Location, Hash] arg the target container, location, or options
|
18
|
+
# @option arg [CaTissue::Container] :in the target container
|
19
|
+
# @option arg [CaRuby::Coordinate, (Integer, Integer)] :at the target coordinates
|
20
|
+
# @return [Position] the new position
|
18
21
|
# @see Container#add
|
19
|
-
def move_to(
|
20
|
-
case
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
def move_to(arg)
|
23
|
+
case arg
|
24
|
+
when CaTissue::Container then arg.add(self)
|
25
|
+
when CaTissue::Location then
|
26
|
+
loc = arg
|
27
|
+
loc.container.add(self, loc.coordinate)
|
28
|
+
when Hash then
|
29
|
+
dest = arg[:in]
|
30
|
+
if at.nil? then raise ArgumentError.new("#{self} move_to container :in option not found") end
|
31
|
+
coord = arg[:at]
|
32
|
+
dest = CaTissue::Location.new(dest, coord) if coord
|
33
|
+
move_to(dest)
|
34
|
+
else raise ArgumentError.new("Target location is neither a Container nor a Location: #{arg.class.qp}")
|
28
35
|
end
|
29
36
|
position
|
30
37
|
end
|
@@ -4,13 +4,28 @@ module CaTissue
|
|
4
4
|
# The StorageTypeHolder mix-in adds common methods for the StorageType or StorageContainer child type accessors.
|
5
5
|
module StorageTypeHolder
|
6
6
|
include PartialOrder
|
7
|
+
|
8
|
+
# @return [StorageType] the allowable child storage types
|
9
|
+
def child_storage_types
|
10
|
+
holds_storage_types
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [String] the allowable child specimen classes
|
14
|
+
def child_specimen_classes
|
15
|
+
holds_specimen_classes
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [StorageType] the allowable child specimen array types
|
19
|
+
def child_specimen_array_types
|
20
|
+
holds_specimen_array_types
|
21
|
+
end
|
7
22
|
|
8
23
|
# Returns the {CaTissue::SpecimenArrayType}, {CaTissue::AbstractSpecimen#specimen_class} or {CaTissue::StorageType}
|
9
24
|
# children which this StorageTypeHolder can hold.
|
10
25
|
def child_types
|
11
|
-
|
26
|
+
child_storage_types.union(child_specimen_classes).union(child_specimen_array_types)
|
12
27
|
end
|
13
|
-
|
28
|
+
|
14
29
|
# Adds the given subtype to the list of subtypes which this StorageType can hold.
|
15
30
|
#
|
16
31
|
# @param [CaTissue::StorageType, CaTissue::SpecimenArrayType, String] the subcontainer type or
|
@@ -19,12 +34,35 @@ module CaTissue
|
|
19
34
|
# @raise [ArgumentError] if the type to add is not a supported parameter
|
20
35
|
def add_child_type(type)
|
21
36
|
case type
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
37
|
+
when CaTissue::StorageType then add_storage_type(type)
|
38
|
+
when CaTissue::SpecimenArrayType then add_specimen_array_type(type)
|
39
|
+
when String then add_specimen_class(type)
|
40
|
+
else raise ArgumentError.new("Storage type child not supported - #{type}")
|
26
41
|
end
|
27
42
|
self
|
28
43
|
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
# Adds the given storage type to the set of types which can be held.
|
48
|
+
#
|
49
|
+
# @param type [StorageType] the type to add
|
50
|
+
def add_storage_type(type)
|
51
|
+
child_storage_types << type
|
52
|
+
end
|
53
|
+
|
54
|
+
# Adds the given speicmen array type to the set of types which can be held.
|
55
|
+
#
|
56
|
+
# @param type [SpecimenArrayType] the type to add
|
57
|
+
def add_specimen_array_type(type)
|
58
|
+
child_specimen_array_types << type
|
59
|
+
end
|
60
|
+
|
61
|
+
# Adds the given specimen class to the set of types which can be held.
|
62
|
+
#
|
63
|
+
# @param type [String] the type to add
|
64
|
+
def add_specimen_class(type)
|
65
|
+
child_specimen_classes << type
|
66
|
+
end
|
29
67
|
end
|
30
68
|
end
|
data/lib/catissue/version.rb
CHANGED
metadata
CHANGED
@@ -10,11 +10,11 @@ executables:
|
|
10
10
|
- crtsmoke
|
11
11
|
version: !ruby/object:Gem::Version
|
12
12
|
prerelease: false
|
13
|
-
version: 1.2.
|
13
|
+
version: 1.2.3
|
14
14
|
segments:
|
15
15
|
- 1
|
16
16
|
- 2
|
17
|
-
-
|
17
|
+
- 3
|
18
18
|
post_install_message:
|
19
19
|
date: 2010-11-30 08:00:00 +00:00
|
20
20
|
files:
|
@@ -22,10 +22,79 @@ files:
|
|
22
22
|
- bin/crtexample
|
23
23
|
- bin/crtextract
|
24
24
|
- bin/crtmigrate
|
25
|
+
- bin/crtseed
|
25
26
|
- bin/crtsmoke
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
27
|
+
- conf/annotation/pathology_scg/AdditionalFinding.hbm.xml
|
28
|
+
- conf/annotation/pathology_scg/BasePathologyAnnotation.hbm.xml
|
29
|
+
- conf/annotation/pathology_scg/BreastMargin.hbm.xml
|
30
|
+
- conf/annotation/pathology_scg/BreastMarginInvolved.hbm.xml
|
31
|
+
- conf/annotation/pathology_scg/BreastMarginUninvolved.hbm.xml
|
32
|
+
- conf/annotation/pathology_scg/CarcinomaInSituStatus.hbm.xml
|
33
|
+
- conf/annotation/pathology_scg/CNSMargin.hbm.xml
|
34
|
+
- conf/annotation/pathology_scg/CNSMarginLocation.hbm.xml
|
35
|
+
- conf/annotation/pathology_scg/ColorectalLocalExcisionMarginUninvolved.hbm.xml
|
36
|
+
- conf/annotation/pathology_scg/ColorectalResectedMarginUninvolved.hbm.xml
|
37
|
+
- conf/annotation/pathology_scg/Cytogenetics.hbm.xml
|
38
|
+
- conf/annotation/pathology_scg/DeepMelanomaMargin.hbm.xml
|
39
|
+
- conf/annotation/pathology_scg/Details.hbm.xml
|
40
|
+
- conf/annotation/pathology_scg/DirectExtensionOfTumor.hbm.xml
|
41
|
+
- conf/annotation/pathology_scg/DistalMargin.hbm.xml
|
42
|
+
- conf/annotation/pathology_scg/DistanceFromAnalVerge.hbm.xml
|
43
|
+
- conf/annotation/pathology_scg/DistantMetastasis.hbm.xml
|
44
|
+
- conf/annotation/pathology_scg/ExcionalBiopsyMarginUninvolved.hbm.xml
|
45
|
+
- conf/annotation/pathology_scg/ExcisionalBiopsyColorectalDeepMargin.hbm.xml
|
46
|
+
- conf/annotation/pathology_scg/ExcisionalBiopsyColorectalLateralOrMucosalMargin.hbm.xml
|
47
|
+
- conf/annotation/pathology_scg/ExtraprostaticExtension.hbm.xml
|
48
|
+
- conf/annotation/pathology_scg/ExtraprostaticExtensionTissueSites.hbm.xml
|
49
|
+
- conf/annotation/pathology_scg/GleasonScore.hbm.xml
|
50
|
+
- conf/annotation/pathology_scg/HistologicGrade.hbm.xml
|
51
|
+
- conf/annotation/pathology_scg/HistologicType.hbm.xml
|
52
|
+
- conf/annotation/pathology_scg/HistologicVariantType.hbm.xml
|
53
|
+
- conf/annotation/pathology_scg/ImmunoPhenotyping.hbm.xml
|
54
|
+
- conf/annotation/pathology_scg/Invasion.hbm.xml
|
55
|
+
- conf/annotation/pathology_scg/KidneyMarginLocation.hbm.xml
|
56
|
+
- conf/annotation/pathology_scg/KidneyNephrectomyMargin.hbm.xml
|
57
|
+
- conf/annotation/pathology_scg/LateralMelanomaMargin.hbm.xml
|
58
|
+
- conf/annotation/pathology_scg/LocalExcisionColorectalDeepMargin.hbm.xml
|
59
|
+
- conf/annotation/pathology_scg/LocalExcisionColorectalLateralMargin.hbm.xml
|
60
|
+
- conf/annotation/pathology_scg/LungResectionMargin.hbm.xml
|
61
|
+
- conf/annotation/pathology_scg/LungResectionMarginsUninvolved.hbm.xml
|
62
|
+
- conf/annotation/pathology_scg/MacroscopicExtentOfTumor.hbm.xml
|
63
|
+
- conf/annotation/pathology_scg/MesentricMargin.hbm.xml
|
64
|
+
- conf/annotation/pathology_scg/MetastasisTissueSite.hbm.xml
|
65
|
+
- conf/annotation/pathology_scg/Microcalcification.hbm.xml
|
66
|
+
- conf/annotation/pathology_scg/NottinghamHistologicScore.hbm.xml
|
67
|
+
- conf/annotation/pathology_scg/OtherResectedOrgans.hbm.xml
|
68
|
+
- conf/annotation/pathology_scg/PancreasMargin.hbm.xml
|
69
|
+
- conf/annotation/pathology_scg/PancreasMarginInvolvedByInvasiveCarcinoma.hbm.xml
|
70
|
+
- conf/annotation/pathology_scg/PancreasMarginUninvolvedByInvasiveCarcinoma.hbm.xml
|
71
|
+
- conf/annotation/pathology_scg/PathologicalStaging.hbm.xml
|
72
|
+
- conf/annotation/pathology_scg/PolypConfiguration.hbm.xml
|
73
|
+
- conf/annotation/pathology_scg/PrimaryTumorStage.hbm.xml
|
74
|
+
- conf/annotation/pathology_scg/ProstateMarginLocation.hbm.xml
|
75
|
+
- conf/annotation/pathology_scg/ProximalMargin.hbm.xml
|
76
|
+
- conf/annotation/pathology_scg/RadialMargin.hbm.xml
|
77
|
+
- conf/annotation/pathology_scg/RadicalProstatectomyMargin.hbm.xml
|
78
|
+
- conf/annotation/pathology_scg/RegionalLymphNode.hbm.xml
|
79
|
+
- conf/annotation/pathology_scg/SatelliteNodule.hbm.xml
|
80
|
+
- conf/annotation/pathology_scg/SpecimenCollectionGroup.hbm.xml
|
81
|
+
- conf/annotation/pathology_scg/SpecimenIntegrity.hbm.xml
|
82
|
+
- conf/annotation/pathology_scg/SpecimenSize.hbm.xml
|
83
|
+
- conf/annotation/pathology_scg/TissueSide.hbm.xml
|
84
|
+
- conf/annotation/pathology_scg/TumorSize.hbm.xml
|
85
|
+
- conf/annotation/pathology_scg/TumorTissueSite.hbm.xml
|
86
|
+
- conf/annotation/pathology_scg/UninvolvedMelanomaMargin.hbm.xml
|
87
|
+
- conf/annotation/pathology_specimen/AdditionalFinding.hbm.xml
|
88
|
+
- conf/annotation/pathology_specimen/AdditionalPathologicFinding.hbm.xml
|
89
|
+
- conf/annotation/pathology_specimen/Details.hbm.xml
|
90
|
+
- conf/annotation/pathology_specimen/GleasonScore.hbm.xml
|
91
|
+
- conf/annotation/pathology_specimen/HistologicGrade.hbm.xml
|
92
|
+
- conf/annotation/pathology_specimen/HistologicType.hbm.xml
|
93
|
+
- conf/annotation/pathology_specimen/HistologicVariantType.hbm.xml
|
94
|
+
- conf/annotation/pathology_specimen/Invasion.hbm.xml
|
95
|
+
- conf/annotation/pathology_specimen/NottinghamHistologicScore.hbm.xml
|
96
|
+
- conf/annotation/pathology_specimen/Specimen.hbm.xml
|
97
|
+
- conf/annotation/pathology_specimen/SpecimenBaseSolidTissuePathologyAnnotation.hbm.xml
|
29
98
|
- conf/extract/simple_fields.yaml
|
30
99
|
- conf/migration/filter_fields.yaml
|
31
100
|
- conf/migration/filter_migration.yaml
|
@@ -50,49 +119,35 @@ files:
|
|
50
119
|
- examples/galena/data/minimal.csv
|
51
120
|
- examples/galena/data/simple.csv
|
52
121
|
- examples/galena/data/small.csv
|
53
|
-
- examples/galena/
|
54
|
-
- examples/galena/doc/CaTissue.html
|
55
|
-
- examples/galena/doc/class_list.html
|
56
|
-
- examples/galena/doc/file.README.html
|
57
|
-
- examples/galena/doc/file_list.html
|
58
|
-
- examples/galena/doc/frames.html
|
59
|
-
- examples/galena/doc/Galena.html
|
60
|
-
- examples/galena/doc/index.html
|
61
|
-
- examples/galena/doc/method_list.html
|
62
|
-
- examples/galena/doc/top-level-namespace.html
|
63
|
-
- examples/galena/doc/CaTissue/Participant.html
|
64
|
-
- examples/galena/doc/CaTissue/SpecimenCollectionGroup.html
|
65
|
-
- examples/galena/doc/CaTissue/StorageContainer.html
|
66
|
-
- examples/galena/doc/CaTissue/TissueSpecimen.html
|
67
|
-
- examples/galena/doc/css/common.css
|
68
|
-
- examples/galena/doc/css/full_list.css
|
69
|
-
- examples/galena/doc/css/style.css
|
70
|
-
- examples/galena/doc/Galena/Seed.html
|
71
|
-
- examples/galena/doc/Galena/Seed/Defaults.html
|
72
|
-
- examples/galena/doc/js/app.js
|
73
|
-
- examples/galena/doc/js/full_list.js
|
74
|
-
- examples/galena/doc/js/jquery.js
|
122
|
+
- examples/galena/lib/galena.rb
|
75
123
|
- examples/galena/lib/galena/cli/seed.rb
|
76
124
|
- examples/galena/lib/galena/migration/filter_shims.rb
|
77
125
|
- examples/galena/lib/galena/migration/frozen_shims.rb
|
78
126
|
- examples/galena/lib/galena/seed/defaults.rb
|
79
127
|
- lib/catissue.rb
|
80
|
-
- lib/galena.rb
|
81
|
-
- lib/README.html
|
82
128
|
- lib/catissue/database.rb
|
83
129
|
- lib/catissue/resource.rb
|
84
130
|
- lib/catissue/version.rb
|
131
|
+
- lib/catissue/annotation/annotatable.rb
|
132
|
+
- lib/catissue/annotation/annotatable_class.rb
|
133
|
+
- lib/catissue/annotation/annotation.rb
|
134
|
+
- lib/catissue/annotation/annotation_class.rb
|
135
|
+
- lib/catissue/annotation/annotation_module.rb
|
136
|
+
- lib/catissue/annotation/hibernate_mapping.rb
|
137
|
+
- lib/catissue/annotation/proxy.rb
|
138
|
+
- lib/catissue/annotation/proxy_class.rb
|
85
139
|
- lib/catissue/cli/command.rb
|
86
140
|
- lib/catissue/cli/example.rb
|
87
141
|
- lib/catissue/cli/migrate.rb
|
88
142
|
- lib/catissue/cli/smoke.rb
|
89
143
|
- lib/catissue/database/controlled_value_finder.rb
|
90
144
|
- lib/catissue/database/controlled_values.rb
|
91
|
-
- lib/catissue/database/annotation/annotatable_service.rb
|
92
145
|
- lib/catissue/database/annotation/annotation_service.rb
|
93
146
|
- lib/catissue/database/annotation/annotator.rb
|
94
|
-
- lib/catissue/database/annotation/
|
147
|
+
- lib/catissue/database/annotation/entity_facade.rb
|
148
|
+
- lib/catissue/database/annotation/id_generator.rb
|
95
149
|
- lib/catissue/database/annotation/integration_service.rb
|
150
|
+
- lib/catissue/database/annotation/reference_writer.rb
|
96
151
|
- lib/catissue/domain/abstract_domain_object.rb
|
97
152
|
- lib/catissue/domain/abstract_position.rb
|
98
153
|
- lib/catissue/domain/abstract_specimen.rb
|
@@ -152,10 +207,6 @@ files:
|
|
152
207
|
- lib/catissue/util/position.rb
|
153
208
|
- lib/catissue/util/storable.rb
|
154
209
|
- lib/catissue/util/storage_type_holder.rb
|
155
|
-
- lib/galena/cli/seed.rb
|
156
|
-
- lib/galena/migration/filter_shims.rb
|
157
|
-
- lib/galena/migration/frozen_shims.rb
|
158
|
-
- lib/galena/seed/defaults.rb
|
159
210
|
- History.txt
|
160
211
|
- LEGAL
|
161
212
|
- LICENSE
|