Skip to content

Commit

Permalink
Merge pull request #130 from sanger/develop
Browse files Browse the repository at this point in the history
Merge develop to master - CT channel changes
  • Loading branch information
andrewsparkes authored Oct 15, 2020
2 parents c90df5f + 4450c25 commit 6e4d179
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 64 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ You can also stop a worker by calling `stop` or restart it with `restart`.

If you receive an error about a missing output file under `tmp/pid/` it may be that you need to create this directory manually.
Once the directory above has been inserted at the root of the repository, the error should go away.

#### How To Section

Cog Uk Ids - These ids are given to positive samples imported through the Lighthouse-UI. This process should automatically record those Ids in the sample table, and also into the lighthouse_sample table.
To migrate Cog Uk Ids into the lighthouse_sample table manually via SQL, see this Confluence page:
https://ssg-confluence.internal.sanger.ac.uk/display/PSD/How+to+migrate+Cog+UK+IDs+into+the+lighthouse_sample+table
21 changes: 21 additions & 0 deletions db/migrate/20200929142921_add_ct_columns_to_lighthouse_samples.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

# Adds the CT channel columns to the lighthouse_sample table
class AddCtColumnsToLighthouseSamples < ActiveRecord::Migration
def change
change_table :lighthouse_sample, bulk: true do |t|
t.string :ch1_target, null: true, comment: 'Target for channel 1', after: :lab_id
t.string :ch1_result, null: true, comment: 'Result for channel 1', after: :ch1_target
t.decimal :ch1_cq, precision: 11, scale: 8, null: true, comment: 'Cq value for channel 1', after: :ch1_result
t.string :ch2_target, null: true, comment: 'Target for channel 2', after: :ch1_cq
t.string :ch2_result, null: true, comment: 'Result for channel 2', after: :ch2_target
t.decimal :ch2_cq, precision: 11, scale: 8, null: true, comment: 'Cq value for channel 2', after: :ch2_result
t.string :ch3_target, null: true, comment: 'Target for channel 3', after: :ch2_cq
t.string :ch3_result, null: true, comment: 'Result for channel 3', after: :ch3_target
t.decimal :ch3_cq, precision: 11, scale: 8, null: true, comment: 'Cq value for channel 3', after: :ch3_result
t.string :ch4_target, null: true, comment: 'Target for channel 4', after: :ch3_cq
t.string :ch4_result, null: true, comment: 'Result for channel 4', after: :ch4_target
t.decimal :ch4_cq, precision: 11, scale: 8, null: true, comment: 'Cq value for channel 4', after: :ch4_result
end
end
end
16 changes: 15 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,18 @@ CREATE TABLE `lighthouse_sample` (
`date_tested` datetime DEFAULT NULL COMMENT 'date_tested_string in date format',
`source` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Lighthouse centre that the sample came from',
`lab_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Id of the lab, within the Lighthouse centre',
`ch1_target` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Target for channel 1',
`ch1_result` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Result for channel 1',
`ch1_cq` decimal(11,8) DEFAULT NULL COMMENT 'Cq value for channel 1',
`ch2_target` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Target for channel 2',
`ch2_result` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Result for channel 2',
`ch2_cq` decimal(11,8) DEFAULT NULL COMMENT 'Cq value for channel 2',
`ch3_target` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Target for channel 3',
`ch3_result` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Result for channel 3',
`ch3_cq` decimal(11,8) DEFAULT NULL COMMENT 'Cq value for channel 3',
`ch4_target` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Target for channel 4',
`ch4_result` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Result for channel 4',
`ch4_cq` decimal(11,8) DEFAULT NULL COMMENT 'Cq value for channel 4',
`created_at` datetime DEFAULT NULL COMMENT 'When this record was inserted',
`updated_at` datetime DEFAULT NULL COMMENT 'When this record was last updated',
PRIMARY KEY (`id`),
Expand Down Expand Up @@ -474,7 +486,7 @@ CREATE TABLE `study_users` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2020-09-21 16:04:05
-- Dump completed on 2020-09-30 17:50:31
INSERT INTO schema_migrations (version) VALUES ('20141113110635');

INSERT INTO schema_migrations (version) VALUES ('20141113130813');
Expand Down Expand Up @@ -575,3 +587,5 @@ INSERT INTO schema_migrations (version) VALUES ('20200903104439');

INSERT INTO schema_migrations (version) VALUES ('20200909085557');

INSERT INTO schema_migrations (version) VALUES ('20200929142921');

63 changes: 0 additions & 63 deletions lib/tasks/update_cog_uk_ids_in_lighthouse_sample.rake

This file was deleted.

12 changes: 12 additions & 0 deletions spec/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
date_tested Time.new(2020, 4, 1, 1, 0, 0, '+00:00')
source 'Test Centre'
lab_id 'TC'
ch1_target 'ORF1ab'
ch1_result 'Positive'
ch1_cq 12.46979445
ch2_target 'N gene'
ch2_result 'Positive'
ch2_cq 13.2452244
ch3_target 'S gene'
ch3_result 'Positive'
ch3_cq 13.07034452
ch4_target 'MS2'
ch4_result 'Positive'
ch4_cq 24.98589115
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
Expand Down

0 comments on commit 6e4d179

Please sign in to comment.