Skip to content

Commit

Permalink
Merge pull request #4045 from sanger/develop
Browse files Browse the repository at this point in the history
DPL-1101: Accept RVI Barcodes
  • Loading branch information
dasunpubudumal authored Mar 7, 2024
2 parents b189ed8 + 5ce27a3 commit 53e6827
Show file tree
Hide file tree
Showing 24 changed files with 1,617 additions and 104 deletions.
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.31.0
14.31.1
12 changes: 11 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,17 @@ group :default do
# https://github.com/JamesGlover/sequencescape/tree/depfu/update/jsonapi-resources-0.9.5
# but not only is there a failing test, but performance was tanking in a few places
# due to not correctly eager loading dependencies on nested resources.
gem 'jsonapi-resources', '0.9.0'

# Versions above 0.9.0 are incompatible and it is too much work to upgrade at
# this time. Implementing new patches for updates is not a long term solution
# as the internals keep changing. However, version 0.9.0 is blocking us from
# updating rails to version 6.1 . The following steps show the process for an
# alternative solution:
# - Fork jsonpi-resources repository
# - Create a branch off version 0.9.0
# - Remove the ActionController::ForceSSL module
# - Load the gem from the branch
gem 'jsonapi-resources', github: 'sanger/jsonapi-resources', branch: 'develop'

# Wraps bunny with connection pooling ad consumer process handling
gem 'sanger_warren'
Expand Down
40 changes: 23 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ GIT
activemodel
activerecord (>= 4.0.0)

GIT
remote: https://github.com/sanger/jsonapi-resources.git
revision: be2fb43f5f8da2e632fb5f48200928b2dd3d8bf9
branch: develop
specs:
jsonapi-resources (0.9.0)
activerecord (>= 4.1)
concurrent-ruby
railties (>= 4.1)

GIT
remote: https://github.com/sanger/record_loader
revision: 9e7481f4d2342f042ab13465962e5d6689863198
Expand Down Expand Up @@ -76,7 +86,7 @@ GEM
activerecord (6.0.6.1)
activemodel (= 6.0.6.1)
activesupport (= 6.0.6.1)
activerecord-import (1.5.0)
activerecord-import (1.5.1)
activerecord (>= 4.2)
activeresource (6.0.0)
activemodel (>= 6.0)
Expand All @@ -103,7 +113,7 @@ GEM
bootsnap (1.16.0)
msgpack (~> 1.2)
builder (3.2.4)
bullet (7.1.1)
bullet (7.1.6)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
bunny (2.22.0)
Expand Down Expand Up @@ -135,7 +145,7 @@ GEM
choice (0.2.0)
chronic (0.10.2)
coderay (1.1.3)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
configatron (4.5.1)
connection_pool (2.4.1)
crack (0.4.5)
Expand Down Expand Up @@ -184,7 +194,7 @@ GEM
date (3.3.3)
delayed_job (4.1.11)
activesupport (>= 3.0, < 8.0)
delayed_job_active_record (4.1.7)
delayed_job_active_record (4.1.8)
activerecord (>= 3.0, < 8.0)
delayed_job (>= 3.0, < 5)
diff-lcs (1.5.0)
Expand Down Expand Up @@ -221,16 +231,12 @@ GEM
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
json (2.6.3)
jsonapi-resources (0.9.0)
activerecord (>= 4.1)
concurrent-ruby
railties (>= 4.1)
jsonapi-resources-matchers (1.0.0)
jsonapi-resources (>= 0.9.0)
knapsack_pro (5.7.0)
Expand All @@ -257,8 +263,8 @@ GEM
mime-types-data (3.2023.0808)
mini_magick (4.12.0)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
minitest (5.20.0)
mini_portile2 (2.8.5)
minitest (5.22.2)
minitest-profiler (0.0.2)
activesupport (>= 4.1.0)
minitest (>= 5.3.3)
Expand All @@ -282,7 +288,7 @@ GEM
net-protocol
netrc (0.11.0)
nio4r (2.7.0)
nokogiri (1.15.4)
nokogiri (1.16.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.23.0)
Expand All @@ -301,10 +307,10 @@ GEM
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (2.2.8)
rack (2.2.8.1)
rack-acceptable (0.1.0)
rack (>= 1.1.0)
rack-cors (2.0.1)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-mini-profiler (3.1.1)
rack (>= 1.2.0)
Expand Down Expand Up @@ -520,10 +526,10 @@ GEM
will_paginate (>= 3.0.3)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.34)
yard (0.9.36)
yard-activerecord (0.0.16)
yard (>= 0.8.3)
zeitwerk (2.6.12)
zeitwerk (2.6.13)

PLATFORMS
ruby
Expand Down Expand Up @@ -555,7 +561,7 @@ DEPENDENCIES
flipper-ui (~> 0.25.0)
formtastic
json
jsonapi-resources (= 0.9.0)
jsonapi-resources!
jsonapi-resources-matchers
knapsack_pro
launchy
Expand Down
68 changes: 17 additions & 51 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,55 +1,21 @@
Sequencescape - A open source project and lab management systems
MIT License

