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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da8770522f67c26feadc1b7c0dda5c3fd0102ee8
4
- data.tar.gz: 7b7015a241731259f6e2f1c464d340560165bcd7
3
+ metadata.gz: e760c06f87edb57bc12c989c853a24d011ea87a1
4
+ data.tar.gz: 65d77160c4c42829be1db9842146916c8e667ba2
5
5
  SHA512:
6
- metadata.gz: c70bd4aede6d34995476a04c844206e2535b2085f7bb6d3d2ebb9364429bd936d49bc98ed3b5b7fddda3fb15f1ca094c3a39c2954f946709033f45aa4e582c67
7
- data.tar.gz: 061831ad86709de8cb98ca27c62ec9366fbc03c65e22ae00dde8c9a08c2acb56145c7338148fa206830715972fa195d4b1cbb1e25102b88f0a97a8637a07823d
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
- @seminal_parents = @bsi.batch.reserveAvailableBsiIds( @id, 'LAA000000', num_seminal_parents ).map{|i| i[0..-6]} if num_seminal_parents > 0
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
@@ -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
- :specimen_type => 'vial.mat_type',
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
- :measurement_est => 'vial.volume_est',
18
- :measurement_unit => 'vial.volume_unit',
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
@@ -1,5 +1,5 @@
1
1
  module Bsi
2
2
  module Pipeline
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -24,7 +24,6 @@ FactoryGirl.define do
24
24
  # Generic Slide Specimen
25
25
  trait :slide do
26
26
  specimen_type "SLDTS"
27
- stain_type "H&E"
28
27
  end
29
28
 
30
29
  factory :slide_specimen, traits: [:slide]
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
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-23 00:00:00.000000000 Z
11
+ date: 2014-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler