Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master merge: DPL-1063 As a developer I need to create a table to store aliquots to track library volumes and enable top-up management #613

Merged
merged 48 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
c9c468a
Update rack to version 2.2.8.1
depfu[bot] Mar 7, 2024
401e79d
Merge pull request #595 from sanger/depfu/update/rack-2.2.8.1
yoldas Mar 7, 2024
527403c
Update railties to version 7.0.8.1
depfu[bot] Mar 7, 2024
4e29422
Merge pull request #596 from sanger/depfu/update/group/rails-7.0.8.1
yoldas Mar 7, 2024
f4d17cd
Update rubocop to version 1.62.1
depfu[bot] Mar 12, 2024
e1d9f81
Rubocop
yoldas Mar 12, 2024
cbe56cd
Merge pull request #605 from sanger/depfu/update/rubocop-1.62.1
yoldas Mar 12, 2024
b81aabc
Update rubocop-rspec to version 2.27.1
depfu[bot] Mar 12, 2024
85bfdb9
Merge pull request #603 from sanger/depfu/update/rubocop-rspec-2.27.1
yoldas Mar 12, 2024
5efec77
Update rubocop-rails to version 2.24.0
depfu[bot] Mar 12, 2024
fdf85fd
Merge pull request #602 from sanger/depfu/update/rubocop-rails-2.24.0
yoldas Mar 12, 2024
f618ad1
Update rspec-rails to version 6.1.2
depfu[bot] Mar 19, 2024
f77f3fe
Merge pull request #606 from sanger/depfu/update/rspec-rails-6.1.2
yoldas Mar 21, 2024
d87b950
Update rubocop-rails to version 2.24.1
depfu[bot] Mar 26, 2024
b3894cd
Merge pull request #607 from sanger/depfu/update/rubocop-rails-2.24.1
yoldas Mar 27, 2024
bbac790
Update rubocop-rspec to version 2.28.0
depfu[bot] Mar 30, 2024
ee86bff
Update rubocop-performance to version 1.21.0
depfu[bot] Mar 31, 2024
701a969
Creating the migration for aliquots table
dasunpubudumal Apr 4, 2024
9574f08
Adding the views_schema.rb back
dasunpubudumal Apr 4, 2024
c810200
Adding the views_schema.rb back
dasunpubudumal Apr 4, 2024
940344b
Updating tests
dasunpubudumal Apr 5, 2024
8c536dc
Updating comments
dasunpubudumal Apr 5, 2024
e11e790
Adding collation
dasunpubudumal Apr 5, 2024
7419ca7
Merge remote-tracking branch 'origin/depfu/update/rubocop-performance…
dasunpubudumal Apr 5, 2024
80d1e79
Merge remote-tracking branch 'origin/depfu/update/rubocop-rspec-2.28.…
dasunpubudumal Apr 5, 2024
a0b2888
Adding collation
dasunpubudumal Apr 5, 2024
724de77
Adding collation
dasunpubudumal Apr 5, 2024
4108675
Adding collation
dasunpubudumal Apr 5, 2024
211cb35
Adding collation
dasunpubudumal Apr 5, 2024
bb2464e
Refactoring tests
dasunpubudumal Apr 5, 2024
c3393aa
Update rubocop-rspec to version 2.29.1
depfu[bot] Apr 6, 2024
d35eb01
Refactoring tests
dasunpubudumal Apr 8, 2024
93ce520
Merge remote-tracking branch 'origin/depfu/update/rubocop-rspec-2.29.…
dasunpubudumal Apr 8, 2024
222fbcb
Timestamps + Concentration added
dasunpubudumal Apr 9, 2024
c722fce
Fix created attribute
dasunpubudumal Apr 9, 2024
3046a15
Update rubocop to version 1.63.0
depfu[bot] Apr 9, 2024
d2c3557
Fix created attribute and rspec
dasunpubudumal Apr 10, 2024
2b22429
Adding top-level comment for Aliquot class.
dasunpubudumal Apr 10, 2024
21d3a92
Adding uuid and ignoring it in json for making it behave like a singu…
dasunpubudumal Apr 10, 2024
6f21600
Adding back views_schema.rb
dasunpubudumal Apr 10, 2024
0ca4294
Fixing to add a UUID
dasunpubudumal Apr 10, 2024
ec1a7b4
Fixing to add a UUID
dasunpubudumal Apr 10, 2024
443ef08
Fixing to add a UUID
dasunpubudumal Apr 10, 2024
e6ef9d5
Merge remote-tracking branch 'origin/depfu/update/rubocop-1.63.0' int…
dasunpubudumal Apr 10, 2024
c4c773a
Added units for the comments.
dasunpubudumal Apr 10, 2024
dddbe05
Merge pull request #610 from sanger/582-dpl-1063-as-a-developer-i-nee…
dasunpubudumal Apr 11, 2024
059d41c
Merge branch 'master' into develop
dasunpubudumal Apr 11, 2024
ec3e29f
Update release-version
dasunpubudumal Apr 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ coverage

