bsi-pipeline 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/bsi-pipeline/importer.rb +16 -2
- data/lib/bsi-pipeline/models.rb +15 -24
- data/lib/bsi-pipeline/version.rb +1 -1
- data/spec/factories/specimen.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e760c06f87edb57bc12c989c853a24d011ea87a1
|
4
|
+
data.tar.gz: 65d77160c4c42829be1db9842146916c8e667ba2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c957a5e5f1a99aa80f1faaf21d8c76cb0d7b47415b9d45d9b9bf71e9a532cce0019c745a14456ebfe126775bb101ffaf002bfaadd88bdce9a1e4f12cb41b051e
|
7
|
+
data.tar.gz: 4d359b7fd19877a0cd20c1bbb14a6ed016d78bb7e9ca6ec8bc3330773455fc54e1244e4da248fe2dc7f8cdeb3a695eee71b28ffdfd416f508b9c78da0c16a930
|
@@ -27,7 +27,7 @@ module Pipeline
|
|
27
27
|
def add_specimens(specimens)
|
28
28
|
@specimens = specimens
|
29
29
|
format
|
30
|
-
@bsi.batch.addVials( @id, specimens.map{ |s| s.to_bfh } )
|
30
|
+
@bsi.batch.addVials( @id, @specimens.map{ |s| s.to_bfh } )
|
31
31
|
nil
|
32
32
|
end
|
33
33
|
|
@@ -40,12 +40,26 @@ module Pipeline
|
|
40
40
|
# Reserve Sample ID's for all the seminal parent's
|
41
41
|
# Returns and array of strings with both the sampleID and the sequence number in the format: AAA000000 0000
|
42
42
|
# Only keep first 6 characters which represent the sample id's (remove the sequence suffix)
|
43
|
-
@
|
43
|
+
@sample_id_pool = @bsi.batch.reserveAvailableBsiIds( @id, 'LAA000000', num_seminal_parents ).map{|i| i[0..-6]} if num_seminal_parents > 0
|
44
44
|
# Not sure why I've been getting this error periodically, but it happens
|
45
45
|
rescue NoMethodError
|
46
46
|
fails += 1
|
47
47
|
retry if fails < 3
|
48
48
|
end
|
49
|
+
|
50
|
+
collection_dates = @specimens.map{|s| s.date_drawn}.uniq
|
51
|
+
specimen_types = @specimens.map{|s| s.specimen_type}.uniq
|
52
|
+
collection_dates.each do |date|
|
53
|
+
specimen_types.each do |type|
|
54
|
+
specimen_family = @specimens.select{|s| s.date_drawn == date && s.specimen_type == type}
|
55
|
+
family_sample_id = @sample_id_pool.pop
|
56
|
+
specimen_family.each_with_index do |spec, i|
|
57
|
+
# Assign sample and sequence numbers
|
58
|
+
spec.sample_id = family_sample_id
|
59
|
+
spec.sequence = i+1
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
49
63
|
end
|
50
64
|
|
51
65
|
def perform_edit_checks
|
data/lib/bsi-pipeline/models.rb
CHANGED
@@ -9,41 +9,32 @@ module Pipeline
|
|
9
9
|
|
10
10
|
REQUIRED_FIELDS = %w(study_id subject_id specimen_type date_drawn date_received label_status billing_method thaws).map{|v| v.to_sym}
|
11
11
|
BSI_CORE_FIELDS = {
|
12
|
+
# Sample level fields
|
13
|
+
:subject_id => 'sample.subject_id',
|
14
|
+
:sample_id => 'sample.sample_id',
|
15
|
+
:date_drawn => 'sample.date_drawn',
|
16
|
+
:kit_id => 'sample.kit_id',
|
17
|
+
:pickup_location => 'sample.pickup_location',
|
18
|
+
:sample_modifiers => 'sample.sample_modifiers',
|
19
|
+
# Vial fields
|
12
20
|
:study_id => 'vial.study_id',
|
13
|
-
:
|
21
|
+
:repos_id => 'vial.repos_id',
|
22
|
+
:sequence => 'vial.seq_num',
|
14
23
|
:current_label => 'vial.current_label',
|
24
|
+
:specimen_type => 'vial.mat_type',
|
15
25
|
:parent_id => 'vial.parent_id',
|
16
26
|
:measurement => 'vial.volume',
|
17
|
-
:
|
18
|
-
|
19
|
-
:stain_type => 'vial.field_268',
|
20
|
-
:block_status => 'vial.field_266',
|
21
|
-
:biobank => 'vial.field_269',
|
22
|
-
:grade => 'vial.field_271',
|
27
|
+
:vial_status => 'vial.vial_status',
|
28
|
+
# Location Fields
|
23
29
|
:room => 'location.room',
|
24
30
|
:building => 'location.building',
|
25
31
|
:freezer => 'location.freezer',
|
26
32
|
:shelf => 'location.shelf',
|
27
33
|
:rack => 'location.rack',
|
28
34
|
:box => 'location.box',
|
35
|
+
# Vial-Location fields
|
29
36
|
:row => 'vial_location.row',
|
30
|
-
:col => 'vial_location.col'
|
31
|
-
:sample_id => 'sample.sample_id',
|
32
|
-
:appointment_time => 'sample.appointment_time',
|
33
|
-
:center => 'sample.center',
|
34
|
-
:data_manager => 'sample.data_manager',
|
35
|
-
:date_drawn => 'sample.date_drawn',
|
36
|
-
:cra => 'sample.cra',
|
37
|
-
:kit_id => 'sample.kit_id',
|
38
|
-
:pickup_location => 'sample.pickup_location',
|
39
|
-
:subject_id => 'sample.subject_id',
|
40
|
-
:surgeon => 'sample.surgeon',
|
41
|
-
:referring_physician => 'sample.field_273',
|
42
|
-
:surgical_case_number => 'sample.surgical_case_number',
|
43
|
-
:surgical_case_part => 'sample.field_267',
|
44
|
-
:telephone => 'sample.telephone',
|
45
|
-
:timepoint => 'sample.time_point',
|
46
|
-
:sample_modifiers => 'sample.sample_modifiers'
|
37
|
+
:col => 'vial_location.col'
|
47
38
|
}
|
48
39
|
|
49
40
|
# Define Defaults
|
data/lib/bsi-pipeline/version.rb
CHANGED
data/spec/factories/specimen.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bsi-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elijah Christensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|