caruby-tissue 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.md +6 -2
- data/examples/galena/README.md +9 -0
- data/examples/galena/lib/galena/tissue/migration/filter_shims.rb +14 -3
- data/examples/galena/lib/galena/tissue/migration/frozen_shims.rb +6 -3
- data/examples/galena/lib/galena/tissue/seed/defaults.rb +2 -2
- data/examples/{pcbin → psbin}/README.md +6 -5
- data/examples/psbin/conf/adjuvant_hormone_defaults.yaml +2 -0
- data/examples/psbin/conf/adjuvant_radiation_defaults.yaml +3 -0
- data/examples/{pcbin → psbin}/conf/biopsy_defaults.yaml +1 -1
- data/examples/{pcbin → psbin}/conf/biopsy_fields.yaml +0 -0
- data/examples/{pcbin → psbin}/conf/neoadjuvant_hormone_defaults.yaml +1 -0
- data/examples/{pcbin → psbin}/conf/neoadjuvant_radiation_defaults.yaml +1 -0
- data/examples/psbin/conf/patient_defaults.yaml +3 -0
- data/examples/{pcbin → psbin}/conf/patient_fields.yaml +0 -0
- data/examples/{pcbin → psbin}/conf/surgery_defaults.yaml +1 -0
- data/examples/{pcbin → psbin}/conf/surgery_fields.yaml +0 -0
- data/examples/{pcbin → psbin}/conf/t_stage_defaults.yaml +0 -0
- data/examples/{pcbin → psbin}/conf/t_stage_fields.yaml +0 -0
- data/examples/{pcbin → psbin}/conf/therapy_fields.yaml +0 -0
- data/examples/{pcbin → psbin}/data/adjuvant_hormone.csv +0 -0
- data/examples/{pcbin → psbin}/data/adjuvant_radiation.csv +0 -0
- data/examples/{pcbin → psbin}/data/biopsy.csv +0 -0
- data/examples/{pcbin → psbin}/data/neoadjuvant_hormone.csv +0 -0
- data/examples/{pcbin → psbin}/data/neoadjuvant_radiation.csv +0 -0
- data/examples/{pcbin → psbin}/data/patient.csv +0 -0
- data/examples/{pcbin → psbin}/data/surgery.csv +0 -0
- data/examples/{pcbin → psbin}/data/t_stage.csv +0 -0
- data/examples/{pcbin/lib/pcbin → psbin/lib/psbin}/biopsy_shims.rb +0 -0
- data/examples/{pcbin/lib/pcbin → psbin/lib/psbin}/surgery_shims.rb +0 -0
- data/lib/catissue/annotation/annotatable_class.rb +4 -4
- data/lib/catissue/annotation/annotation_class.rb +2 -2
- data/lib/catissue/annotation/annotation_module.rb +1 -1
- data/lib/catissue/cli/command.rb +3 -3
- data/lib/catissue/database.rb +31 -28
- data/lib/catissue/database/annotation/annotation_service.rb +2 -2
- data/lib/catissue/database/annotation/entity_facade.rb +1 -1
- data/lib/catissue/database/controlled_values.rb +2 -2
- data/lib/catissue/domain/abstract_specimen.rb +26 -24
- data/lib/catissue/domain/abstract_specimen_collection_group.rb +1 -1
- data/lib/catissue/domain/capacity.rb +1 -1
- data/lib/catissue/domain/collection_protocol.rb +11 -9
- data/lib/catissue/domain/collection_protocol_event.rb +4 -3
- data/lib/catissue/domain/collection_protocol_registration.rb +3 -2
- data/lib/catissue/domain/container.rb +4 -3
- data/lib/catissue/domain/container_type.rb +7 -6
- data/lib/catissue/domain/disposal_event_parameters.rb +1 -1
- data/lib/catissue/domain/order_details.rb +0 -1
- data/lib/catissue/domain/participant.rb +13 -12
- data/lib/catissue/domain/participant_medical_identifier.rb +3 -2
- data/lib/catissue/domain/site.rb +9 -7
- data/lib/catissue/domain/specimen.rb +45 -35
- data/lib/catissue/domain/specimen/pathology/prostate_specimen_gleason_score.rb +3 -2
- data/lib/catissue/domain/specimen/pathology/prostate_specimen_pathology_annotation.rb +3 -4
- data/lib/catissue/domain/specimen/pathology/specimen_additional_finding.rb +7 -5
- data/lib/catissue/domain/specimen/pathology/specimen_base_solid_tissue_pathology_annotation.rb +11 -11
- data/lib/catissue/domain/specimen/pathology/specimen_details.rb +4 -2
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_grade.rb +4 -2
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_type.rb +6 -6
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_variant_type.rb +4 -2
- data/lib/catissue/domain/specimen/pathology/specimen_invasion.rb +4 -2
- data/lib/catissue/domain/specimen_array.rb +1 -1
- data/lib/catissue/domain/specimen_collection_group.rb +45 -39
- data/lib/catissue/domain/specimen_collection_group/pathology/base_pathology_annotation.rb +4 -4
- data/lib/catissue/domain/specimen_collection_group/pathology/base_solid_tissue_pathology_annotation.rb +4 -4
- data/lib/catissue/domain/specimen_protocol.rb +6 -4
- data/lib/catissue/domain/specimen_requirement.rb +15 -10
- data/lib/catissue/domain/storage_container.rb +1 -2
- data/lib/catissue/domain/storage_type.rb +1 -1
- data/lib/catissue/domain/user.rb +14 -15
- data/lib/catissue/extract/command.rb +1 -1
- data/lib/catissue/extract/delta.rb +15 -7
- data/lib/catissue/migration/migratable.rb +1 -1
- data/lib/catissue/migration/migrator.rb +2 -2
- data/lib/catissue/migration/shims.rb +3 -3
- data/lib/catissue/util/collectible.rb +2 -2
- data/lib/catissue/util/collectible_event_parameters.rb +2 -2
- data/lib/catissue/util/position.rb +3 -3
- data/lib/catissue/version.rb +1 -1
- data/test/lib/examples/galena/tissue/migration/seedify.rb +5 -5
- data/test/lib/examples/{pcbin → psbin}/migration_test.rb +9 -9
- metadata +32 -32
- data/examples/pcbin/conf/adjuvant_hormone_defaults.yaml +0 -1
- data/examples/pcbin/conf/adjuvant_radiation_defaults.yaml +0 -2
- data/examples/pcbin/conf/patient_defaults.yaml +0 -2
data/History.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
This history lists major release themes. See the GitHub Commits (https://github.com/caruby/tissue)
|
|
2
2
|
for change details.
|
|
3
3
|
|
|
4
|
+
1.5.3 / 2011-07-08
|
|
5
|
+
------------------
|
|
6
|
+
* Clean up documentation.
|
|
7
|
+
|
|
4
8
|
1.5.2 / 2011-07-06
|
|
5
9
|
------------------
|
|
6
10
|
* Update embed to use the annotation hook attribute.
|
|
@@ -11,7 +15,7 @@ for change details.
|
|
|
11
15
|
|
|
12
16
|
1.4.2 / 2011-05-04
|
|
13
17
|
------------------
|
|
14
|
-
* Add registration and
|
|
18
|
+
* Add registration and PSBIN examples.
|
|
15
19
|
|
|
16
20
|
1.4.1 / 2011-05-03
|
|
17
21
|
------------------
|
|
@@ -39,7 +43,7 @@ for change details.
|
|
|
39
43
|
|
|
40
44
|
1.3.1 / 2011-02-18
|
|
41
45
|
------------------
|
|
42
|
-
* Prostate Spore
|
|
46
|
+
* Prostate Spore PSBIN DE support.
|
|
43
47
|
|
|
44
48
|
1.2.3 / 2011-02-18
|
|
45
49
|
------------------
|
data/examples/galena/README.md
CHANGED
|
@@ -39,6 +39,14 @@ Each example has a field mapping configuration in the `conf/migration` directory
|
|
|
39
39
|
For example, the `simple.csv` input file is migrated into caTissue using the
|
|
40
40
|
`simple_migration.yaml` configuration file.
|
|
41
41
|
|
|
42
|
+
You can browse the source repository [example files](https://github.com/caruby/tissue/tree/master/examples/galena), where:
|
|
43
|
+
|
|
44
|
+
* `conf/migration` has the mapping configuration files
|
|
45
|
+
|
|
46
|
+
* `data` has the sample data
|
|
47
|
+
|
|
48
|
+
* `lib/galena/tissue/migration` has the shim code
|
|
49
|
+
|
|
42
50
|
Migrate the Galena `simple` example as follows:
|
|
43
51
|
|
|
44
52
|
1. Open a console in the copied Galena example location.
|
|
@@ -111,3 +119,4 @@ The following input fields are included in the examples:
|
|
|
111
119
|
* <tt>Gleason</tt>: Specimen primary gleason score
|
|
112
120
|
* <tt>Grade</tt>: Specimen histologic WHO grade
|
|
113
121
|
|
|
122
|
+
The fields listed are those used in the examples. caTissue supports any caTissue domain object.
|
|
@@ -1,29 +1,40 @@
|
|
|
1
1
|
require 'uom'
|
|
2
2
|
|
|
3
3
|
module CaTissue
|
|
4
|
-
#
|
|
4
|
+
# Declare the classes modified for migration.
|
|
5
5
|
shims Participant, TissueSpecimen, SpecimenCollectionGroup
|
|
6
6
|
|
|
7
7
|
class Participant
|
|
8
8
|
# Extracts the Participant first name from the +Initials+ input field.
|
|
9
9
|
def migrate_first_name(value, row)
|
|
10
|
+
# The first initial is the first "name".
|
|
10
11
|
value[0, 1]
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
# Extracts the Participant last name from the +Initials+ input field.
|
|
15
|
+
#
|
|
16
|
+
# @param [String] value the input initials field
|
|
17
|
+
# @param @param [{Symbol => Object}] row the input row field => value hash
|
|
14
18
|
def migrate_last_name(value, row)
|
|
19
|
+
# The last initial is the last "name".
|
|
15
20
|
value[-1, 1]
|
|
16
21
|
end
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
class TissueSpecimen
|
|
20
25
|
# Transforms the +Frozen?+ flag input field to the caTissue specimen type +Frozen Tissue+ value.
|
|
26
|
+
#
|
|
27
|
+
# @param [String] value the input specimen type field
|
|
28
|
+
# @param @param [{Symbol => Object}] row the input row field => value hash
|
|
21
29
|
def migrate_specimen_type(value, row)
|
|
22
30
|
value =~ /TRUE/i ? 'Frozen Tissue' : 'Fixed Tissue'
|
|
23
31
|
end
|
|
24
32
|
|
|
25
33
|
# Parses the source field as a UOM::Measurement if it is a string.
|
|
26
34
|
# Otherwises, returns the source value.
|
|
35
|
+
#
|
|
36
|
+
# @param [String, Numeric] value the input quantity field
|
|
37
|
+
# @param @param [{Symbol => Object}] row the input row field => value hash
|
|
27
38
|
def migrate_initial_quantity(value, row)
|
|
28
39
|
# if value is not a string, then use it as is
|
|
29
40
|
return value unless value.is_a?(String)
|
|
@@ -34,9 +45,9 @@ module CaTissue
|
|
|
34
45
|
end
|
|
35
46
|
|
|
36
47
|
class SpecimenCollectionGroup
|
|
37
|
-
#
|
|
48
|
+
# @return [Boolean] whether this SCG has a SPN
|
|
38
49
|
def migration_valid?
|
|
39
|
-
surgical_pathology_number
|
|
50
|
+
not surgical_pathology_number.nil?
|
|
40
51
|
end
|
|
41
52
|
end
|
|
42
53
|
end
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
require File.join(File.dirname(__FILE__), '..', 'seed', 'defaults')
|
|
3
3
|
|
|
4
4
|
module CaTissue
|
|
5
|
-
#
|
|
5
|
+
# Declare the classes modified for migration.
|
|
6
6
|
shims TissueSpecimen, CollectionProtocolRegistration, StorageContainer
|
|
7
7
|
|
|
8
8
|
class StorageContainer
|
|
9
9
|
# Creates the migrated box in the database, if necessary.
|
|
10
10
|
#
|
|
11
|
-
# @param
|
|
11
|
+
# @param [{Symbol => Object}] row the input row field => value hash
|
|
12
|
+
# @param [<Resource>] migrated the migrated instances
|
|
12
13
|
def migrate(row, migrated)
|
|
13
14
|
super
|
|
15
|
+
# Fetch the box from the database, if it exists.
|
|
16
|
+
# Otherwise, create the box.
|
|
14
17
|
find or create_galena_box
|
|
15
18
|
end
|
|
16
19
|
|
|
@@ -31,7 +34,7 @@ module CaTissue
|
|
|
31
34
|
# Add the box to the first open slot in the first unfilled rack in the freezer.
|
|
32
35
|
frz << self
|
|
33
36
|
logger.debug { "Placed the tissue box #{self} in freezer #{frz}." }
|
|
34
|
-
logger.debug { "Creating the tissue box #{self}..." }
|
|
37
|
+
logger.debug { "Creating the tissue box #{self} in the database..." }
|
|
35
38
|
create
|
|
36
39
|
end
|
|
37
40
|
end
|
|
@@ -16,8 +16,8 @@ module Galena
|
|
|
16
16
|
|
|
17
17
|
# Pre-defined Galena example administrative objects. If the Galena example is already set up
|
|
18
18
|
# in the caTissue database, then the default object secondary key attributes can be used as a
|
|
19
|
-
#
|
|
20
|
-
# attributes can be created by calling
|
|
19
|
+
# +CaRuby::Persistable.find+ template to retrieve the existing objects. Otherwise, the Defaults
|
|
20
|
+
# attributes can be created by calling +CaRuby::Persistable.create+.
|
|
21
21
|
#
|
|
22
22
|
# In a real-world use case, the administrative objects are typically built in the UI before-hand.
|
|
23
23
|
# In that case, it is only necessary to define the object secondary key rather than content, e.g.:
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
PSBIN caRuby Tissue example
|
|
2
2
|
============================
|
|
3
3
|
|
|
4
4
|
Synopsis
|
|
5
5
|
--------
|
|
6
|
-
This directory contains the caRuby Tissue example for the
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
This directory contains the caRuby Tissue example for the **P**rostate **S**PORE **B**io**I**nformatics **N**etwork
|
|
7
|
+
(PSBIN) initiative.
|
|
8
|
+
The PSBIN initiative shares participant cancer center data in caTissue instances with common
|
|
9
|
+
data elements. The official PSBIN import utility is a Java program which operates on a
|
|
9
10
|
special-purpose input XML file and calls caRuby to create annotations. The example shown
|
|
10
11
|
here is a caRuby Tissue Migrator import which operates on CSV files.
|
|
11
12
|
|
|
@@ -25,7 +26,7 @@ The migration input files are in the `data` directory. The input maps to caTissu
|
|
|
25
26
|
|
|
26
27
|
Setup
|
|
27
28
|
-----
|
|
28
|
-
Configure caRuby and copy the
|
|
29
|
+
Configure caRuby and copy the PSBIN example as described in the Galena examples
|
|
29
30
|
[Setup](https://github.com/caruby/tissue/blob/master/examples/galena/README.md).
|
|
30
31
|
|
|
31
32
|
Create a simple `Prostate SPORE` caTissue collection protocol in a test database.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Participant::Clinical::NewDiagnosisHealthAnnotation.name_of_procedure: Biopsy of
|
|
1
|
+
Participant::Clinical::NewDiagnosisHealthAnnotation.name_of_procedure: Needle Biopsy of prostate
|
|
2
2
|
SpecimenCollectionGroup.clinical_status: New Diagnosis
|
|
3
3
|
SpecimenCollectionGroup.collection_status: Complete
|
|
File without changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Participant::Clinical::LabAnnotation.lab_test_name: 2857-1 ~ Prostate specific Ag - Serum/Plasma - Quantitative - Mass Concentration - Point in time
|
|
2
|
+
Participant::Clinical::LabAnnotation.other_lab_test_name: Pre-Treatment PSA
|
|
3
|
+
Participant::Clinical::LabAnnotation.result_units: ng/ml
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -11,12 +11,12 @@ module CaTissue
|
|
|
11
11
|
# annotation objects, or nil if this is not a primary annotation class
|
|
12
12
|
attr_reader :entity_id
|
|
13
13
|
|
|
14
|
-
# @return [Class] the {DEIntegration} proxy class (nil for 1.1 caTissue)
|
|
14
|
+
# @return [Class] the {Annotation::DEIntegration} proxy class (nil for 1.1 caTissue)
|
|
15
15
|
def de_integration_proxy_class
|
|
16
16
|
@de_integration_proxy_class or (superclass.de_integration_proxy_class if superclass < Annotatable)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
# Adds
|
|
19
|
+
# Adds +CaRuby::Domain::Metadata+ and {AnnotatableClass} functionality to the given class.
|
|
20
20
|
#
|
|
21
21
|
# @param [Class] the domain class to extend
|
|
22
22
|
def self.extend_class(klass)
|
|
@@ -61,7 +61,7 @@ module CaTissue
|
|
|
61
61
|
annotation_defined?(symbol)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
# Refines the
|
|
64
|
+
# Refines the +CaRuby::Domain::Attributes.toxic_attributes+ to exclude annotation attributes.
|
|
65
65
|
#
|
|
66
66
|
# @return [<Symbol>] the non-annotation unfetched attributes
|
|
67
67
|
def toxic_attributes
|
|
@@ -90,7 +90,7 @@ module CaTissue
|
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
# Filters
|
|
93
|
+
# Filters +CaRuby::Domain::Attributes.loadable_attributes+ to exclude the {#annotation_attributes}
|
|
94
94
|
# since annotation lazy-loading is not supported.
|
|
95
95
|
#
|
|
96
96
|
# @return (see CaRuby::Domain::Attributes#loadable_attributes)
|
|
@@ -52,7 +52,7 @@ module CaTissue
|
|
|
52
52
|
@ann_attrs ||= domain_attributes.compose { |attr_md| attr_md.type < Annotation }
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
# Filters
|
|
55
|
+
# Filters +CaRuby::Domain::Attributes.loadable_attributes+ to exclude all references,
|
|
56
56
|
# since annotation lazy-loading is not supported.
|
|
57
57
|
#
|
|
58
58
|
# @return [Array] an empty array
|
|
@@ -73,7 +73,7 @@ module CaTissue
|
|
|
73
73
|
not ref.nil?
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
# @return [Boolean] whether this annotation is neither a {#primary?} nor a #
|
|
76
|
+
# @return [Boolean] whether this annotation is neither a {#primary?} nor a {#secondary?} annotation
|
|
77
77
|
def tertiary_annotation
|
|
78
78
|
not (primary? or secondary?)
|
|
79
79
|
end
|
|
@@ -15,7 +15,7 @@ module CaTissue
|
|
|
15
15
|
# @return [Class] the hook-annotation association class, or nil for 1.1.x caTissue
|
|
16
16
|
attr_reader :record_entry_class
|
|
17
17
|
|
|
18
|
-
# @return [Symbol] the {
|
|
18
|
+
# @return [Symbol] the {Annotation::ProxyClass} hook writer method, or nil for 1.1.x caTissue
|
|
19
19
|
attr_reader :record_entry_hook_writer
|
|
20
20
|
|
|
21
21
|
# @param [AnnotationModule] mod the annotation module to build
|
data/lib/catissue/cli/command.rb
CHANGED
|
@@ -6,7 +6,7 @@ begin
|
|
|
6
6
|
rescue Exception => e
|
|
7
7
|
logger.error("caTissue client load was unsuccessful - #{e}:\n#{e.backtrace.qp}")
|
|
8
8
|
puts "caTissue client load was unsuccessful - #{e}."
|
|
9
|
-
puts "See the log at
|
|
9
|
+
puts "See the log at #+CaRuby::Log.instance.file+ for more information."
|
|
10
10
|
exit 1
|
|
11
11
|
end
|
|
12
12
|
|
|
@@ -15,9 +15,9 @@ require 'catissue/version'
|
|
|
15
15
|
|
|
16
16
|
module CaTissue
|
|
17
17
|
module CLI
|
|
18
|
-
# Augments
|
|
18
|
+
# Augments +CaRuby::CLI::Command+ with caTissue-specific command line option handlers.
|
|
19
19
|
class Command < CaRuby::CLI::Command
|
|
20
|
-
# @see
|
|
20
|
+
# @see +CaRuby::CLI::Command.initialize+
|
|
21
21
|
def initialize(specs=[])
|
|
22
22
|
specs << VERSION_OPT
|
|
23
23
|
super
|
data/lib/catissue/database.rb
CHANGED
|
@@ -7,17 +7,20 @@ require 'catissue/database/annotation/annotator'
|
|
|
7
7
|
require 'catissue/util/collectible_event_parameters'
|
|
8
8
|
|
|
9
9
|
module CaTissue
|
|
10
|
-
# A CaTissue
|
|
11
|
-
# The CaRuby::Database functionality is preserved and not expanded, but this CaTissue
|
|
12
|
-
# several base class private methods to enable alternate
|
|
13
|
-
#
|
|
10
|
+
# A CaTissue: Database mediates access to the caTissue database.
|
|
11
|
+
# The superclass +CaRuby::Database+ functionality is preserved and not expanded, but this CaTissue
|
|
12
|
+
# Database implementation overrides several base class private methods to enable alternate
|
|
13
|
+
# caTissue-specific search strategies and work-arounds.
|
|
14
14
|
class Database < CaRuby::Database
|
|
15
15
|
include Singleton
|
|
16
16
|
|
|
17
|
-
# return [CaRuby::SQLExecutor] a utility SQL executor
|
|
18
|
-
attr_reader :executor
|
|
17
|
+
# @return [CaRuby::SQLExecutor] a utility SQL executor
|
|
18
|
+
attr_reader :executor
|
|
19
|
+
|
|
20
|
+
# @return [{Symbol => Object}] the server access properties
|
|
21
|
+
attr_reader :access_properties
|
|
19
22
|
|
|
20
|
-
# Creates a new Database with the +catissuecore+ service
|
|
23
|
+
# Creates a new Database with the +catissuecore+ service.
|
|
21
24
|
def initialize
|
|
22
25
|
@access_properties = CaTissue.access_properties
|
|
23
26
|
super(SVC_NAME, @access_properties)
|
|
@@ -29,7 +32,7 @@ module CaTissue
|
|
|
29
32
|
@annotator ||= Annotator.new(self)
|
|
30
33
|
end
|
|
31
34
|
|
|
32
|
-
# If the given domain object is an {Annotation}, then this method returns the {AnnotationService}
|
|
35
|
+
# If the given domain object is an {Annotation}, then this method returns the {Annotation::AnnotationService}
|
|
33
36
|
# for the object {AnnotationModule}, otherwise this method returns the standard {CaTissue::Database}
|
|
34
37
|
# service.
|
|
35
38
|
#
|
|
@@ -39,7 +42,7 @@ module CaTissue
|
|
|
39
42
|
klass < Annotation ? klass.annotation_module.persistence_service : super
|
|
40
43
|
end
|
|
41
44
|
|
|
42
|
-
# Augments
|
|
45
|
+
# Augments +CaRuby::Database.ensure_exists+ to ensure that an {Annotation::Proxy} reference identifier
|
|
43
46
|
# reflects the hook identifier.
|
|
44
47
|
#
|
|
45
48
|
# @param (see CaRuby::Database::Writer#ensure_exists)
|
|
@@ -59,7 +62,7 @@ module CaTissue
|
|
|
59
62
|
|
|
60
63
|
UPD_CTR_SQL = 'update catissue_consent_tier_response set response = ? where identifier = ?'
|
|
61
64
|
|
|
62
|
-
# Overrides
|
|
65
|
+
# Overrides #+CaRuby::Database::Writer.recursive_save?+ to support the update work-around
|
|
63
66
|
# described in {#update_object}. A recursive SCG update is allowed if the nested
|
|
64
67
|
# transaction sequence is:
|
|
65
68
|
# * Update SCG
|
|
@@ -192,7 +195,7 @@ module CaTissue
|
|
|
192
195
|
penultimate and penultimate.subject == obj
|
|
193
196
|
end
|
|
194
197
|
|
|
195
|
-
# Augments
|
|
198
|
+
# Augments +CaRuby::Database.save_with_template+ to work around the following caTissue anomalies:
|
|
196
199
|
#
|
|
197
200
|
# @quirk caTissue Bug #149: API update TissueSpecimen position validation incorrect.
|
|
198
201
|
# The Specimen update argument must reference the old position, even though the position is not
|
|
@@ -203,21 +206,21 @@ module CaTissue
|
|
|
203
206
|
# position in the caTissue service update argument. A Specimen position is altered as a side-effect
|
|
204
207
|
# by creating a proxy save {CaTissue::TransferEventParameters}. The changed position is not reflected
|
|
205
208
|
# in the Specimen position, which must be refetched to reflect the database state. This fetch is
|
|
206
|
-
# done automatically by
|
|
209
|
+
# done automatically by +CaRuby::Database+ as part of the save proxy mechanism. The Specimen update
|
|
207
210
|
# template must include a reference to the former position but not the changed position.
|
|
208
211
|
#
|
|
209
|
-
# However, the Specimen
|
|
210
|
-
# former position. The template built
|
|
212
|
+
# However, the Specimen +CaRuby::Writer.update+ argument will include the changed position, not the
|
|
213
|
+
# former position. The template built +CaRuby::Writer.update+ for submission to the caTissue app
|
|
211
214
|
# does not include a position reference, since the position has a save proxy which handles position
|
|
212
|
-
# change as part of the
|
|
215
|
+
# change as part of the +CaRuby::Writer+ update dependent propagation.
|
|
213
216
|
#
|
|
214
217
|
# Thus, updating a Specimen which includes a position change is performed as follows:
|
|
215
218
|
# * reconstitute the former position from the Position snapshot taken as part of the
|
|
216
|
-
#
|
|
217
|
-
# * add the former position to the template (which will now differ from the
|
|
219
|
+
# +CaRuby::Persistable+ change tracker.
|
|
220
|
+
# * add the former position to the template (which will now differ from the +CaRuby::Writer.update+
|
|
218
221
|
# argument).
|
|
219
222
|
# * submit the adjusted Specimen template to the caTissue app updateObject.
|
|
220
|
-
# *
|
|
223
|
+
# * +CaRuby::Writer.update+ will propagate the Specimen update to the changed position dependent,
|
|
221
224
|
# which in turn saves via the {CaTissue::TransferEventParameters} proxy.
|
|
222
225
|
# * The proxy save will in turn refetch the proxied Specimen position to obtain the identifier
|
|
223
226
|
# and merge this into the Specimen position.
|
|
@@ -291,7 +294,7 @@ module CaTissue
|
|
|
291
294
|
logger.debug { "caTissue #{ctr} update work-around completed." }
|
|
292
295
|
end
|
|
293
296
|
|
|
294
|
-
# Overrides
|
|
297
|
+
# Overrides +CaRuby::Database::Writer.save_changed_dependents+ to handle the following anomalies:
|
|
295
298
|
# * create Specimen disposal event last, as described in {#save_changed_specimen_dependents}
|
|
296
299
|
#
|
|
297
300
|
# @param (see CaRuby::Writer#save_dependents)
|
|
@@ -302,7 +305,7 @@ module CaTissue
|
|
|
302
305
|
end
|
|
303
306
|
end
|
|
304
307
|
|
|
305
|
-
# Overrides
|
|
308
|
+
# Overrides +CaRuby::Database::Writer.save_changed_dependents+ on a Specimen to correct the
|
|
306
309
|
# following problem:
|
|
307
310
|
#
|
|
308
311
|
# @quirk caTissue DisposalEventParameters must be created after all other Specimen SEPs.
|
|
@@ -321,7 +324,7 @@ module CaTissue
|
|
|
321
324
|
# for the subtle interaction required between these two work-arounds.
|
|
322
325
|
#
|
|
323
326
|
# @param [CaTissue::Specimen] the specimen whose dependents are to be saved
|
|
324
|
-
# @yield [dependent] calls the base
|
|
327
|
+
# @yield [dependent] calls the base +CaRuby::Writer.save_changed_dependents+
|
|
325
328
|
# @yieldparam [Resource] dependent the dependent to save
|
|
326
329
|
def save_changed_specimen_dependents(specimen)
|
|
327
330
|
dsp = specimen.specimen_events.detect { |ep| CaTissue::DisposalEventParameters === ep }
|
|
@@ -343,7 +346,7 @@ module CaTissue
|
|
|
343
346
|
end
|
|
344
347
|
end
|
|
345
348
|
|
|
346
|
-
# Overrides
|
|
349
|
+
# Overrides +CaRuby::Database.build_save_template+ to return obj itself if
|
|
347
350
|
# obj is an {Annotation}, since annotations do not employ a separate template.
|
|
348
351
|
#
|
|
349
352
|
# @param (see CaRuby::Database#build_save_template)
|
|
@@ -369,7 +372,7 @@ module CaTissue
|
|
|
369
372
|
annotation
|
|
370
373
|
end
|
|
371
374
|
|
|
372
|
-
# Overrides
|
|
375
|
+
# Overrides +CaRuby::Database::Writer.save_with_template+ to work around caTissue bugs.
|
|
373
376
|
# @quirk caTissue Bug #63: a SpecimenCollectionGroup update requires the referenced CollectionProtocolRegistration
|
|
374
377
|
# with an identifier to hold extraneous CollectionProtocolRegistration content, including the CPR
|
|
375
378
|
# collection protocol and PPI.
|
|
@@ -479,7 +482,7 @@ module CaTissue
|
|
|
479
482
|
template.send(wtr, pxy)
|
|
480
483
|
end
|
|
481
484
|
|
|
482
|
-
# Augment
|
|
485
|
+
# Augment +CaRuby::Database::Writer.create_object+ to work around caTissue bugs.
|
|
483
486
|
# @quirk caTissue Bug #124: SCG SpecimenEventParameters save fails validation.
|
|
484
487
|
# Work-around is to create the SEP by updating the SCG.
|
|
485
488
|
# @quirk If obj is a CaTissue::Specimen with the is_available flag set to false, then work around the bug
|
|
@@ -514,7 +517,7 @@ module CaTissue
|
|
|
514
517
|
obj
|
|
515
518
|
end
|
|
516
519
|
|
|
517
|
-
# Overrides
|
|
520
|
+
# Overrides +CaRuby::Database.create_from_template+ as follows:
|
|
518
521
|
# * Surrogate {Annotation::Proxy} is "created" by setting the identifier to its hook owner.
|
|
519
522
|
# The create operation then creates referenced uncreated dependents.
|
|
520
523
|
#
|
|
@@ -596,7 +599,7 @@ module CaTissue
|
|
|
596
599
|
specimen
|
|
597
600
|
end
|
|
598
601
|
|
|
599
|
-
# Overrides
|
|
602
|
+
# Overrides +CaRuby::Database::Reader.fetch_object+ to circumvent {Annotation} fetch, since an annotation
|
|
600
603
|
# does not have a key.
|
|
601
604
|
def fetch_object(obj)
|
|
602
605
|
super or fetch_alternative(obj)
|
|
@@ -609,7 +612,7 @@ module CaTissue
|
|
|
609
612
|
end
|
|
610
613
|
end
|
|
611
614
|
|
|
612
|
-
# Override
|
|
615
|
+
# Override +CaRuby::Database.query_safe+ to work around the following +caTissue+ bugs:
|
|
613
616
|
# * @quirk caTissue Specimen auto-generates blank ExternalIdentifier.
|
|
614
617
|
# cf. https://cabig-kc.nci.nih.gov/Biospecimen/forums/viewtopic.php?f=19&t=436&sid=ef98f502fc0ab242781b7759a0eaff36
|
|
615
618
|
# * @quirk caTissue Specimen auto-generates blank PMI.
|
|
@@ -690,7 +693,7 @@ module CaTissue
|
|
|
690
693
|
annotator.integrator.find(proxy)
|
|
691
694
|
end
|
|
692
695
|
|
|
693
|
-
# @quirk caCORE Override
|
|
696
|
+
# @quirk caCORE Override +CaRuby::Database::Reader.invertible_query?+ to enable the Bug #147 work
|
|
694
697
|
# around in {#query_object}. Invertible queries are performed to work around Bug #79. However, this
|
|
695
698
|
# work-around induces Bug #147, so we disable the Bug #79 work-around here for the special case of
|
|
696
699
|
# a CPE in order to enable the Bug #147 work-around. And so it goes....
|