# Ignore .talismanrc
.talismanrc

.idea
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.5
1.17.6
101 changes: 52 additions & 49 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (7.0.8)
activesupport (= 7.0.8)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activemodel (7.0.8)
activesupport (= 7.0.8)
activerecord (7.0.8)
activemodel (= 7.0.8)
activesupport (= 7.0.8)
activesupport (7.0.8)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activesupport (7.0.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -42,7 +42,7 @@ GEM
concurrent-ruby (1.2.3)
connection_pool (2.2.5)
crass (1.0.6)
diff-lcs (1.5.0)
diff-lcs (1.5.1)
docile (1.4.0)
erubi (1.12.0)
factory_bot (6.4.5)
Expand Down Expand Up @@ -71,9 +71,9 @@ GEM
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
hashie (5.0.0)
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
json (2.7.1)
json (2.7.2)
language_server-protocol (3.17.0.3)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
Expand All @@ -84,12 +84,12 @@ GEM
lumberjack (1.2.9)
method_source (1.0.0)
mini_portile2 (2.8.5)
minitest (5.21.2)
minitest (5.22.3)
msgpack (1.7.2)
multi_json (1.15.0)
mysql2 (0.5.6)
nenv (0.3.0)
nokogiri (1.16.2)
nokogiri (1.16.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
notiffany (0.1.3)
Expand All @@ -103,7 +103,7 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.7.3)
rack (2.2.8)
rack (2.2.9)
rack-test (2.1.0)
rack (>= 1.3)
rails-dom-testing (2.2.0)
Expand All @@ -113,9 +113,9 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand All @@ -128,56 +128,59 @@ GEM
rbtree (0.4.4)
regexp_parser (2.9.0)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.1.1)
rspec-support (~> 3.13.0)
rspec-rails (6.1.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.12)
rspec-expectations (~> 3.12)
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rubocop (1.60.2)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rubocop (1.63.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.0)
rubocop (~> 1.33)
rubocop-performance (1.20.2)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.23.1)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.24.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rspec (2.26.1)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.29.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.2)
rubocop (~> 1.40)
ruby-progressbar (1.13.0)
sanger_warren (0.4.1)
bunny (~> 2.17)
Expand All @@ -195,11 +198,11 @@ GEM
sorted_set (1.0.3)
rbtree
set (~> 1.0)
thor (1.3.0)
thor (1.3.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
zeitwerk (2.6.12)
zeitwerk (2.6.13)

PLATFORMS
ruby
Expand Down
18 changes: 18 additions & 0 deletions app/models/aliquot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# Aliquot model
# This model is used to store aliquot data
class Aliquot < ApplicationRecord
include ResourceTools
include SingularResourceTools

def self.base_resource_key
'lims_uuid'
end

json do
translate(
uuid: :lims_uuid
)
end
end
24 changes: 24 additions & 0 deletions db/migrate/20240404142248_create_aliquots.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class CreateAliquots < ActiveRecord::Migration[7.0]
def up
create_table :aliquot, primary_key: :id, options: 'CHARSET=utf8 COLLATE=utf8_unicode_ci' do |t|
t.string :id_lims, null: false, comment: 'The LIMS system that the aliquot was created in'
t.string :lims_uuid, null: false, comment: 'The UUID of the aliquot in the LIMS system'
t.string :aliquot_type, null: false, comment: 'The type of the aliquot'
t.string :source_type, null: false, comment: 'The type of the source of the aliquot'
t.string :source_barcode, null: false, comment: 'The barcode of the source of the aliquot'
t.string :sample_name, null: false, comment: 'The name of the sample that the aliquot was created from'
t.string :used_by_type, null: false, comment: 'The type of the entity that the aliquot is used by'
t.string :used_by_barcode, null: false, comment: 'The barcode of the entity that the aliquot is used by'
t.decimal :volume, precision: 10, scale: 2, null: false, comment: 'The volume of the aliquot (uL)'
t.decimal :concentration, precision: 10, scale: 2, comment: 'The concentration of the aliquot (ng/ul)'
t.datetime :created, null: false, comment: 'The date and time that the aliquot was created'
t.datetime :last_updated, null: false, comment: 'The date and time that the aliquot was last updated'
t.datetime :deleted_at, comment: 'The date and time that the aliquot was deleted'
t.datetime :recorded_at, comment: 'The date and time that the aliquot was recorded'
end
end

def down
drop_table :aliquot
end
end
19 changes: 18 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,24 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_02_28_140011) do
ActiveRecord::Schema[7.0].define(version: 2024_04_04_142248) do
create_table "aliquot", charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t|
t.string "id_lims", null: false, comment: "The LIMS system that the aliquot was created in"
t.string "lims_uuid", null: false, comment: "The UUID of the aliquot in the LIMS system"
t.string "aliquot_type", null: false, comment: "The type of the aliquot"
t.string "source_type", null: false, comment: "The type of the source of the aliquot"
t.string "source_barcode", null: false, comment: "The barcode of the source of the aliquot"
t.string "sample_name", null: false, comment: "The name of the sample that the aliquot was created from"
t.string "used_by_type", null: false, comment: "The type of the entity that the aliquot is used by"
t.string "used_by_barcode", null: false, comment: "The barcode of the entity that the aliquot is used by"
t.decimal "volume", precision: 10, scale: 2, null: false, comment: "The volume of the aliquot (uL)"
t.decimal "concentration", precision: 10, scale: 2, comment: "The concentration of the aliquot (ng/ul)"
t.datetime "created", null: false, comment: "The date and time that the aliquot was created"
t.datetime "last_updated", null: false, comment: "The date and time that the aliquot was last updated"
t.datetime "deleted_at", comment: "The date and time that the aliquot was deleted"
t.datetime "recorded_at", comment: "The date and time that the aliquot was recorded"
end