Authors:
Andrew Page <andrewjpage@gmail.com>
Andrew Sparkes <as28@sanger.ac.uk>
Arfon Smith <as8@sanger.ac.uk>
Beth Jones <bj2@sanger.ac.uk>
Cinzia Malangone <cm10@sanger.ac.uk>
Conny Brunnkvist <cb16@sanger.ac.uk>
Constantine Nicolou <cn5@sanger.ac.uk>
David Franklin <df2@sanger.ac.uk>
Eduardo Martin Rojo <emr@sanger.ac.uk>
Harriet Craven <hc6@sanger.ac.uk>
James Glover <james.glover@sanger.ac.uk>
Jens Raaby <jr16@sanger.ac.uk>
Kate Taylor <kt6@sanger.ac.uk>
Lars G T Jorgensen <lj3@sanger.ac.uk>
Luca Da Rin Fioretto <ldrf@sanger.ac.uk>
Matthew Astley <mca@sanger.ac.uk>
Matthew Denner <md12@sanger.ac.uk>
Matt Wood <mw4@sanger.ac.uk>
Maxime Bourget <mb14@sanger.ac.uk>
Neil Sycamore <nts@sanger.ac.uk>
Niels Jansen <nj3@sanger.ac.uk>
Paul Thornthwaite <pt2@sanger.ac.uk>
Paul Western <pw6@sanger.ac.uk>
Sean Dunn <sd9@sanger.ac.uk>
Simon Holroyd <holroyd@sanger.ac.uk>
Stephen Inglis <si5@sanger.ac.uk>
Yana Proskurina <yp3@sanger.ac.uk>
Copyright (c) 2024 Wellcome Sanger Institute - PSD

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.


The usage of a range of years within a copyright statement contained within
this distribution should be interpreted as being equivalent to a list of years
including the first and last year specified and all consecutive years between
them. For example, a copyright statement that reads "Copyright (c) 2005, 2007-
2009, 2011-2012" should be interpreted as being identical to a statement that
reads "Copyright (c) 2005, 2007, 2008, 2009, 2011, 2012" and a copyright
statement that reads "Copyright (c) 2005-2012" should be interpreted as being
identical to a statement that reads "Copyright (c) 2005, 2006, 2007, 2008, 2009
, 2010 , 2011 , 2012".
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 3 additions & 1 deletion app/models/barcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class Barcode < ApplicationRecord
plymouth_v2: 43,
leamington_spa_v3: 44,
brants_bridge_v3: 45,
ibd_response: 46
ibd_response: 46,
rvi: 47
}

# Barcode formats which may be submitted via sample manifests
Expand Down Expand Up @@ -112,6 +113,7 @@ class Barcode < ApplicationRecord
leamington_spa_v3
brants_bridge_v3
ibd_response
rvi
].freeze

validate :barcode_valid?
Expand Down
8 changes: 8 additions & 0 deletions app/models/barcode/format_handlers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -569,4 +569,12 @@ class EastLondonGenesAndHealthV2 < BaseRegExBarcode
class IbdResponse < BaseRegExBarcode
self.format = /\A(?<prefix>IBDR)(?<number>[0-9]{6})\z/
end

# Support for RVI barcodes.
# Expected formats:
# RVI-nnnnnn
# where n is a digit
class Rvi < BaseRegExBarcode
self.format = /\A(?<prefix>RVI)-(?<number>[0-9]{6,})\z/
end
end
9 changes: 9 additions & 0 deletions app/models/labware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,15 @@ def scanned_in_date
scanned_into_lab_event.try(:content) || ''
end

def received_date
self
&.asset_audits
&.where(key: 'slf_receive_plates')
&.where('message LIKE ?', '%Reception fridge%')
&.last
&.created_at
end

def retention_instructions
@retention_instructions ||= obtain_retention_instructions
end
Expand Down
33 changes: 23 additions & 10 deletions app/models/location_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,19 @@ def check_maxlength_of_barcodes
end

def column_headers
%w[ScannedBarcode HumanBarcode Type Created Location Service RetentionInstructions StudyName StudyId FacultySponsor]
%w[
ScannedBarcode
HumanBarcode
Type
Created
ReceivedDate
Location
Service
RetentionInstructions
StudyName
StudyId
FacultySponsor
]
end

def generate!
Expand Down Expand Up @@ -140,15 +152,16 @@ def generate_report_row(cur_plate, cur_study)
end

def generate_plate_cols_for_row(cur_plate)
cols = [] << cur_plate.machine_barcode
cols << cur_plate.human_barcode

# NB. some older plates do not have a purpose
cols << (cur_plate.plate_purpose&.name || 'Unknown')
cols << cur_plate.created_at.strftime('%Y-%m-%d %H:%M:%S')
cols << cur_plate.storage_location
cols << cur_plate.storage_location_service
cols << (cur_plate.retention_instructions || 'Unknown')
[
cur_plate.machine_barcode,
cur_plate.human_barcode,
cur_plate.plate_purpose&.name || 'Unknown', # NB. some older plates do not have a purpose
cur_plate.created_at.strftime('%Y-%m-%d %H:%M:%S'),
cur_plate.received_date&.strftime('%Y-%m-%d %H:%M:%S') || 'Unknown',
cur_plate.storage_location,
cur_plate.storage_location_service,
cur_plate.retention_instructions || 'Unknown'
]
end

def generate_study_cols_for_row(cur_study)
Expand Down
2 changes: 2 additions & 0 deletions app/models/study.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ class Study < ApplicationRecord # rubocop:todo Metrics/ClassLength
# This excludes supplementary characters, which include emoji and rare kanji
validates :study_abstract, :study_study_title, :study_description, :s3_email_list, utf8mb3: true

validates :data_release_delay_other_comment, length: { maximum: 255 }

# These fields are restricted further as they aren't expected to ever contain anything more than ASCII
validates :study_project_id,
:ega_dac_accession_number,
Expand Down
Loading

0 comments on commit 53e6827

Please sign in to comment.