create_table "bmap_flowcell", primary_key: "id_bmap_flowcell_tmp", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t|
t.datetime "last_updated", precision: nil, null: false, comment: "Timestamp of last update"
t.datetime "recorded_at", precision: nil, null: false, comment: "Timestamp of warehouse update"
Expand Down
2 changes: 0 additions & 2 deletions lib/resource_tools/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def custom_value(name, &block)
end
end

# rubocop:disable Style/ArgumentsForwarding
def initialize(*args, &block)
super
if self.class.custom_values.present?
Expand All @@ -157,7 +156,6 @@ def initialize(*args, &block)
convert_booleans
delete_if { |k, _| ignoreable.include?(k) }
end
# rubocop:enable Style/ArgumentsForwarding

def convert_booleans
self.stored_as_boolean.each do |key|
Expand Down
16 changes: 16 additions & 0 deletions spec/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,20 @@
created_at { Time.new(2020, 4, 2, 1, 0, 0, '+00:00') }
updated_at { Time.new(2020, 4, 2, 1, 0, 0, '+00:00') }
end

factory :aliquot do
sequence(:id) { |n| n }
id_lims { 'example' }
lims_uuid { '000000-0000-0000-0000-0000000002' }
aliquot_type { 'derivative' }
source_type { 'library' }
source_barcode { 'PR-rna-00000001_H12' }
sample_name { 'aliquot-sample' }
used_by_type { 'pool' }
used_by_barcode { 'pool-barcode' }
volume { 24.98589115 }
concentration { 12.46979445 }
created { Time.new(2012, 3, 11, 10, 20, 8, '+00:00') }
last_updated { Time.new(2012, 3, 11, 10, 20, 8, '+00:00') }
end
end
23 changes: 23 additions & 0 deletions spec/models/aliquots_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

require 'spec_helper'

describe Aliquot do
context 'aliquots' do
let(:json) do
{ 'id_lims' => 'example',
'aliquot_type' => 'DNA',
'volume' => 5.43,
'concentration' => 2.34,
'lims_uuid' => '000000-0000-0000-0000-0000000002',
'source_type' => 'library',
'source_barcode' => 'PR-rna-00000001_H12',
'sample_name' => 'aliquot-sample',
'used_by_type' => 'pool',
'used_by_barcode' => 'pool-barcode',
'last_updated' => '2012-03-11 10:20:08',
'created' => '2012-03-11 10:20:08' }
end
it_behaves_like 'a singular resource'
end
end
Loading