From f192daa34a0447b907c081193c9c74c98475154d Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 19:00:26 +0000 Subject: [PATCH 01/43] Update eslint-config-prettier to version 8.10.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 428a2decb..7598a0207 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "babel-jest": "^27.5.1", "core-js": "^3.31.1", "eslint": "^6.0.0", - "eslint-config-prettier": "^8.8.0", + "eslint-config-prettier": "^8.10.0", "eslint-plugin-jest": "^24.7.0", "eslint-plugin-vue": "^6.2.2", "jest": "^27.5.1", diff --git a/yarn.lock b/yarn.lock index 633e9eb89..a7e094626 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5222,10 +5222,10 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" -eslint-config-prettier@^8.8.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz#bfda738d412adc917fd7b038857110efe98c9348" - integrity sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA== +eslint-config-prettier@^8.10.0: + version "8.10.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz#3a06a662130807e2502fc3ff8b4143d8a0658e11" + integrity sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg== eslint-plugin-jest@^24.7.0: version "24.7.0" From ecdc3dd0784fac7a8f78ba108a381fb0237eb39e Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 19:15:20 +0000 Subject: [PATCH 02/43] Update cytoscape to version 3.26.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 428a2decb..b09744b63 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "axios": "^0.21.4", "babel-loader": "^8.2.5", "bootstrap-vue": "^2.23.1", - "cytoscape": "^3.25.0", + "cytoscape": "^3.26.0", "devour-client": "^2.1.2", "flush-promises": "^1.0.0", "pluralize": "^7.0.0", diff --git a/yarn.lock b/yarn.lock index 633e9eb89..504f0f29b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4779,10 +4779,10 @@ cyclist@^1.0.1: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= -cytoscape@^3.25.0: - version "3.25.0" - resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.25.0.tgz#5289e9d18be0293b073bfe93f83bb95b908b2dc1" - integrity sha512-7MW3Iz57mCUo6JQCho6CmPBCbTlJr7LzyEtIkutG255HLVd4XuBg2I9BkTZLI/e4HoaOB/BiAzXuQybQ95+r9Q== +cytoscape@^3.26.0: + version "3.26.0" + resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.26.0.tgz#b4c6961445fd51e1fd3cca83c3ffe924d9a8abc9" + integrity sha512-IV+crL+KBcrCnVVUCZW+zRRRFUZQcrtdOPXki+o4CFUWLdAEYvuZLcBSJC9EBK++suamERKzeY7roq2hdovV3w== dependencies: heap "^0.2.6" lodash "^4.17.21" From 4b267b2fc24131a4fe638a126e80d41e99817d0f Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 19:25:23 +0000 Subject: [PATCH 03/43] Update axios-mock-adapter to version 1.22.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 428a2decb..a3c29f757 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "@babel/plugin-transform-runtime": "^7.15.0", "@prettier/plugin-ruby": "^2.1.0", "@vue/test-utils": "^1.0.0-beta.25", - "axios-mock-adapter": "^1.21.5", + "axios-mock-adapter": "^1.22.0", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^10.0.1", "babel-jest": "^27.5.1", diff --git a/yarn.lock b/yarn.lock index 633e9eb89..883e97e22 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3345,10 +3345,10 @@ autoprefixer@^9.6.1: postcss "^7.0.30" postcss-value-parser "^4.1.0" -axios-mock-adapter@^1.21.5: - version "1.21.5" - resolved "https://registry.yarnpkg.com/axios-mock-adapter/-/axios-mock-adapter-1.21.5.tgz#dd85081717a759f88509c20515082dc09c1cedd7" - integrity sha512-5NI1V/VK+8+JeTF8niqOowuysA4b8mGzdlMN/QnTnoXbYh4HZSNiopsDclN2g/m85+G++IrEtUdZaQ3GnaMsSA== +axios-mock-adapter@^1.22.0: + version "1.22.0" + resolved "https://registry.yarnpkg.com/axios-mock-adapter/-/axios-mock-adapter-1.22.0.tgz#0f3e6be0fc9b55baab06f2d49c0b71157e7c053d" + integrity sha512-dmI0KbkyAhntUR05YY96qg2H6gg0XMl2+qTW0xmYg6Up+BFBAJYRLROMXRdDEL06/Wqwa0TJThAYvFtSFdRCZw== dependencies: fast-deep-equal "^3.1.3" is-buffer "^2.0.5" From c4a88232f9c5eaad5417123d8874aa1cf9018a25 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 07:19:54 +0000 Subject: [PATCH 04/43] Bump @babel/traverse from 7.15.4 to 7.23.2 Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.15.4 to 7.23.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 166 ++++-------------------------------------------------- 1 file changed, 12 insertions(+), 154 deletions(-) diff --git a/yarn.lock b/yarn.lock index 633e9eb89..5bc18a0d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -152,33 +152,6 @@ jsesc "^2.5.1" source-map "^0.5.0" -"@babel/generator@^7.17.9": - version "7.17.9" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.17.9.tgz#f4af9fd38fa8de143c29fce3f71852406fc1e2fc" - integrity sha512-rAdDousTwxbIxbz5I7GEQ3lUip+xVCXooZNbsydCWs3xA7ZsYOv+CFRdzGxRX78BmQHu9B1Eso59AOZQOJDEdQ== - dependencies: - "@babel/types" "^7.17.0" - jsesc "^2.5.1" - source-map "^0.5.0" - -"@babel/generator@^7.19.3": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.19.3.tgz#d7f4d1300485b4547cb6f94b27d10d237b42bf59" - integrity sha512-fqVZnmp1ncvZU757UzDheKZpfPgatqY59XtW2/j/18H7u76akb8xqvjw82f+i2UKd/ksYsSick/BCLQUUtJ/qQ== - dependencies: - "@babel/types" "^7.19.3" - "@jridgewell/gen-mapping" "^0.3.2" - jsesc "^2.5.1" - -"@babel/generator@^7.20.1": - version "7.20.2" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.2.tgz#c2e89e22613a039285c1e7b749e2cd0b30b9a481" - integrity sha512-SD75PMIK6i9H8G/tfGvB4KKl4Nw6Ssos9nGgYwxbgyTP0iX/Z55DveoH86rmUB/YHTQQ+ZC0F7xxaY8l2OF44Q== - dependencies: - "@babel/types" "^7.20.2" - "@jridgewell/gen-mapping" "^0.3.2" - jsesc "^2.5.1" - "@babel/generator@^7.23.0": version "7.23.0" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420" @@ -377,23 +350,6 @@ "@babel/template" "^7.15.4" "@babel/types" "^7.15.4" -"@babel/helper-function-name@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz#f1ec51551fb1c8956bc8dd95f38523b6cf375f8f" - integrity sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA== - dependencies: - "@babel/helper-get-function-arity" "^7.16.7" - "@babel/template" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/helper-function-name@^7.17.9": - version "7.17.9" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz#136fcd54bc1da82fcb47565cf16fd8e444b1ff12" - integrity sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg== - dependencies: - "@babel/template" "^7.16.7" - "@babel/types" "^7.17.0" - "@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.19.0": version "7.19.0" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c" @@ -417,13 +373,6 @@ dependencies: "@babel/types" "^7.15.4" -"@babel/helper-get-function-arity@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz#ea08ac753117a669f1508ba06ebcc49156387419" - integrity sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw== - dependencies: - "@babel/types" "^7.16.7" - "@babel/helper-hoist-variables@^7.15.4": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz#09993a3259c0e918f99d104261dfdfc033f178df" @@ -431,13 +380,6 @@ dependencies: "@babel/types" "^7.15.4" -"@babel/helper-hoist-variables@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246" - integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== - dependencies: - "@babel/types" "^7.16.7" - "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" @@ -855,26 +797,21 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.0.tgz#f0ac33eddbe214e4105363bb17c3341c5ffcc43c" integrity sha512-VKXSCQx5D8S04ej+Dqsr1CzYvvWgf20jIw2D+YhQCrIlr2UZGaDds23Y0xg75/skOxpLCRpUZvk/1EAVkGoDOw== -"@babel/parser@^7.17.9", "@babel/parser@^7.7.0": - version "7.17.9" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.9.tgz#9c94189a6062f0291418ca021077983058e171ef" - integrity sha512-vqUSBLP8dQHFPdPi9bc5GK9vRkYHJ49fsZdtoJ8EQ8ibpwk5rPKfvNIwChB0KVXcIjcepEBBd2VHC5r9Gy8ueg== - -"@babel/parser@^7.18.10", "@babel/parser@^7.19.3": +"@babel/parser@^7.18.10": version "7.19.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.3.tgz#8dd36d17c53ff347f9e55c328710321b49479a9a" integrity sha512-pJ9xOlNWHiy9+FuFP09DEAFbAn4JskgRsVcc169w2xRBC3FRGuQEwjeIMMND9L2zc0iEhO/tGv4Zq+km+hxNpQ== -"@babel/parser@^7.20.1": - version "7.20.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.2.tgz#9aeb9b92f64412b5f81064d46f6a1ac0881337f4" - integrity sha512-afk318kh2uKbo7BEj2QtEi8HVCGrwHUffrYDy7dgVcSa2j9lY3LDjPzcyGdpX7xgm35aWqvciZJ4WKmdF/SxYg== - "@babel/parser@^7.22.15", "@babel/parser@^7.23.0": version "7.23.0" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== +"@babel/parser@^7.7.0": + version "7.17.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.9.tgz#9c94189a6062f0291418ca021077983058e171ef" + integrity sha512-vqUSBLP8dQHFPdPi9bc5GK9vRkYHJ49fsZdtoJ8EQ8ibpwk5rPKfvNIwChB0KVXcIjcepEBBd2VHC5r9Gy8ueg== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" @@ -2036,73 +1973,10 @@ "@babel/parser" "^7.22.15" "@babel/types" "^7.22.15" -"@babel/traverse@^7.13.0", "@babel/traverse@^7.15.4", "@babel/traverse@^7.7.2": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.4.tgz#ff8510367a144bfbff552d9e18e28f3e2889c22d" - integrity sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA== - dependencies: - "@babel/code-frame" "^7.14.5" - "@babel/generator" "^7.15.4" - "@babel/helper-function-name" "^7.15.4" - "@babel/helper-hoist-variables" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - "@babel/parser" "^7.15.4" - "@babel/types" "^7.15.4" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/traverse@^7.16.7", "@babel/traverse@^7.17.0": - version "7.17.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.17.0.tgz#3143e5066796408ccc880a33ecd3184f3e75cd30" - integrity sha512-fpFIXvqD6kC7c7PUNnZ0Z8cQXlarCLtCUpt2S1Dx7PjoRtCFffvOkHHSom+m5HIxMZn5bIBVb71lhabcmjEsqg== - dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.17.0" - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-function-name" "^7.16.7" - "@babel/helper-hoist-variables" "^7.16.7" - "@babel/helper-split-export-declaration" "^7.16.7" - "@babel/parser" "^7.17.0" - "@babel/types" "^7.17.0" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/traverse@^7.19.0", "@babel/traverse@^7.19.1": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.19.3.tgz#3a3c5348d4988ba60884e8494b0592b2f15a04b4" - integrity sha512-qh5yf6149zhq2sgIXmwjnsvmnNQC2iw70UFjp4olxucKrWd/dvlUsBI88VSLUsnMNF7/vnOiA+nk1+yLoCqROQ== - dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.19.3" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.19.3" - "@babel/types" "^7.19.3" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/traverse@^7.20.1": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.1.tgz#9b15ccbf882f6d107eeeecf263fbcdd208777ec8" - integrity sha512-d3tN8fkVJwFLkHkBN479SOsw4DMZnz8cdbL/gvuDuzy3TS6Nfw80HuQqhw1pITbIruHyh7d1fMA47kWzmcUEGA== - dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.1" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.20.1" - "@babel/types" "^7.20.0" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/traverse@^7.23.0": - version "7.23.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.0.tgz#18196ddfbcf4ccea324b7f6d3ada00d8c5a99c53" - integrity sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw== +"@babel/traverse@^7.13.0", "@babel/traverse@^7.15.4", "@babel/traverse@^7.16.7", "@babel/traverse@^7.17.0", "@babel/traverse@^7.19.0", "@babel/traverse@^7.19.1", "@babel/traverse@^7.20.1", "@babel/traverse@^7.23.0", "@babel/traverse@^7.7.0", "@babel/traverse@^7.7.2": + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== dependencies: "@babel/code-frame" "^7.22.13" "@babel/generator" "^7.23.0" @@ -2115,22 +1989,6 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/traverse@^7.7.0": - version "7.17.9" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.17.9.tgz#1f9b207435d9ae4a8ed6998b2b82300d83c37a0d" - integrity sha512-PQO8sDIJ8SIwipTPiR71kJQCKQYB5NGImbOviK8K+kg5xkNSYXLBupuX9QhatFowrsvo9Hj8WgArg3W7ijNAQw== - dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.17.9" - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-function-name" "^7.17.9" - "@babel/helper-hoist-variables" "^7.16.7" - "@babel/helper-split-export-declaration" "^7.16.7" - "@babel/parser" "^7.17.9" - "@babel/types" "^7.17.0" - debug "^4.1.0" - globals "^11.1.0" - "@babel/types@^7.0.0", "@babel/types@^7.15.4", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.4.tgz#74eeb86dbd6748d2741396557b9860e57fce0a0d" @@ -2155,7 +2013,7 @@ "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" -"@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.19.3": +"@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0": version "7.19.3" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.3.tgz#fc420e6bbe54880bce6779ffaf315f5e43ec9624" integrity sha512-hGCaQzIY22DJlDh9CH7NOxgKkFjBk0Cw9xDO1Xmh2151ti7wiGfQ3LauXzL4HP1fmFlTX6XjpRETTpUcv7wQLw== @@ -2164,7 +2022,7 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" -"@babel/types@^7.20.0", "@babel/types@^7.20.2": +"@babel/types@^7.20.2": version "7.20.2" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.2.tgz#67ac09266606190f496322dbaff360fdaa5e7842" integrity sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog== From 028620baf54e8beb861f0ee30d911305fed6a7fe Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Oct 2023 17:03:11 +0100 Subject: [PATCH 05/43] wip: add initial PBMC Bank Tubes Content Report --- .../pbmc_bank_tubes_content_report.csv.erb | 107 +++++ config/exports/exports.yml | 15 +- .../scrna_core_cell_extraction.wip.yml | 2 + ..._bank_tubes_content_report.csv.erb_spec.rb | 437 ++++++++++++++++++ 4 files changed, 560 insertions(+), 1 deletion(-) create mode 100644 app/views/exports/pbmc_bank_tubes_content_report.csv.erb create mode 100644 spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb new file mode 100644 index 000000000..8cee58143 --- /dev/null +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -0,0 +1,107 @@ +<%# This is a report of the contents of the tubes in the PBMC Bank plate %> +<%= CSV.generate_line [ + 'Workflow', + @workflow + ], + row_sep: "" +%> + +<%= CSV.generate_line [ +'Well name', +'Donor ID', +'Parent barcode', +'FluidX barcode', +'Extraction and freeze date', +'Sequencing or contingency', +'Cell count', +'Viability', +'Volume', +'Study name', +'Collection site', + ], + row_sep: "" +%> +<% + rows_array = [] + @plate.wells_in_columns.each do |source_well| + # skip if well empty (not all wells have samples in them) + next if source_well.empty? + + # skip if well not in passed state + next unless source_well.passed? + + # skip if no downstream tubes for this well (not set up children in Limber yet) + next if source_well.downstream_tubes.empty? + + # expecting 1 sample tube + destination_tube = source_well.downstream_tubes.first + destination_tube_v2 = Sequencescape::Api::V2.tube_with_custom_includes( + 'custom_metadatum_collection', + nil, + barcode: destination_tube.labware_barcode.machine + ) + + next unless destination_tube_v2 && destination_tube_v2.custom_metadatum_collection + + # get tube metadata from destination tube + metadata = destination_tube_v2.custom_metadatum_collection.metadata + + next unless metadata + + tube_rack_barcode = metadata['tube_rack_barcode'] + tube_rack_position = metadata['tube_rack_position'] + + next unless tube_rack_barcode && tube_rack_position + + sample_uuid = source_well.aliquots.first.sample.uuid + + source_well_posn = source_well.position['name'] + + destination_tube_name_array = destination_tube_v2.name.split(':') + # e.g. SEQ:DESTTUBE:A1 + + purpose = ((destination_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') + + require 'inspector' + + # print out all available data + puts "----------------------------------------" + ggg @plate + ggg @plate_with_qc_results + ggg @ancestor_tubes + ggg destination_tube + ggg destination_tube_v2 + ggg purpose + ggg metadata + + ggg source_well + + ggg source_well.aliquots + ggg source_well.aliquots.first.sample + # ggg source_well.aliquots.first.sample.component_samples.first + ggg source_well.aliquots.first.sample.sample_metadata + ggg source_well.downstream_tubes + ggg source_well.qc_results.first + ggg source_well.transfer_requests_as_target.first + ggg source_well.upstream_tubes.first + + # if destination_tube_name_array.length == 3 + rows_array << [ + source_well.name, # Well name ✅ + source_well.aliquots.first.sample.sample_metadata&.donor_id, # Donor ID ✅ + @ancestor_tubes.last.labware_barcode, # Parent barcode + @ancestor_tubes.first.labware_barcode, # FluidX barcode + tube_rack_barcode, # Extraction and freeze date + purpose, # Sequencing or contingency ✅ + source_well.latest_live_cell_count, # Cell count ✅ + source_well.latest_cell_viability, # Viability ✅ # TODO: check + '135 µL', # Volume # ✅ TODO: units + source_well.aliquots.first.sample.name, # Study name + source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site ✅ + ] + # end + end +%> +<% rows_array.sort_by{ |a| WellHelpers.well_coordinate(a[1]) }.each do |row| %> +<%= CSV.generate_line row, row_sep: "" %> +<% end %> diff --git a/config/exports/exports.yml b/config/exports/exports.yml index 4bd100fab..bc63d9b9a 100644 --- a/config/exports/exports.yml +++ b/config/exports/exports.yml @@ -149,10 +149,14 @@ hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare: csv: hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare workflow: scRNA Core PBMC Bank plate_includes: - - wells.downstream_tubes - wells.aliquots - wells.aliquots.sample + - wells.aliquots.sample.component_samples - wells.aliquots.sample.sample_metadata + - wells.downstream_tubes + - wells.qc_results + - wells.transfer_requests_as_target.source_asset + - wells.upstream_tubes ancestor_tube_purpose: LRC Blood Vac hamilton_lrc_blood_bank_to_lrc_pbmc_bank: csv: hamilton_lrc_blood_bank_to_lrc_pbmc_bank @@ -164,3 +168,12 @@ hamilton_lrc_blood_bank_to_lrc_pbmc_bank: - wells.transfer_requests_as_target.source_asset ancestor_tube_purpose: LRC Blood Vac ancestor_purpose: LRC Blood Bank +pbmc_bank_tubes_content_report: + csv: pbmc_bank_tubes_content_report + workflow: scRNA Core PBMC Bank + plate_includes: + - wells.downstream_tubes + - wells.aliquots + - wells.aliquots.sample + - wells.aliquots.sample.sample_metadata + ancestor_tube_purpose: LRC Blood Vac diff --git a/config/purposes/scrna_core_cell_extraction.wip.yml b/config/purposes/scrna_core_cell_extraction.wip.yml index 4ea00ec74..ac6db152d 100644 --- a/config/purposes/scrna_core_cell_extraction.wip.yml +++ b/config/purposes/scrna_core_cell_extraction.wip.yml @@ -81,6 +81,8 @@ LRC PBMC Bank: id: hamilton_lrc_blood_bank_to_lrc_pbmc_bank - name: 'Download Hamilton LRC PBMC Bank plate to LRC Bank Seq and Spare tubes CSV' id: hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare + - name: 'Download PBMC Bank Tubes Content Report' + id: pbmc_bank_tubes_content_report :qc_thresholds: viability: units: '%' diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb new file mode 100644 index 000000000..db66c4426 --- /dev/null +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -0,0 +1,437 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'exports/pbmc_bank_tubes_content_report.csv.erb', type: :view do + include FeatureHelpers + + context 'when creating a pbmc bank tubes content report csv' do + has_a_working_api + + # samples + let(:sample1_uuid) { SecureRandom.uuid } + let(:sample2_uuid) { SecureRandom.uuid } + + let(:sample1) { create(:v2_sample, name: 'Sample1', uuid: sample1_uuid) } + let(:sample2) { create(:v2_sample, name: 'Sample2', uuid: sample2_uuid) } + + # ancestor vac tubes + let(:vac_aliquot1) { create(:v2_aliquot, sample: sample1) } + let(:vac_aliquot2) { create(:v2_aliquot, sample: sample2) } + + let(:ancestor_vac_tube_1) { create(:v2_tube, barcode_number: 1, aliquots: [vac_aliquot1]) } + let(:ancestor_vac_tube_2) { create(:v2_tube, barcode_number: 2, aliquots: [vac_aliquot2]) } + + # ancestor tubes hash + let(:ancestor_tubes) { { sample1_uuid => ancestor_vac_tube_1, sample2_uuid => ancestor_vac_tube_2 } } + + # source aliquots + let(:source_aliquot1_s1) { create(:v2_aliquot, sample: sample1) } + let(:source_aliquot2_s1) { create(:v2_aliquot, sample: sample1) } + let(:source_aliquot3_s1) { create(:v2_aliquot, sample: sample1) } + let(:source_aliquot1_s2) { create(:v2_aliquot, sample: sample2) } + let(:source_aliquot2_s2) { create(:v2_aliquot, sample: sample2) } + let(:source_aliquot3_s2) { create(:v2_aliquot, sample: sample2) } + + # source wells + let(:source_well_a1) do + create(:v2_well, location: 'A1', aliquots: [source_aliquot1_s1], downstream_tubes: [dest_tube1]) + end + let(:source_well_a2) do + create(:v2_well, location: 'A2', aliquots: [source_aliquot2_s1], downstream_tubes: [dest_tube2]) + end + let(:source_well_a3) do + create(:v2_well, location: 'A3', aliquots: [source_aliquot3_s1], downstream_tubes: [dest_tube3]) + end + + let(:source_well_b1) do + create(:v2_well, location: 'B1', aliquots: [source_aliquot1_s2], downstream_tubes: [dest_tube4]) + end + let(:source_well_b2) do + create(:v2_well, location: 'B2', aliquots: [source_aliquot2_s2], downstream_tubes: [dest_tube5]) + end + let(:source_well_b3) do + create(:v2_well, location: 'B3', aliquots: [source_aliquot3_s2], downstream_tubes: [dest_tube6]) + end + + # source plate + let(:source_labware) do + create( + :v2_plate, + wells: [source_well_a1, source_well_a2, source_well_a3, source_well_b1, source_well_b2, source_well_b3], + barcode_number: 3 + ) + end + + # destination aliquots + let(:dest_aliquot1) { create(:v2_aliquot, sample: sample1) } + let(:dest_aliquot2) { create(:v2_aliquot, sample: sample1) } + let(:dest_aliquot3) { create(:v2_aliquot, sample: sample1) } + let(:dest_aliquot4) { create(:v2_aliquot, sample: sample2) } + let(:dest_aliquot5) { create(:v2_aliquot, sample: sample2) } + let(:dest_aliquot6) { create(:v2_aliquot, sample: sample2) } + + # metadata for destination tubes + let(:dest_tube1_metadata) { { 'tube_rack_barcode' => 'TR00000001', 'tube_rack_position' => 'A1' } } + let(:dest_tube2_metadata) { { 'tube_rack_barcode' => 'TR00000002', 'tube_rack_position' => 'A1' } } + let(:dest_tube3_metadata) { { 'tube_rack_barcode' => 'TR00000002', 'tube_rack_position' => 'B1' } } + let(:dest_tube4_metadata) { { 'tube_rack_barcode' => 'TR00000001', 'tube_rack_position' => 'B1' } } + let(:dest_tube5_metadata) { { 'tube_rack_barcode' => 'TR00000002', 'tube_rack_position' => 'C1' } } + let(:dest_tube6_metadata) { { 'tube_rack_barcode' => 'TR00000002', 'tube_rack_position' => 'D1' } } + + # custom metadata collections for destination tubes + let(:dest_tube1_custom_metadata) { create(:custom_metadatum_collection, metadata: dest_tube1_metadata) } + let(:dest_tube2_custom_metadata) { create(:custom_metadatum_collection, metadata: dest_tube2_metadata) } + let(:dest_tube3_custom_metadata) { create(:custom_metadatum_collection, metadata: dest_tube3_metadata) } + let(:dest_tube4_custom_metadata) { create(:custom_metadatum_collection, metadata: dest_tube4_metadata) } + let(:dest_tube5_custom_metadata) { create(:custom_metadatum_collection, metadata: dest_tube5_metadata) } + let(:dest_tube6_custom_metadata) { create(:custom_metadatum_collection, metadata: dest_tube6_metadata) } + + # destination tube uuids + let(:dest_tube1_uuid) { SecureRandom.uuid } + let(:dest_tube2_uuid) { SecureRandom.uuid } + let(:dest_tube3_uuid) { SecureRandom.uuid } + let(:dest_tube4_uuid) { SecureRandom.uuid } + let(:dest_tube5_uuid) { SecureRandom.uuid } + let(:dest_tube6_uuid) { SecureRandom.uuid } + + # destination tubes + let(:dest_tube1) do + create( + :v2_tube_with_metadata, + uuid: dest_tube1_uuid, + barcode_prefix: 'FX', + barcode_number: 4, + aliquots: [dest_aliquot1], + name: 'SEQ:NT1O:A1', + custom_metadatum_collection: dest_tube1_custom_metadata + ) + end + let(:dest_tube2) do + create( + :v2_tube_with_metadata, + uuid: dest_tube2_uuid, + barcode_prefix: 'FX', + barcode_number: 5, + aliquots: [dest_aliquot2], + name: 'SPR:NT1O:A1', + custom_metadatum_collection: dest_tube2_custom_metadata + ) + end + let(:dest_tube3) do + create( + :v2_tube_with_metadata, + uuid: dest_tube3_uuid, + barcode_prefix: 'FX', + barcode_number: 6, + aliquots: [dest_aliquot3], + name: 'SPR:NT1O:B1', + custom_metadatum_collection: dest_tube3_custom_metadata + ) + end + let(:dest_tube4) do + create( + :v2_tube_with_metadata, + uuid: dest_tube4_uuid, + barcode_prefix: 'FX', + barcode_number: 7, + aliquots: [dest_aliquot4], + name: 'SEQ:NT2P:B1', + custom_metadatum_collection: dest_tube4_custom_metadata + ) + end + let(:dest_tube5) do + create( + :v2_tube_with_metadata, + uuid: dest_tube5_uuid, + barcode_prefix: 'FX', + barcode_number: 8, + aliquots: [dest_aliquot5], + name: 'SPR:NT2P:C1', + custom_metadatum_collection: dest_tube5_custom_metadata + ) + end + let(:dest_tube6) do + create( + :v2_tube_with_metadata, + uuid: dest_tube6_uuid, + barcode_prefix: 'FX', + barcode_number: 9, + aliquots: [dest_aliquot6], + name: 'SPR:NT2P:D1', + custom_metadatum_collection: dest_tube6_custom_metadata + ) + end + + # workflow + let(:workflow_name) { 'Test Workflow Name' } + + # expected file content + let(:expected_content) do + [ + ['Workflow', workflow_name], + [], + [ + 'Source Plate ID', + 'Source Plate Well', + 'Destination Rack', + 'Purpose', + 'Destination Tube ID', + 'Destination Tube Position', + 'Sample Vac Tube ID', + 'Sample Name' + ], + %w[DN3U A1 TR00000001 Sequencing FX4B A1 NT1O Sample1], + %w[DN3U B1 TR00000001 Sequencing FX7E B1 NT2P Sample2], + %w[DN3U A2 TR00000002 Contingency FX5C A1 NT1O Sample1], + %w[DN3U B2 TR00000002 Contingency FX8F C1 NT2P Sample2], + %w[DN3U A3 TR00000002 Contingency FX6D B1 NT1O Sample1], + %w[DN3U B3 TR00000002 Contingency FX9G D1 NT2P Sample2] + ] + end + + before do + assign(:ancestor_tubes, ancestor_tubes) + assign(:plate, source_labware) + assign(:workflow, workflow_name) + + # stub the v2 child tube lookups + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) + .with('custom_metadatum_collection', nil, barcode: dest_tube1.barcode.machine) + .and_return(dest_tube1) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) + .with('custom_metadatum_collection', nil, barcode: dest_tube2.barcode.machine) + .and_return(dest_tube2) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) + .with('custom_metadatum_collection', nil, barcode: dest_tube3.barcode.machine) + .and_return(dest_tube3) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) + .with('custom_metadatum_collection', nil, barcode: dest_tube4.barcode.machine) + .and_return(dest_tube4) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) + .with('custom_metadatum_collection', nil, barcode: dest_tube5.barcode.machine) + .and_return(dest_tube5) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) + .with('custom_metadatum_collection', nil, barcode: dest_tube6.barcode.machine) + .and_return(dest_tube6) + end + + it 'renders the expected content' do + expect(CSV.parse(render)).to eq(expected_content) + end + + context 'when transfers are not done yet' do + # source wells + let(:source_well_a1) { create(:v2_well, location: 'A1', aliquots: [source_aliquot1_s1], downstream_tubes: []) } + let(:source_well_a2) { create(:v2_well, location: 'A2', aliquots: [source_aliquot2_s1], downstream_tubes: []) } + let(:source_well_a3) { create(:v2_well, location: 'A3', aliquots: [source_aliquot3_s1], downstream_tubes: []) } + + let(:source_well_b1) { create(:v2_well, location: 'B1', aliquots: [source_aliquot1_s2], downstream_tubes: []) } + let(:source_well_b2) { create(:v2_well, location: 'B2', aliquots: [source_aliquot2_s2], downstream_tubes: []) } + let(:source_well_b3) { create(:v2_well, location: 'B3', aliquots: [source_aliquot3_s2], downstream_tubes: []) } + + let(:expected_content) do + [ + ['Workflow', workflow_name], + [], + [ + 'Source Plate ID', + 'Source Plate Well', + 'Destination Rack', + 'Purpose', + 'Destination Tube ID', + 'Destination Tube Position', + 'Sample Vac Tube ID', + 'Sample Name' + ] + ] + end + + it 'does not show sample rows' do + expect(CSV.parse(render)).to eq(expected_content) + end + end + + context 'when destination tubes have no custom metadatum collection' do + let(:dest_tube1) do + create( + :v2_tube, + uuid: dest_tube1_uuid, + barcode_prefix: 'FX', + barcode_number: 4, + aliquots: [dest_aliquot1], + name: 'SEQ:NT1O:A1', + custom_metadatum_collection: nil + ) + end + let(:dest_tube2) do + create( + :v2_tube, + uuid: dest_tube2_uuid, + barcode_prefix: 'FX', + barcode_number: 5, + aliquots: [dest_aliquot2], + name: 'SPR:NT1O:A1', + custom_metadatum_collection: nil + ) + end + let(:dest_tube3) do + create( + :v2_tube, + uuid: dest_tube3_uuid, + barcode_prefix: 'FX', + barcode_number: 6, + aliquots: [dest_aliquot3], + name: 'SPR:NT1O:B1', + custom_metadatum_collection: nil + ) + end + let(:dest_tube4) do + create( + :v2_tube, + uuid: dest_tube4_uuid, + barcode_prefix: 'FX', + barcode_number: 7, + aliquots: [dest_aliquot4], + name: 'SEQ:NT2P:B1', + custom_metadatum_collection: nil + ) + end + let(:dest_tube5) do + create( + :v2_tube, + uuid: dest_tube5_uuid, + barcode_prefix: 'FX', + barcode_number: 8, + aliquots: [dest_aliquot5], + name: 'SPR:NT2P:C1', + custom_metadatum_collection: nil + ) + end + let(:dest_tube6) do + create( + :v2_tube, + uuid: dest_tube6_uuid, + barcode_prefix: 'FX', + barcode_number: 9, + aliquots: [dest_aliquot6], + name: 'SPR:NT2P:D1', + custom_metadatum_collection: nil + ) + end + + let(:expected_content) do + [ + ['Workflow', workflow_name], + [], + [ + 'Source Plate ID', + 'Source Plate Well', + 'Destination Rack', + 'Purpose', + 'Destination Tube ID', + 'Destination Tube Position', + 'Sample Vac Tube ID', + 'Sample Name' + ] + ] + end + + it 'does not show sample rows' do + expect(CSV.parse(render)).to eq(expected_content) + end + end + + context 'when destination tubes have inappropriate metadata' do + let(:useless_custom_metadata) { create(:custom_metadatum_collection, metadata: { 'somekey' => 'somevalue' }) } + + let(:dest_tube1) do + create( + :v2_tube_with_metadata, + uuid: dest_tube1_uuid, + barcode_prefix: 'FX', + barcode_number: 4, + aliquots: [dest_aliquot1], + name: 'SEQ:NT1O:A1', + custom_metadatum_collection: useless_custom_metadata + ) + end + let(:dest_tube2) do + create( + :v2_tube_with_metadata, + uuid: dest_tube2_uuid, + barcode_prefix: 'FX', + barcode_number: 5, + aliquots: [dest_aliquot2], + name: 'SPR:NT1O:A1', + custom_metadatum_collection: useless_custom_metadata + ) + end + let(:dest_tube3) do + create( + :v2_tube_with_metadata, + uuid: dest_tube3_uuid, + barcode_prefix: 'FX', + barcode_number: 6, + aliquots: [dest_aliquot3], + name: 'SPR:NT1O:B1', + custom_metadatum_collection: useless_custom_metadata + ) + end + let(:dest_tube4) do + create( + :v2_tube_with_metadata, + uuid: dest_tube4_uuid, + barcode_prefix: 'FX', + barcode_number: 7, + aliquots: [dest_aliquot4], + name: 'SEQ:NT2P:B1', + custom_metadatum_collection: useless_custom_metadata + ) + end + let(:dest_tube5) do + create( + :v2_tube_with_metadata, + uuid: dest_tube5_uuid, + barcode_prefix: 'FX', + barcode_number: 8, + aliquots: [dest_aliquot5], + name: 'SPR:NT2P:C1', + custom_metadatum_collection: useless_custom_metadata + ) + end + let(:dest_tube6) do + create( + :v2_tube_with_metadata, + uuid: dest_tube6_uuid, + barcode_prefix: 'FX', + barcode_number: 9, + aliquots: [dest_aliquot6], + name: 'SPR:NT2P:D1', + custom_metadatum_collection: useless_custom_metadata + ) + end + + let(:expected_content) do + [ + ['Workflow', workflow_name], + [], + [ + 'Source Plate ID', + 'Source Plate Well', + 'Destination Rack', + 'Purpose', + 'Destination Tube ID', + 'Destination Tube Position', + 'Sample Vac Tube ID', + 'Sample Name' + ] + ] + end + + it 'does not show sample rows' do + expect(CSV.parse(render)).to eq(expected_content) + end + end + end +end From b104b1bb02b37111d8e0f1d11176e7009121484c Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Oct 2023 18:18:55 +0100 Subject: [PATCH 06/43] fix: update values --- app/sequencescape/sequencescape/api/v2/well.rb | 4 ++++ .../pbmc_bank_tubes_content_report.csv.erb | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/sequencescape/sequencescape/api/v2/well.rb b/app/sequencescape/sequencescape/api/v2/well.rb index 3b42f4771..5b5a8b047 100644 --- a/app/sequencescape/sequencescape/api/v2/well.rb +++ b/app/sequencescape/sequencescape/api/v2/well.rb @@ -35,6 +35,10 @@ def latest_live_cell_count latest_qc(key: 'live_cell_count', units: 'cells/ml') end + def latest_cell_viability + latest_qc(key: 'viability', units: '%') + end + def latest_qc(key:, units:) qc_results.to_a # Convert to array to resolve any api queries. Otherwise select fails to work. .select { |qc| qc.key.casecmp(key).zero? } diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 8cee58143..597c1a849 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -8,6 +8,7 @@ <%= CSV.generate_line [ 'Well name', +'Well position', 'Donor ID', 'Parent barcode', 'FluidX barcode', @@ -81,25 +82,24 @@ # ggg source_well.aliquots.first.sample.component_samples.first ggg source_well.aliquots.first.sample.sample_metadata ggg source_well.downstream_tubes - ggg source_well.qc_results.first - ggg source_well.transfer_requests_as_target.first - ggg source_well.upstream_tubes.first + ggg source_well.qc_results + ggg source_well.transfer_requests_as_target + ggg source_well.upstream_tubes - # if destination_tube_name_array.length == 3 rows_array << [ source_well.name, # Well name ✅ - source_well.aliquots.first.sample.sample_metadata&.donor_id, # Donor ID ✅ - @ancestor_tubes.last.labware_barcode, # Parent barcode - @ancestor_tubes.first.labware_barcode, # FluidX barcode + source_well_posn, # Well position + source_well.aliquots.first.sample.sample_metadata.respond_to?(:donor_id) ? source_well.aliquots.first.sample.sample_metadata.donor_id : nil, # Donor ID ✅ + @ancestor_tubes.values.last.labware_barcode, # Parent barcode + @ancestor_tubes.values.first.labware_barcode, # FluidX barcode tube_rack_barcode, # Extraction and freeze date purpose, # Sequencing or contingency ✅ source_well.latest_live_cell_count, # Cell count ✅ source_well.latest_cell_viability, # Viability ✅ # TODO: check '135 µL', # Volume # ✅ TODO: units - source_well.aliquots.first.sample.name, # Study name + @plate.labware_barcode, # Study name source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site ✅ ] - # end end %> <% rows_array.sort_by{ |a| WellHelpers.well_coordinate(a[1]) }.each do |row| %> From 887a488392fcfb5a76bfbe9683ba05a3485f6258 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Oct 2023 08:46:58 +0100 Subject: [PATCH 07/43] fix: remove duplicate well position --- app/views/exports/pbmc_bank_tubes_content_report.csv.erb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 597c1a849..26ae55093 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -8,7 +8,6 @@ <%= CSV.generate_line [ 'Well name', -'Well position', 'Donor ID', 'Parent barcode', 'FluidX barcode', @@ -62,6 +61,7 @@ # e.g. SEQ:DESTTUBE:A1 purpose = ((destination_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') + volume = source_well.sequencing_tube_volume if purpose == 'Sequencing' else source_well.contingency_tube_volume require 'inspector' @@ -88,7 +88,6 @@ rows_array << [ source_well.name, # Well name ✅ - source_well_posn, # Well position source_well.aliquots.first.sample.sample_metadata.respond_to?(:donor_id) ? source_well.aliquots.first.sample.sample_metadata.donor_id : nil, # Donor ID ✅ @ancestor_tubes.values.last.labware_barcode, # Parent barcode @ancestor_tubes.values.first.labware_barcode, # FluidX barcode @@ -96,12 +95,12 @@ purpose, # Sequencing or contingency ✅ source_well.latest_live_cell_count, # Cell count ✅ source_well.latest_cell_viability, # Viability ✅ # TODO: check - '135 µL', # Volume # ✅ TODO: units - @plate.labware_barcode, # Study name + volume, # Volume # ✅ TODO: units + source_well.aliquots.first.study, # Study name source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site ✅ ] end %> -<% rows_array.sort_by{ |a| WellHelpers.well_coordinate(a[1]) }.each do |row| %> +<% rows_array.sort_by{ |a| WellHelpers.well_coordinate(a[0]) }.each do |row| %> <%= CSV.generate_line row, row_sep: "" %> <% end %> From d120b616fcbfda4b7fbf421e217e397872d63330 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Oct 2023 09:01:12 +0100 Subject: [PATCH 08/43] fix: tidy up code --- app/views/exports/pbmc_bank_tubes_content_report.csv.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 26ae55093..79c38b86b 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -60,8 +60,10 @@ destination_tube_name_array = destination_tube_v2.name.split(':') # e.g. SEQ:DESTTUBE:A1 + sample_metadata = source_well.aliquots.first.sample.sample_metadata + donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil purpose = ((destination_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') - volume = source_well.sequencing_tube_volume if purpose == 'Sequencing' else source_well.contingency_tube_volume + volume = source_well.sequencing_tube_volume ? purpose == 'Sequencing' : source_well.contingency_tube_volume require 'inspector' @@ -88,7 +90,7 @@ rows_array << [ source_well.name, # Well name ✅ - source_well.aliquots.first.sample.sample_metadata.respond_to?(:donor_id) ? source_well.aliquots.first.sample.sample_metadata.donor_id : nil, # Donor ID ✅ + donor_id, # Donor ID ✅ @ancestor_tubes.values.last.labware_barcode, # Parent barcode @ancestor_tubes.values.first.labware_barcode, # FluidX barcode tube_rack_barcode, # Extraction and freeze date From 35e2caaa6b5219ff85391926555f1d1fb429bf8b Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Oct 2023 14:18:43 +0100 Subject: [PATCH 09/43] style: lint --- .../pbmc_bank_tubes_content_report.csv.erb | 92 ++++++++++--------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 79c38b86b..40b8c48e4 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -1,25 +1,21 @@ -<%# This is a report of the contents of the tubes in the PBMC Bank plate %> -<%= CSV.generate_line [ - 'Workflow', - @workflow - ], - row_sep: "" -%> - -<%= CSV.generate_line [ -'Well name', -'Donor ID', -'Parent barcode', -'FluidX barcode', -'Extraction and freeze date', -'Sequencing or contingency', -'Cell count', -'Viability', -'Volume', -'Study name', -'Collection site', - ], - row_sep: "" +<%# This is a report of the contents of the tubes in the PBMC Bank plate %> +<%= CSV.generate_line ['Workflow', @workflow], row_sep: '' %> + +<%= + CSV.generate_line [ + 'Well name', + 'Donor ID', + 'Parent barcode', + 'FluidX barcode', + 'Extraction and freeze date', + 'Sequencing or contingency', + 'Cell count', + 'Viability', + 'Volume', + 'Study name', + 'Collection site' + ], + row_sep: '' %> <% rows_array = [] @@ -35,13 +31,16 @@ # expecting 1 sample tube destination_tube = source_well.downstream_tubes.first - destination_tube_v2 = Sequencescape::Api::V2.tube_with_custom_includes( - 'custom_metadatum_collection', - nil, - barcode: destination_tube.labware_barcode.machine - ) + destination_tube_v2 = + Sequencescape::Api::V2.tube_with_custom_includes( + 'custom_metadatum_collection', + nil, + barcode: destination_tube.labware_barcode.machine + ) - next unless destination_tube_v2 && destination_tube_v2.custom_metadatum_collection + unless destination_tube_v2 && destination_tube_v2.custom_metadatum_collection + next + end # get tube metadata from destination tube metadata = destination_tube_v2.custom_metadatum_collection.metadata @@ -58,17 +57,25 @@ source_well_posn = source_well.position['name'] destination_tube_name_array = destination_tube_v2.name.split(':') + # e.g. SEQ:DESTTUBE:A1 sample_metadata = source_well.aliquots.first.sample.sample_metadata - donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil - purpose = ((destination_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') - volume = source_well.sequencing_tube_volume ? purpose == 'Sequencing' : source_well.contingency_tube_volume + donor_id = + sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil + purpose = + ((destination_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') + volume = + if source_well.sequencing_tube_volume + purpose == 'Sequencing' + else + source_well.contingency_tube_volume + end require 'inspector' # print out all available data - puts "----------------------------------------" + puts '----------------------------------------' ggg @plate ggg @plate_with_qc_results ggg @ancestor_tubes @@ -81,6 +88,7 @@ ggg source_well.aliquots ggg source_well.aliquots.first.sample + # ggg source_well.aliquots.first.sample.component_samples.first ggg source_well.aliquots.first.sample.sample_metadata ggg source_well.downstream_tubes @@ -89,20 +97,20 @@ ggg source_well.upstream_tubes rows_array << [ - source_well.name, # Well name ✅ - donor_id, # Donor ID ✅ - @ancestor_tubes.values.last.labware_barcode, # Parent barcode + source_well.name, # Well name ✅ + donor_id, # Donor ID ✅ + @ancestor_tubes.values.last.labware_barcode, # Parent barcode @ancestor_tubes.values.first.labware_barcode, # FluidX barcode - tube_rack_barcode, # Extraction and freeze date - purpose, # Sequencing or contingency ✅ - source_well.latest_live_cell_count, # Cell count ✅ - source_well.latest_cell_viability, # Viability ✅ # TODO: check + tube_rack_barcode, # Extraction and freeze date + purpose, # Sequencing or contingency ✅ + source_well.latest_live_cell_count, # Cell count ✅ + source_well.latest_cell_viability, # Viability ✅ # TODO: check volume, # Volume # ✅ TODO: units - source_well.aliquots.first.study, # Study name - source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site ✅ + source_well.aliquots.first.study, # Study name + source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site ✅ ] end %> <% rows_array.sort_by{ |a| WellHelpers.well_coordinate(a[0]) }.each do |row| %> -<%= CSV.generate_line row, row_sep: "" %> +<%= CSV.generate_line row, row_sep: '' %> <% end %> From 487c631b7723ea90e2406c1d1ddbc1e89bb34f73 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Oct 2023 11:49:02 +0100 Subject: [PATCH 10/43] fix: update values --- .../exports/pbmc_bank_tubes_content_report.csv.erb | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 40b8c48e4..ed09b0693 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -65,12 +65,7 @@ sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil purpose = ((destination_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') - volume = - if source_well.sequencing_tube_volume - purpose == 'Sequencing' - else - source_well.contingency_tube_volume - end + volume = 135 require 'inspector' @@ -103,10 +98,10 @@ @ancestor_tubes.values.first.labware_barcode, # FluidX barcode tube_rack_barcode, # Extraction and freeze date purpose, # Sequencing or contingency ✅ - source_well.latest_live_cell_count, # Cell count ✅ - source_well.latest_cell_viability, # Viability ✅ # TODO: check + source_well.latest_live_cell_count.value, # Cell count ✅ + source_well.latest_cell_viability.value, # Viability ✅ # TODO: check volume, # Volume # ✅ TODO: units - source_well.aliquots.first.study, # Study name + source_well.aliquots.first.study.name, # Study name ✅ source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site ✅ ] end From 5ec5451227ddb3c605038bac3806a97c0e341f28 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Oct 2023 11:50:58 +0100 Subject: [PATCH 11/43] fix: remove debug code and lint --- .../pbmc_bank_tubes_content_report.csv.erb | 38 ++----------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index ed09b0693..9685f9923 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -38,9 +38,7 @@ barcode: destination_tube.labware_barcode.machine ) - unless destination_tube_v2 && destination_tube_v2.custom_metadatum_collection - next - end + next unless destination_tube_v2 && destination_tube_v2.custom_metadatum_collection # get tube metadata from destination tube metadata = destination_tube_v2.custom_metadatum_collection.metadata @@ -53,44 +51,16 @@ next unless tube_rack_barcode && tube_rack_position sample_uuid = source_well.aliquots.first.sample.uuid - source_well_posn = source_well.position['name'] - destination_tube_name_array = destination_tube_v2.name.split(':') - # e.g. SEQ:DESTTUBE:A1 + destination_tube_name_array = destination_tube_v2.name.split(':') sample_metadata = source_well.aliquots.first.sample.sample_metadata - donor_id = - sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil - purpose = - ((destination_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') + donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil + purpose = ((destination_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') volume = 135 - require 'inspector' - - # print out all available data - puts '----------------------------------------' - ggg @plate - ggg @plate_with_qc_results - ggg @ancestor_tubes - ggg destination_tube - ggg destination_tube_v2 - ggg purpose - ggg metadata - - ggg source_well - - ggg source_well.aliquots - ggg source_well.aliquots.first.sample - - # ggg source_well.aliquots.first.sample.component_samples.first - ggg source_well.aliquots.first.sample.sample_metadata - ggg source_well.downstream_tubes - ggg source_well.qc_results - ggg source_well.transfer_requests_as_target - ggg source_well.upstream_tubes - rows_array << [ source_well.name, # Well name ✅ donor_id, # Donor ID ✅ From b1eee3802098fcee164447e93d3840b00d6fcb75 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Oct 2023 11:42:51 +0100 Subject: [PATCH 12/43] fix: update report with units and additional notes - includes some styling changes --- .../pbmc_bank_tubes_content_report.csv.erb | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 9685f9923..d41db7190 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -1,4 +1,6 @@ <%# This is a report of the contents of the tubes in the PBMC Bank plate %> +<%# Based on app/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb %> + <%= CSV.generate_line ['Workflow', @workflow], row_sep: '' %> <%= @@ -9,9 +11,9 @@ 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', - 'Cell count', - 'Viability', - 'Volume', + 'Cell count (cells/ml)', + 'Viability (%)', + 'Volume (µl)', 'Study name', 'Collection site' ], @@ -29,8 +31,11 @@ # skip if no downstream tubes for this well (not set up children in Limber yet) next if source_well.downstream_tubes.empty? - # expecting 1 sample tube - destination_tube = source_well.downstream_tubes.first + # expecting ? sample tube + # TODO: check for states and get the last tube + # TODO: check what downstream_tubes does + # Check for ascendence method to get specific purpose + destination_tube = source_well.downstream_tubes.last destination_tube_v2 = Sequencescape::Api::V2.tube_with_custom_includes( 'custom_metadatum_collection', @@ -40,7 +45,7 @@ next unless destination_tube_v2 && destination_tube_v2.custom_metadatum_collection - # get tube metadata from destination tube + # get tube metadata from destination_tube metadata = destination_tube_v2.custom_metadatum_collection.metadata next unless metadata @@ -63,13 +68,13 @@ rows_array << [ source_well.name, # Well name ✅ - donor_id, # Donor ID ✅ - @ancestor_tubes.values.last.labware_barcode, # Parent barcode - @ancestor_tubes.values.first.labware_barcode, # FluidX barcode - tube_rack_barcode, # Extraction and freeze date + donor_id, # Donor ID ✅ # Deep behind sample manifest UAT action on the SS side + @ancestor_tubes.values.last.labware_barcode, # Vacutainer/stock barcode (lrc blood vac purpose) + @ancestor_tubes.values.first.labware_barcode, # FluidX barcode (child tube barcode) + 'extraction-date', # Extraction and freeze date (created-at for child/dest tube) purpose, # Sequencing or contingency ✅ source_well.latest_live_cell_count.value, # Cell count ✅ - source_well.latest_cell_viability.value, # Viability ✅ # TODO: check + source_well.latest_cell_viability.value, # Viability ✅ volume, # Volume # ✅ TODO: units source_well.aliquots.first.study.name, # Study name ✅ source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site ✅ From afc431c6eacc7f4fdf2390710c8b163e9679ef2a Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Oct 2023 11:53:49 +0100 Subject: [PATCH 13/43] refactor: rename destination_tube -> child_tube --- .../pbmc_bank_tubes_content_report.csv.erb | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index d41db7190..ccb77fb2d 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -35,18 +35,18 @@ # TODO: check for states and get the last tube # TODO: check what downstream_tubes does # Check for ascendence method to get specific purpose - destination_tube = source_well.downstream_tubes.last - destination_tube_v2 = + child_tube = source_well.downstream_tubes.last + child_tube_v2 = Sequencescape::Api::V2.tube_with_custom_includes( 'custom_metadatum_collection', nil, - barcode: destination_tube.labware_barcode.machine + barcode: child_tube.labware_barcode.machine ) - next unless destination_tube_v2 && destination_tube_v2.custom_metadatum_collection + next unless child_tube_v2 && child_tube_v2.custom_metadatum_collection - # get tube metadata from destination_tube - metadata = destination_tube_v2.custom_metadatum_collection.metadata + # get tube metadata from child_tube + metadata = child_tube_v2.custom_metadatum_collection.metadata next unless metadata @@ -58,12 +58,12 @@ sample_uuid = source_well.aliquots.first.sample.uuid source_well_posn = source_well.position['name'] - # e.g. SEQ:DESTTUBE:A1 - destination_tube_name_array = destination_tube_v2.name.split(':') + # e.g. SEQ:CHILD_TUBE:A1 + child_tube_name_array = child_tube_v2.name.split(':') sample_metadata = source_well.aliquots.first.sample.sample_metadata donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil - purpose = ((destination_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') + purpose = ((child_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') volume = 135 rows_array << [ @@ -71,7 +71,7 @@ donor_id, # Donor ID ✅ # Deep behind sample manifest UAT action on the SS side @ancestor_tubes.values.last.labware_barcode, # Vacutainer/stock barcode (lrc blood vac purpose) @ancestor_tubes.values.first.labware_barcode, # FluidX barcode (child tube barcode) - 'extraction-date', # Extraction and freeze date (created-at for child/dest tube) + 'extraction-date', # Extraction and freeze date (created-at for child tube) purpose, # Sequencing or contingency ✅ source_well.latest_live_cell_count.value, # Cell count ✅ source_well.latest_cell_viability.value, # Viability ✅ From 3adb415cd0c88843332f304c985697200f88dd16 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 08:45:25 +0000 Subject: [PATCH 14/43] Update rails to version 7.0.7.2 --- Gemfile.lock | 164 ++++++++++++++++++++++++++------------------------- 1 file changed, 85 insertions(+), 79 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 10656c5f2..5171f5da8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -28,67 +28,67 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + actioncable (7.0.7.2) + actionpack (= 7.0.7.2) + activesupport (= 7.0.7.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4) - actionpack (= 7.0.4) - activejob (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + actionmailbox (7.0.7.2) + actionpack (= 7.0.7.2) + activejob (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4) - actionpack (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activesupport (= 7.0.4) + actionmailer (7.0.7.2) + actionpack (= 7.0.7.2) + actionview (= 7.0.7.2) + activejob (= 7.0.7.2) + activesupport (= 7.0.7.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4) - actionview (= 7.0.4) - activesupport (= 7.0.4) - rack (~> 2.0, >= 2.2.0) + actionpack (7.0.7.2) + actionview (= 7.0.7.2) + activesupport (= 7.0.7.2) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4) - actionpack (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + actiontext (7.0.7.2) + actionpack (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4) - activesupport (= 7.0.4) + actionview (7.0.7.2) + activesupport (= 7.0.7.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4) - activesupport (= 7.0.4) + activejob (7.0.7.2) + activesupport (= 7.0.7.2) globalid (>= 0.3.6) - activemodel (7.0.4) - activesupport (= 7.0.4) - activerecord (7.0.4) - activemodel (= 7.0.4) - activesupport (= 7.0.4) - activestorage (7.0.4) - actionpack (= 7.0.4) - activejob (= 7.0.4) - activerecord (= 7.0.4) - activesupport (= 7.0.4) + activemodel (7.0.7.2) + activesupport (= 7.0.7.2) + activerecord (7.0.7.2) + activemodel (= 7.0.7.2) + activesupport (= 7.0.7.2) + activestorage (7.0.7.2) + actionpack (= 7.0.7.2) + activejob (= 7.0.7.2) + activerecord (= 7.0.7.2) + activesupport (= 7.0.7.2) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4) + activesupport (7.0.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -125,6 +125,7 @@ GEM crack (0.4.5) rexml crass (1.0.6) + date (3.3.3) diff-lcs (1.5.0) docile (1.4.0) erubi (1.12.0) @@ -161,8 +162,8 @@ GEM faraday (~> 1.0) ffi (1.15.5) formatador (1.1.0) - globalid (1.0.1) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) guard (2.18.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) @@ -179,7 +180,7 @@ GEM rspec (>= 2.99.0, < 4.0) hashdiff (1.0.1) hashie (5.0.0) - i18n (1.13.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) inline_svg (1.8.0) activesupport (>= 3.0) @@ -197,33 +198,36 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.21.3) + loofah (2.21.4) crass (~> 1.0.2) nokogiri (>= 1.12.0) lumberjack (1.2.8) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) - mini_mime (1.1.2) - mini_portile2 (2.8.2) - minitest (5.18.0) + mini_mime (1.1.5) + mini_portile2 (2.8.5) + minitest (5.20.0) msgpack (1.5.1) multi_json (1.15.0) multipart-post (2.2.3) nenv (0.3.0) - net-imap (0.3.1) + net-imap (0.4.2) + date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.1.3) + net-protocol (0.2.1) timeout - net-smtp (0.3.3) + net-smtp (0.4.0) net-protocol - timeout nio4r (2.5.9) - nokogiri (1.15.2) + nokogiri (1.15.4) mini_portile2 (~> 2.8.2) racc (~> 1.4) notiffany (0.1.3) @@ -244,40 +248,42 @@ GEM public_suffix (5.0.0) puma (6.0.0) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.4) + racc (1.7.1) + rack (2.2.8) rack-mini-profiler (3.0.0) rack (>= 1.2.0) rack-proxy (0.7.4) rack - rack-test (2.0.2) + rack-test (2.1.0) rack (>= 1.3) - rails (7.0.4) - actioncable (= 7.0.4) - actionmailbox (= 7.0.4) - actionmailer (= 7.0.4) - actionpack (= 7.0.4) - actiontext (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activemodel (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + rails (7.0.7.2) + actioncable (= 7.0.7.2) + actionmailbox (= 7.0.7.2) + actionmailer (= 7.0.7.2) + actionpack (= 7.0.7.2) + actiontext (= 7.0.7.2) + actionview (= 7.0.7.2) + activejob (= 7.0.7.2) + activemodel (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) bundler (>= 1.15.0) - railties (= 7.0.4) + railties (= 7.0.7.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) - railties (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.0.7.2) + actionpack (= 7.0.7.2) + activesupport (= 7.0.7.2) method_source rake (>= 12.2) thor (~> 1.0) @@ -373,10 +379,10 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) state_machines (0.5.0) - thor (1.2.1) + thor (1.3.0) tilt (2.0.11) - timeout (0.3.0) - tzinfo (2.0.5) + timeout (0.4.0) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) @@ -397,14 +403,14 @@ GEM semantic_range (>= 2.3.0) webrick (1.7.0) websocket (1.2.9) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.28) webrick (~> 1.7.0) - zeitwerk (2.6.8) + zeitwerk (2.6.12) PLATFORMS ruby From 2dc9a9eb0e2f5a435a95b89ba21d60a14e72d12c Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Oct 2023 17:39:17 +0100 Subject: [PATCH 15/43] tests: add test for well-aliquot-study fixture --- spec/factory_outputs/well_factory_spec.rb | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/spec/factory_outputs/well_factory_spec.rb b/spec/factory_outputs/well_factory_spec.rb index ae5660ef3..7b9919bdc 100644 --- a/spec/factory_outputs/well_factory_spec.rb +++ b/spec/factory_outputs/well_factory_spec.rb @@ -125,3 +125,44 @@ expect(JSON.parse(subject)).to include_json(JSON.parse(json_content)) end end + +RSpec.describe 'v2_well' do + subject { create(:v2_well, location: 'A1', aliquots: [source_aliquot1_s1]) } + + # samples + let(:sample1_uuid) { SecureRandom.uuid } + let(:sample1) { create(:v2_sample, name: 'Sample1', uuid: sample1_uuid) } + + # source aliquots + let(:source_aliquot1_s1) { create(:v2_aliquot, sample: sample1) } + + describe 'first aliquot' do + let(:first_well_aliquot) { subject.aliquots.first } + it 'should be a version 2 aliquot' do + expect(first_well_aliquot.class).to eq(Sequencescape::Api::V2::Aliquot) + end + it 'should have a valid study' do + expect(first_well_aliquot.study).to be_kind_of(Sequencescape::Api::V2::Study) + end + + it 'should have a valid study type' do + expect(first_well_aliquot.study.type).to eq('studies') + end + it 'should have a valid study id' do + expect(first_well_aliquot.study.id).to be_kind_of(String) + expect(first_well_aliquot.study.id).to match(/\d+/) + end + it 'should have a valid study uuid' do + expect(first_well_aliquot.study.uuid).to be_kind_of(String) + expect(first_well_aliquot.study.uuid).to match(/\A\h{8}-\h{4}-\h{4}-\h{4}-\h{12}\z/) + end + it 'should have a valid study name' do + expect(first_well_aliquot.study.name).to eq('Test Aliquot Study') + end + + it 'should not have weird shadow attributes' do + expect(first_well_aliquot.attributes).to_not include('study') + expect(first_well_aliquot['study']).to be_nil + end + end +end From 4c54790bec491806be5cad3d8ba5c9c437a37b81 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Oct 2023 11:55:36 +0100 Subject: [PATCH 16/43] fix: remove existing study reference --- spec/factories/study_factories.rb | 2 ++ spec/factories/well_factories.rb | 12 +----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/spec/factories/study_factories.rb b/spec/factories/study_factories.rb index ef58735f2..cfb766772 100644 --- a/spec/factories/study_factories.rb +++ b/spec/factories/study_factories.rb @@ -5,6 +5,8 @@ factory :v2_study, class: Sequencescape::Api::V2::Study do skip_create + id + name { 'Test Study' } uuid { SecureRandom.uuid } diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 0fe7fc6c8..15d0e0f15 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -256,7 +256,7 @@ # Alias for request: The request set on the aliquot itself outer_request { create :library_request, state: library_state } well_location { 'A1' } - study_id { 1 } + study { create :v2_study, name: 'Test Aliquot Study' } project_id { 1 } sample_attributes { {} } end @@ -273,16 +273,6 @@ after(:build) do |aliquot, evaluator| aliquot._cached_relationship(:request) { evaluator.request } aliquot._cached_relationship(:sample) { evaluator.sample } - aliquot.relationships.study = { - 'links' => { - 'self' => "http://localhost:3000/api/v2/aliquots/#{aliquot.id}/relationships/study", - 'related' => "http://localhost:3000/api/v2/aliquots/#{aliquot.id}/study" - }, - 'data' => { - 'type' => 'studies', - 'id' => evaluator.study_id.to_s - } - } aliquot.relationships.project = { 'links' => { 'self' => "http://localhost:3000/api/v2/aliquots/#{aliquot.id}/relationships/project", From 2f32679b7bdf6a84067e6c782ad517de16c66e1d Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 23 Oct 2023 14:24:36 +0100 Subject: [PATCH 17/43] fix: remove existing project reference --- spec/factories/project_factories.rb | 2 ++ spec/factories/well_factories.rb | 12 +----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/spec/factories/project_factories.rb b/spec/factories/project_factories.rb index 94a75874e..b1dc1e291 100644 --- a/spec/factories/project_factories.rb +++ b/spec/factories/project_factories.rb @@ -5,6 +5,8 @@ factory :v2_project, class: Sequencescape::Api::V2::Project do skip_create + id + name { 'Test Project' } uuid { SecureRandom.uuid } diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 15d0e0f15..fa7cdda10 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -257,7 +257,7 @@ outer_request { create :library_request, state: library_state } well_location { 'A1' } study { create :v2_study, name: 'Test Aliquot Study' } - project_id { 1 } + project { create :v2_project, name: 'Test Aliquot Project' } sample_attributes { {} } end @@ -273,16 +273,6 @@ after(:build) do |aliquot, evaluator| aliquot._cached_relationship(:request) { evaluator.request } aliquot._cached_relationship(:sample) { evaluator.sample } - aliquot.relationships.project = { - 'links' => { - 'self' => "http://localhost:3000/api/v2/aliquots/#{aliquot.id}/relationships/project", - 'related' => "http://localhost:3000/api/v2/aliquots/#{aliquot.id}/project" - }, - 'data' => { - 'type' => 'projects', - 'id' => evaluator.project_id.to_s - } - } end factory :v2_tagged_aliquot do From 623ee0f697d7f4070d0b6044cf77dc3b6fe1b693 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 23 Oct 2023 12:18:19 +0100 Subject: [PATCH 18/43] fix: re-establish relationships --- spec/factories/well_factories.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index fa7cdda10..f81fbbb9d 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -271,8 +271,10 @@ request { outer_request } after(:build) do |aliquot, evaluator| - aliquot._cached_relationship(:request) { evaluator.request } - aliquot._cached_relationship(:sample) { evaluator.sample } + # Set up relationships downstream + Sequencescape::Api::V2::Aliquot.associations.each do |association| + aliquot._cached_relationship(association.attr_name) { evaluator.send(association.attr_name) } + end end factory :v2_tagged_aliquot do From 4107296baa3ea052f36868b15a218608b5c8ff15 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 23 Oct 2023 14:36:57 +0100 Subject: [PATCH 19/43] tests: add tests for well-aliquot relationships --- spec/factory_outputs/well_factory_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/factory_outputs/well_factory_spec.rb b/spec/factory_outputs/well_factory_spec.rb index 7b9919bdc..87ba95703 100644 --- a/spec/factory_outputs/well_factory_spec.rb +++ b/spec/factory_outputs/well_factory_spec.rb @@ -164,5 +164,17 @@ expect(first_well_aliquot.attributes).to_not include('study') expect(first_well_aliquot['study']).to be_nil end + + it 'should have relationships' do + expect(first_well_aliquot.relationships).to be_kind_of(JsonApiClient::Relationships::Relations) + end + + it 'should have a valid study relationship' do + expect(first_well_aliquot.relationships.study).to be_kind_of(Hash) + end + + it 'should have valid study relationship data' do + expect(first_well_aliquot.relationships.study['data']).to be_kind_of(Hash) + end end end From 66484c12487eb7007e92fe5b7c07d2291b763065 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 23 Oct 2023 14:42:01 +0100 Subject: [PATCH 20/43] fix: restore relationships --- spec/factories/well_factories.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index f81fbbb9d..f2bb0f94d 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -275,6 +275,27 @@ Sequencescape::Api::V2::Aliquot.associations.each do |association| aliquot._cached_relationship(association.attr_name) { evaluator.send(association.attr_name) } end + + aliquot.relationships.study = { + 'links' => { + 'self' => "http://localhost:3000/api/v2/aliquots/#{aliquot.id}/relationships/study", + 'related' => "http://localhost:3000/api/v2/aliquots/#{aliquot.id}/study" + }, + 'data' => { + 'type' => 'studies', + 'id' => evaluator.study.id.to_s + } + } + aliquot.relationships.project = { + 'links' => { + 'self' => "http://localhost:3000/api/v2/aliquots/#{aliquot.id}/relationships/project", + 'related' => "http://localhost:3000/api/v2/aliquots/#{aliquot.id}/project" + }, + 'data' => { + 'type' => 'projects', + 'id' => evaluator.project.id.to_s + } + } end factory :v2_tagged_aliquot do From f3047dfef43b210c70c1b62df0c2211531b3f5fa Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 23 Oct 2023 16:52:12 +0100 Subject: [PATCH 21/43] tests: add test for order_group --- spec/factory_outputs/well_factory_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/factory_outputs/well_factory_spec.rb b/spec/factory_outputs/well_factory_spec.rb index 87ba95703..394b9cb3c 100644 --- a/spec/factory_outputs/well_factory_spec.rb +++ b/spec/factory_outputs/well_factory_spec.rb @@ -138,6 +138,10 @@ describe 'first aliquot' do let(:first_well_aliquot) { subject.aliquots.first } + + let(:study_id) { first_well_aliquot.relationships.study.dig(:data, :id) } + let(:project_id) { first_well_aliquot.relationships.project.dig(:data, :id) } + it 'should be a version 2 aliquot' do expect(first_well_aliquot.class).to eq(Sequencescape::Api::V2::Aliquot) end @@ -176,5 +180,9 @@ it 'should have valid study relationship data' do expect(first_well_aliquot.relationships.study['data']).to be_kind_of(Hash) end + + it 'should order groups' do + expect(first_well_aliquot.order_group).to eq([study_id, project_id]) + end end end From be1573be8b3e63a186543992459b98a272a514cf Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 23 Oct 2023 17:22:21 +0100 Subject: [PATCH 22/43] tests: add tests to specify study and project --- spec/factory_outputs/well_factory_spec.rb | 158 ++++++++++++++-------- 1 file changed, 105 insertions(+), 53 deletions(-) diff --git a/spec/factory_outputs/well_factory_spec.rb b/spec/factory_outputs/well_factory_spec.rb index 394b9cb3c..1f80e8e7d 100644 --- a/spec/factory_outputs/well_factory_spec.rb +++ b/spec/factory_outputs/well_factory_spec.rb @@ -127,62 +127,114 @@ end RSpec.describe 'v2_well' do - subject { create(:v2_well, location: 'A1', aliquots: [source_aliquot1_s1]) } - # samples - let(:sample1_uuid) { SecureRandom.uuid } - let(:sample1) { create(:v2_sample, name: 'Sample1', uuid: sample1_uuid) } - - # source aliquots - let(:source_aliquot1_s1) { create(:v2_aliquot, sample: sample1) } - - describe 'first aliquot' do - let(:first_well_aliquot) { subject.aliquots.first } - - let(:study_id) { first_well_aliquot.relationships.study.dig(:data, :id) } - let(:project_id) { first_well_aliquot.relationships.project.dig(:data, :id) } - - it 'should be a version 2 aliquot' do - expect(first_well_aliquot.class).to eq(Sequencescape::Api::V2::Aliquot) - end - it 'should have a valid study' do - expect(first_well_aliquot.study).to be_kind_of(Sequencescape::Api::V2::Study) - end - - it 'should have a valid study type' do - expect(first_well_aliquot.study.type).to eq('studies') - end - it 'should have a valid study id' do - expect(first_well_aliquot.study.id).to be_kind_of(String) - expect(first_well_aliquot.study.id).to match(/\d+/) - end - it 'should have a valid study uuid' do - expect(first_well_aliquot.study.uuid).to be_kind_of(String) - expect(first_well_aliquot.study.uuid).to match(/\A\h{8}-\h{4}-\h{4}-\h{4}-\h{12}\z/) - end - it 'should have a valid study name' do - expect(first_well_aliquot.study.name).to eq('Test Aliquot Study') - end - - it 'should not have weird shadow attributes' do - expect(first_well_aliquot.attributes).to_not include('study') - expect(first_well_aliquot['study']).to be_nil - end - - it 'should have relationships' do - expect(first_well_aliquot.relationships).to be_kind_of(JsonApiClient::Relationships::Relations) - end - - it 'should have a valid study relationship' do - expect(first_well_aliquot.relationships.study).to be_kind_of(Hash) - end - - it 'should have valid study relationship data' do - expect(first_well_aliquot.relationships.study['data']).to be_kind_of(Hash) + let(:sample) { create(:v2_sample) } + + context 'with default study' do + subject { create(:v2_well, location: 'A1', aliquots: [source_aliquot]) } + + # source aliquots + let(:source_aliquot) { create(:v2_aliquot, sample: sample) } + + describe 'first aliquot' do + let(:first_well_aliquot) { subject.aliquots.first } + + let(:study_id) { first_well_aliquot.relationships.study.dig(:data, :id) } + let(:project_id) { first_well_aliquot.relationships.project.dig(:data, :id) } + + it 'should be a version 2 aliquot' do + expect(first_well_aliquot.class).to eq(Sequencescape::Api::V2::Aliquot) + end + it 'should have a valid sample' do + expect(first_well_aliquot.sample).to be_kind_of(Sequencescape::Api::V2::Sample) + end + it 'should have a valid study' do + expect(first_well_aliquot.study).to be_kind_of(Sequencescape::Api::V2::Study) + end + + it 'should have a valid study type' do + expect(first_well_aliquot.study.type).to eq('studies') + end + it 'should have a valid study id' do + expect(first_well_aliquot.study.id).to be_kind_of(String) + expect(first_well_aliquot.study.id).to match(/\d+/) + end + it 'should have a valid study uuid' do + expect(first_well_aliquot.study.uuid).to be_kind_of(String) + expect(first_well_aliquot.study.uuid).to match(/\A\h{8}-\h{4}-\h{4}-\h{4}-\h{12}\z/) + end + it 'should have a valid study name' do + expect(first_well_aliquot.study.name).to eq('Test Aliquot Study') + end + + it 'should not have weird shadow attributes' do + expect(first_well_aliquot.attributes).to_not include('study') + expect(first_well_aliquot['study']).to be_nil + end + + it 'should have relationships' do + expect(first_well_aliquot.relationships).to be_kind_of(JsonApiClient::Relationships::Relations) + end + + it 'should have a valid study relationship' do + expect(first_well_aliquot.relationships.study).to be_kind_of(Hash) + end + + it 'should have valid study relationship data' do + expect(first_well_aliquot.relationships.study['data']).to be_kind_of(Hash) + end + + it 'should order groups' do + expect(first_well_aliquot.order_group).to eq([study_id, project_id]) + end end + end - it 'should order groups' do - expect(first_well_aliquot.order_group).to eq([study_id, project_id]) + context 'with specified study and project' do + subject { create(:v2_well, location: 'A1', aliquots: [source_aliquot]) } + let(:first_aliquot) { subject.aliquots.first } + + # source aliquots + let(:source_aliquot) { create(:v2_aliquot, sample: sample, study: study, project: project) } + + # study + let(:study_uuid) { SecureRandom.uuid } + let(:study) { create(:v2_study, name: 'Provided Study', uuid: study_uuid) } + + # project + let(:project_uuid) { SecureRandom.uuid } + let(:project) { create(:v2_project, name: 'Provided Project', uuid: project_uuid) } + + describe 'first aliquot' do + it 'should be a version 2 aliquot' do + expect(first_aliquot.class).to eq(Sequencescape::Api::V2::Aliquot) + end + + it 'should have a valid study' do + expect(first_aliquot.study).to be_kind_of(Sequencescape::Api::V2::Study) + end + it 'should have a valid study type' do + expect(first_aliquot.study.type).to eq('studies') + end + it 'should have a valid study uuid' do + expect(first_aliquot.study.uuid).to eq(study_uuid) + end + it 'should have a valid study name' do + expect(first_aliquot.study.name).to eq('Provided Study') + end + + it 'should have a valid project' do + expect(first_aliquot.project).to be_kind_of(Sequencescape::Api::V2::Project) + end + it 'should have a valid project type' do + expect(first_aliquot.project.type).to eq('projects') + end + it 'should have a valid project uuid' do + expect(first_aliquot.project.uuid).to eq(project_uuid) + end + it 'should have a valid project name' do + expect(first_aliquot.project.name).to eq('Provided Project') + end end end end From 219daee3427302b67bf69dd37a70ec9c4da1b3db Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 10:43:08 +0100 Subject: [PATCH 23/43] tests: add tests to specify study and project at well level --- spec/factories/well_factories.rb | 5 ++- spec/factory_outputs/well_factory_spec.rb | 41 ++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index f2bb0f94d..2da1c844f 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -53,12 +53,15 @@ # Use the stock well factory if you want the request comming out of the well outer_request { create request_factory, state: library_state } + study { create :v2_study, name: 'Well Study' } + project { create :v2_project, name: 'Well Project' } + # The factory to use for aliquots aliquot_factory { :v2_aliquot } aliquots do # Conditional to avoid generating requests when not required if aliquot_count > 0 - create_list aliquot_factory, aliquot_count, outer_request: outer_request + create_list aliquot_factory, aliquot_count, outer_request: outer_request, study: study, project: project else [] end diff --git a/spec/factory_outputs/well_factory_spec.rb b/spec/factory_outputs/well_factory_spec.rb index 1f80e8e7d..8f395bf18 100644 --- a/spec/factory_outputs/well_factory_spec.rb +++ b/spec/factory_outputs/well_factory_spec.rb @@ -190,7 +190,7 @@ end end - context 'with specified study and project' do + context 'with specified study and project at aliquot level' do subject { create(:v2_well, location: 'A1', aliquots: [source_aliquot]) } let(:first_aliquot) { subject.aliquots.first } @@ -237,4 +237,43 @@ end end end + + context 'with specified study and project at well level' do + subject { create(:v2_well, study: study, project: project) } + let(:first_aliquot) { subject.aliquots.first } + + # study + let(:study_uuid) { SecureRandom.uuid } + let(:study) { create(:v2_study, name: 'Provided Study', uuid: study_uuid) } + + # project + let(:project_uuid) { SecureRandom.uuid } + let(:project) { create(:v2_project, name: 'Provided Project', uuid: project_uuid) } + + describe 'first aliquot' do + it 'should be a version 2 aliquot' do + expect(first_aliquot.class).to eq(Sequencescape::Api::V2::Aliquot) + end + + it 'should have a valid study' do + expect(first_aliquot.study).to be_kind_of(Sequencescape::Api::V2::Study) + end + it 'should have a valid study uuid' do + expect(first_aliquot.study.uuid).to eq(study_uuid) + end + it 'should have a valid study name' do + expect(first_aliquot.study.name).to eq('Provided Study') + end + + it 'should have a valid project' do + expect(first_aliquot.project).to be_kind_of(Sequencescape::Api::V2::Project) + end + it 'should have a valid project uuid' do + expect(first_aliquot.project.uuid).to eq(project_uuid) + end + it 'should have a valid project name' do + expect(first_aliquot.project.name).to eq('Provided Project') + end + end + end end From f438a6a55fffa494fb95b7c6d53f057981b5f961 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 11:26:46 +0100 Subject: [PATCH 24/43] tests: add tests to specify study and project at plate level --- spec/factories/plate_factories.rb | 7 +++- spec/factory_outputs/plate_factory_spec.rb | 42 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/spec/factories/plate_factories.rb b/spec/factories/plate_factories.rb index 5a312012e..99a519f80 100644 --- a/spec/factories/plate_factories.rb +++ b/spec/factories/plate_factories.rb @@ -60,6 +60,9 @@ # associated request. This allows us to over-ride that aliquots_without_requests { 0 } + study { create :v2_study, name: 'Plate Study' } + project { create :v2_project, name: 'Plate Project' } + # Constructs the wells for the plate. Constructs # well_count wells using the factory specified in well_factory # Sets requests on wells by pulling them off the outer_request array @@ -73,7 +76,9 @@ outer_request: outer_requests[i], downstream_tubes: transfer_targets[location], uuid: well_uuid_result % location, - aliquot_count: outer_requests[i] ? 1 : aliquots_without_requests + aliquot_count: outer_requests[i] ? 1 : aliquots_without_requests, + study: study, + project: project end end diff --git a/spec/factory_outputs/plate_factory_spec.rb b/spec/factory_outputs/plate_factory_spec.rb index 6480e55e0..6a09a6d35 100644 --- a/spec/factory_outputs/plate_factory_spec.rb +++ b/spec/factory_outputs/plate_factory_spec.rb @@ -177,3 +177,45 @@ expect(JSON.parse(subject)).to include_json(JSON.parse(json_content)) end end + +RSpec.describe 'v2_plate' do + context 'with specified study and project at plate level' do + subject { create(:v2_plate, aliquots_without_requests: 1, study: study, project: project) } + + # study + let(:study_uuid) { SecureRandom.uuid } + let(:study) { create(:v2_study, name: 'Provided Study', uuid: study_uuid) } + + # project + let(:project_uuid) { SecureRandom.uuid } + let(:project) { create(:v2_project, name: 'Provided Project', uuid: project_uuid) } + + describe 'first aliquot' do + let(:first_aliquot) { subject.wells.first.aliquots.first } + + it 'should be a version 2 aliquot' do + expect(first_aliquot.class).to eq(Sequencescape::Api::V2::Aliquot) + end + + it 'should have a valid study' do + expect(first_aliquot.study).to be_kind_of(Sequencescape::Api::V2::Study) + end + it 'should have a valid study uuid' do + expect(first_aliquot.study.uuid).to eq(study_uuid) + end + it 'should have a valid study name' do + expect(first_aliquot.study.name).to eq('Provided Study') + end + + it 'should have a valid project' do + expect(first_aliquot.project).to be_kind_of(Sequencescape::Api::V2::Project) + end + it 'should have a valid project uuid' do + expect(first_aliquot.project.uuid).to eq(project_uuid) + end + it 'should have a valid project name' do + expect(first_aliquot.project.name).to eq('Provided Project') + end + end + end +end From 596ae2c2c6fb28607e6e277873c813b1abfbc594 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 11:41:36 +0100 Subject: [PATCH 25/43] tests: specify study and project at plate level for submission --- spec/factory_outputs/plate_factory_spec.rb | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/spec/factory_outputs/plate_factory_spec.rb b/spec/factory_outputs/plate_factory_spec.rb index 6a09a6d35..d165b1baf 100644 --- a/spec/factory_outputs/plate_factory_spec.rb +++ b/spec/factory_outputs/plate_factory_spec.rb @@ -219,3 +219,45 @@ end end end + +RSpec.describe 'v2_plate_for_submission' do + context 'with specified study and project at plate level' do + subject { create(:v2_plate_for_submission, aliquots_without_requests: 1, study: study, project: project) } + + # study + let(:study_uuid) { SecureRandom.uuid } + let(:study) { create(:v2_study, name: 'Provided Study', uuid: study_uuid) } + + # project + let(:project_uuid) { SecureRandom.uuid } + let(:project) { create(:v2_project, name: 'Provided Project', uuid: project_uuid) } + + describe 'first aliquot' do + let(:first_aliquot) { subject.wells.first.aliquots.first } + + it 'should be a version 2 aliquot' do + expect(first_aliquot.class).to eq(Sequencescape::Api::V2::Aliquot) + end + + it 'should have a valid study' do + expect(first_aliquot.study).to be_kind_of(Sequencescape::Api::V2::Study) + end + it 'should have a valid study uuid' do + expect(first_aliquot.study.uuid).to eq(study_uuid) + end + it 'should have a valid study name' do + expect(first_aliquot.study.name).to eq('Provided Study') + end + + it 'should have a valid project' do + expect(first_aliquot.project).to be_kind_of(Sequencescape::Api::V2::Project) + end + it 'should have a valid project uuid' do + expect(first_aliquot.project.uuid).to eq(project_uuid) + end + it 'should have a valid project name' do + expect(first_aliquot.project.name).to eq('Provided Project') + end + end + end +end From 93c187b44154ad5a6b38af229235eab13b6bf4b3 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 23 Oct 2023 17:42:26 +0100 Subject: [PATCH 26/43] tests: add tests for same study and project --- .../submission_plate_presenter_spec.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/spec/models/presenters/submission_plate_presenter_spec.rb b/spec/models/presenters/submission_plate_presenter_spec.rb index 1820ecae8..86003e7d0 100644 --- a/spec/models/presenters/submission_plate_presenter_spec.rb +++ b/spec/models/presenters/submission_plate_presenter_spec.rb @@ -69,7 +69,12 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_plate_for_submission, purpose_name: purpose_name, barcode_number: 2, direct_submissions: [] + create :v2_plate_for_submission, + purpose_name: purpose_name, + barcode_number: 2, + direct_submissions: [], + study: submission_study, + project: submission_project end let(:barcode_string) { 'DN2T' } @@ -77,6 +82,8 @@ let(:title) { purpose_name } let(:state) { 'pending' } let(:sidebar_partial) { 'submission' } + let(:submission_study) { create :v2_study, name: 'Submission Study' } + let(:submission_project) { create :v2_project, name: 'Submission Project' } let(:summary_tab) do [ %w[Barcode DN2T], @@ -88,6 +95,14 @@ ] end + it 'is handling wells from the same study' do + labware.wells.each { |well| expect(well.aliquots.first.study).to eq(submission_study) } + end + + it 'is handling wells from the same project' do + labware.wells.each { |well| expect(well.aliquots.first.project).to eq(submission_project) } + end + it 'renders the submission options' do expect { |b| presenter.each_submission_option(&b) }.to yield_successive_args(*template_options) end From e383aa611370516d44ddd016df60d56060083533 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 13:30:18 +0100 Subject: [PATCH 27/43] tests: update column headings --- ..._bank_tubes_content_report.csv.erb_spec.rb | 76 +++++++++++-------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index db66c4426..360dd44d3 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -172,14 +172,17 @@ ['Workflow', workflow_name], [], [ - 'Source Plate ID', - 'Source Plate Well', - 'Destination Rack', - 'Purpose', - 'Destination Tube ID', - 'Destination Tube Position', - 'Sample Vac Tube ID', - 'Sample Name' + 'Well name', + 'Donor ID', + 'Parent barcode', + 'FluidX barcode', + 'Extraction and freeze date', + 'Sequencing or contingency', + 'Cell count (cells/ml)', + 'Viability (%)', + 'Volume (µl)', + 'Study name', + 'Collection site' ], %w[DN3U A1 TR00000001 Sequencing FX4B A1 NT1O Sample1], %w[DN3U B1 TR00000001 Sequencing FX7E B1 NT2P Sample2], @@ -235,14 +238,17 @@ ['Workflow', workflow_name], [], [ - 'Source Plate ID', - 'Source Plate Well', - 'Destination Rack', - 'Purpose', - 'Destination Tube ID', - 'Destination Tube Position', - 'Sample Vac Tube ID', - 'Sample Name' + 'Well name', + 'Donor ID', + 'Parent barcode', + 'FluidX barcode', + 'Extraction and freeze date', + 'Sequencing or contingency', + 'Cell count (cells/ml)', + 'Viability (%)', + 'Volume (µl)', + 'Study name', + 'Collection site' ] ] end @@ -325,14 +331,17 @@ ['Workflow', workflow_name], [], [ - 'Source Plate ID', - 'Source Plate Well', - 'Destination Rack', - 'Purpose', - 'Destination Tube ID', - 'Destination Tube Position', - 'Sample Vac Tube ID', - 'Sample Name' + 'Well name', + 'Donor ID', + 'Parent barcode', + 'FluidX barcode', + 'Extraction and freeze date', + 'Sequencing or contingency', + 'Cell count (cells/ml)', + 'Viability (%)', + 'Volume (µl)', + 'Study name', + 'Collection site' ] ] end @@ -417,14 +426,17 @@ ['Workflow', workflow_name], [], [ - 'Source Plate ID', - 'Source Plate Well', - 'Destination Rack', - 'Purpose', - 'Destination Tube ID', - 'Destination Tube Position', - 'Sample Vac Tube ID', - 'Sample Name' + 'Well name', + 'Donor ID', + 'Parent barcode', + 'FluidX barcode', + 'Extraction and freeze date', + 'Sequencing or contingency', + 'Cell count (cells/ml)', + 'Viability (%)', + 'Volume (µl)', + 'Study name', + 'Collection site' ] ] end From 4e57dced1036791b10e3c40a6c37f817ac735432 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 13:30:27 +0100 Subject: [PATCH 28/43] fix: remove erroneous leading line --- app/views/exports/pbmc_bank_tubes_content_report.csv.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index ccb77fb2d..2ee8c9c57 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -1,6 +1,5 @@ <%# This is a report of the contents of the tubes in the PBMC Bank plate %> <%# Based on app/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb %> - <%= CSV.generate_line ['Workflow', @workflow], row_sep: '' %> <%= From 6008819b5b99955d27b4d41d543652d27eb29330 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 14:38:44 +0100 Subject: [PATCH 29/43] tests: refactor and add missing values --- ..._bank_tubes_content_report.csv.erb_spec.rb | 79 ++++++++++--------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 360dd44d3..b3c5d68b0 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -26,39 +26,42 @@ let(:ancestor_tubes) { { sample1_uuid => ancestor_vac_tube_1, sample2_uuid => ancestor_vac_tube_2 } } # source aliquots - let(:source_aliquot1_s1) { create(:v2_aliquot, sample: sample1) } - let(:source_aliquot2_s1) { create(:v2_aliquot, sample: sample1) } - let(:source_aliquot3_s1) { create(:v2_aliquot, sample: sample1) } - let(:source_aliquot1_s2) { create(:v2_aliquot, sample: sample2) } - let(:source_aliquot2_s2) { create(:v2_aliquot, sample: sample2) } - let(:source_aliquot3_s2) { create(:v2_aliquot, sample: sample2) } + let(:src_aliquot1_s1) { create(:v2_aliquot, sample: sample1) } + let(:src_aliquot2_s1) { create(:v2_aliquot, sample: sample1) } + let(:src_aliquot3_s1) { create(:v2_aliquot, sample: sample1) } + let(:src_aliquot1_s2) { create(:v2_aliquot, sample: sample2) } + let(:src_aliquot2_s2) { create(:v2_aliquot, sample: sample2) } + let(:src_aliquot3_s2) { create(:v2_aliquot, sample: sample2) } + + # qc results + let(:live_cell_count_qc) { create(:qc_result, key: 'live_cell_count', value: '20000', units: 'cells/ml') } + let(:viability_qc) { create(:qc_result, key: 'viability', value: '75', units: '%') } + let(:qc_results) { [live_cell_count_qc, viability_qc] } # source wells - let(:source_well_a1) do - create(:v2_well, location: 'A1', aliquots: [source_aliquot1_s1], downstream_tubes: [dest_tube1]) - end - let(:source_well_a2) do - create(:v2_well, location: 'A2', aliquots: [source_aliquot2_s1], downstream_tubes: [dest_tube2]) - end - let(:source_well_a3) do - create(:v2_well, location: 'A3', aliquots: [source_aliquot3_s1], downstream_tubes: [dest_tube3]) + let(:source_well_attributes) do + [ + { location: 'A1', aliquots: [src_aliquot1_s1], downstream_tubes: [dest_tube1], qc_results: qc_results }, + { location: 'A2', aliquots: [src_aliquot2_s1], downstream_tubes: [dest_tube2], qc_results: qc_results }, + { location: 'A3', aliquots: [src_aliquot3_s1], downstream_tubes: [dest_tube3], qc_results: qc_results }, + { location: 'B1', aliquots: [src_aliquot1_s2], downstream_tubes: [dest_tube4], qc_results: qc_results }, + { location: 'B2', aliquots: [src_aliquot2_s2], downstream_tubes: [dest_tube5], qc_results: qc_results }, + { location: 'B3', aliquots: [src_aliquot3_s2], downstream_tubes: [dest_tube6], qc_results: qc_results } + ] end - let(:source_well_b1) do - create(:v2_well, location: 'B1', aliquots: [source_aliquot1_s2], downstream_tubes: [dest_tube4]) - end - let(:source_well_b2) do - create(:v2_well, location: 'B2', aliquots: [source_aliquot2_s2], downstream_tubes: [dest_tube5]) - end - let(:source_well_b3) do - create(:v2_well, location: 'B3', aliquots: [source_aliquot3_s2], downstream_tubes: [dest_tube6]) - end + let(:src_well_a1) { create(:v2_well, source_well_attributes[0]) } + let(:src_well_a2) { create(:v2_well, source_well_attributes[1]) } + let(:src_well_a3) { create(:v2_well, source_well_attributes[2]) } + let(:src_well_b1) { create(:v2_well, source_well_attributes[3]) } + let(:src_well_b2) { create(:v2_well, source_well_attributes[4]) } + let(:src_well_b3) { create(:v2_well, source_well_attributes[5]) } # source plate - let(:source_labware) do + let(:src_labware) do create( :v2_plate, - wells: [source_well_a1, source_well_a2, source_well_a3, source_well_b1, source_well_b2, source_well_b3], + wells: [src_well_a1, src_well_a2, src_well_a3, src_well_b1, src_well_b2, src_well_b3], barcode_number: 3 ) end @@ -184,18 +187,18 @@ 'Study name', 'Collection site' ], - %w[DN3U A1 TR00000001 Sequencing FX4B A1 NT1O Sample1], - %w[DN3U B1 TR00000001 Sequencing FX7E B1 NT2P Sample2], - %w[DN3U A2 TR00000002 Contingency FX5C A1 NT1O Sample1], - %w[DN3U B2 TR00000002 Contingency FX8F C1 NT2P Sample2], - %w[DN3U A3 TR00000002 Contingency FX6D B1 NT1O Sample1], - %w[DN3U B3 TR00000002 Contingency FX9G D1 NT2P Sample2] + %w[DN1S:A1 nil NT2P NT1O extraction-date Sequencing 20000 75 135 ReportStudy Sanger], + %w[DN1S:B1 nil NT2P NT1O extraction-date Sequencing 20000 75 135 ReportStudy Sanger], + %w[DN1S:A2 nil NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], + %w[DN1S:B2 nil NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], + %w[DN1S:A3 nil NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], + %w[DN1S:B3 nil NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger] ] end before do assign(:ancestor_tubes, ancestor_tubes) - assign(:plate, source_labware) + assign(:plate, src_labware) assign(:workflow, workflow_name) # stub the v2 child tube lookups @@ -225,13 +228,13 @@ context 'when transfers are not done yet' do # source wells - let(:source_well_a1) { create(:v2_well, location: 'A1', aliquots: [source_aliquot1_s1], downstream_tubes: []) } - let(:source_well_a2) { create(:v2_well, location: 'A2', aliquots: [source_aliquot2_s1], downstream_tubes: []) } - let(:source_well_a3) { create(:v2_well, location: 'A3', aliquots: [source_aliquot3_s1], downstream_tubes: []) } + let(:src_well_a1) { create(:v2_well, location: 'A1', aliquots: [src_aliquot1_s1], downstream_tubes: []) } + let(:src_well_a2) { create(:v2_well, location: 'A2', aliquots: [src_aliquot2_s1], downstream_tubes: []) } + let(:src_well_a3) { create(:v2_well, location: 'A3', aliquots: [src_aliquot3_s1], downstream_tubes: []) } - let(:source_well_b1) { create(:v2_well, location: 'B1', aliquots: [source_aliquot1_s2], downstream_tubes: []) } - let(:source_well_b2) { create(:v2_well, location: 'B2', aliquots: [source_aliquot2_s2], downstream_tubes: []) } - let(:source_well_b3) { create(:v2_well, location: 'B3', aliquots: [source_aliquot3_s2], downstream_tubes: []) } + let(:src_well_b1) { create(:v2_well, location: 'B1', aliquots: [src_aliquot1_s2], downstream_tubes: []) } + let(:src_well_b2) { create(:v2_well, location: 'B2', aliquots: [src_aliquot2_s2], downstream_tubes: []) } + let(:src_well_b3) { create(:v2_well, location: 'B3', aliquots: [src_aliquot3_s2], downstream_tubes: []) } let(:expected_content) do [ From 0f7de3c108db23a61d3bea887a46c19b10fb76bf Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 14:41:57 +0100 Subject: [PATCH 30/43] tests: add missing study --- ...pbmc_bank_tubes_content_report.csv.erb_spec.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index b3c5d68b0..441f917c3 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -8,6 +8,9 @@ context 'when creating a pbmc bank tubes content report csv' do has_a_working_api + # study + let(:study) { create(:v2_study, name: 'ReportStudy') } + # samples let(:sample1_uuid) { SecureRandom.uuid } let(:sample2_uuid) { SecureRandom.uuid } @@ -26,12 +29,12 @@ let(:ancestor_tubes) { { sample1_uuid => ancestor_vac_tube_1, sample2_uuid => ancestor_vac_tube_2 } } # source aliquots - let(:src_aliquot1_s1) { create(:v2_aliquot, sample: sample1) } - let(:src_aliquot2_s1) { create(:v2_aliquot, sample: sample1) } - let(:src_aliquot3_s1) { create(:v2_aliquot, sample: sample1) } - let(:src_aliquot1_s2) { create(:v2_aliquot, sample: sample2) } - let(:src_aliquot2_s2) { create(:v2_aliquot, sample: sample2) } - let(:src_aliquot3_s2) { create(:v2_aliquot, sample: sample2) } + let(:src_aliquot1_s1) { create(:v2_aliquot, sample: sample1, study: study) } + let(:src_aliquot2_s1) { create(:v2_aliquot, sample: sample1, study: study) } + let(:src_aliquot3_s1) { create(:v2_aliquot, sample: sample1, study: study) } + let(:src_aliquot1_s2) { create(:v2_aliquot, sample: sample2, study: study) } + let(:src_aliquot2_s2) { create(:v2_aliquot, sample: sample2, study: study) } + let(:src_aliquot3_s2) { create(:v2_aliquot, sample: sample2, study: study) } # qc results let(:live_cell_count_qc) { create(:qc_result, key: 'live_cell_count', value: '20000', units: 'cells/ml') } From b95584b876639add917ff61b43831b17d8e9b92d Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 15:24:11 +0100 Subject: [PATCH 31/43] tests: add donor and row-by-row evaluation to tests --- spec/factories/sample_factories.rb | 1 + ...c_bank_tubes_content_report.csv.erb_spec.rb | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/spec/factories/sample_factories.rb b/spec/factories/sample_factories.rb index ed60db1e1..f9bb36f4b 100644 --- a/spec/factories/sample_factories.rb +++ b/spec/factories/sample_factories.rb @@ -38,6 +38,7 @@ collected_by { 'Sanger' } cohort { 'Cohort' } sample_description { 'Description' } + sequence(:donor_id) { |i| "donor#{i}" } end factory :v2_sample_metadata_for_mbrave, class: Sequencescape::Api::V2::SampleMetadata do diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 441f917c3..01603e7f6 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -190,12 +190,12 @@ 'Study name', 'Collection site' ], - %w[DN1S:A1 nil NT2P NT1O extraction-date Sequencing 20000 75 135 ReportStudy Sanger], - %w[DN1S:B1 nil NT2P NT1O extraction-date Sequencing 20000 75 135 ReportStudy Sanger], - %w[DN1S:A2 nil NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], - %w[DN1S:B2 nil NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], - %w[DN1S:A3 nil NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], - %w[DN1S:B3 nil NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger] + %w[DN1S:A1 donor1 NT2P NT1O extraction-date Sequencing 20000 75 135 ReportStudy Sanger], + %w[DN1S:B1 donor2 NT2P NT1O extraction-date Sequencing 20000 75 135 ReportStudy Sanger], + %w[DN1S:A2 donor1 NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], + %w[DN1S:B2 donor2 NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], + %w[DN1S:A3 donor1 NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], + %w[DN1S:B3 donor2 NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger] ] end @@ -225,8 +225,10 @@ .and_return(dest_tube6) end - it 'renders the expected content' do - expect(CSV.parse(render)).to eq(expected_content) + it 'renders the expected content row by row' do + for row in CSV.parse(render) + expect(row).to eq(expected_content.shift) + end end context 'when transfers are not done yet' do From 15691a5f2a39ad66d1105122bbee1751e1c4be2e Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 15:34:16 +0100 Subject: [PATCH 32/43] fix: add extraction-date and study name --- .../pbmc_bank_tubes_content_report.csv.erb | 2 +- ...bmc_bank_tubes_content_report.csv.erb_spec.rb | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 2ee8c9c57..001e4cb4d 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -70,7 +70,7 @@ donor_id, # Donor ID ✅ # Deep behind sample manifest UAT action on the SS side @ancestor_tubes.values.last.labware_barcode, # Vacutainer/stock barcode (lrc blood vac purpose) @ancestor_tubes.values.first.labware_barcode, # FluidX barcode (child tube barcode) - 'extraction-date', # Extraction and freeze date (created-at for child tube) + child_tube_v2.created_at , # Extraction and freeze date (created-at for child tube) ✅ purpose, # Sequencing or contingency ✅ source_well.latest_live_cell_count.value, # Cell count ✅ source_well.latest_cell_viability.value, # Viability ✅ diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 01603e7f6..c22d9df0d 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -9,7 +9,8 @@ has_a_working_api # study - let(:study) { create(:v2_study, name: 'ReportStudy') } + let(:study_name) { 'Report Study' } + let(:study) { create(:v2_study, name: study_name) } # samples let(:sample1_uuid) { SecureRandom.uuid } @@ -173,6 +174,7 @@ let(:workflow_name) { 'Test Workflow Name' } # expected file content + let(:created_at) { '2017-06-29 09:31:59 +0100' } let(:expected_content) do [ ['Workflow', workflow_name], @@ -190,12 +192,12 @@ 'Study name', 'Collection site' ], - %w[DN1S:A1 donor1 NT2P NT1O extraction-date Sequencing 20000 75 135 ReportStudy Sanger], - %w[DN1S:B1 donor2 NT2P NT1O extraction-date Sequencing 20000 75 135 ReportStudy Sanger], - %w[DN1S:A2 donor1 NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], - %w[DN1S:B2 donor2 NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], - %w[DN1S:A3 donor1 NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger], - %w[DN1S:B3 donor2 NT2P NT1O extraction-date Contingency 20000 75 135 ReportStudy Sanger] + %W[DN1S:A1 donor1 NT2P NT1O #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], + %W[DN1S:B1 donor2 NT2P NT1O #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], + %W[DN1S:A2 donor1 NT2P NT1O #{created_at} Contingency 20000 75 135 #{study_name} Sanger], + %W[DN1S:B2 donor2 NT2P NT1O #{created_at} Contingency 20000 75 135 #{study_name} Sanger], + %W[DN1S:A3 donor1 NT2P NT1O #{created_at} Contingency 20000 75 135 #{study_name} Sanger], + %W[DN1S:B3 donor2 NT2P NT1O #{created_at} Contingency 20000 75 135 #{study_name} Sanger] ] end From 59e35e63bc890df59d9a984dcbefe677d7c4ac1e Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 16:45:32 +0100 Subject: [PATCH 33/43] fix: update barcodes --- .../exports/pbmc_bank_tubes_content_report.csv.erb | 4 ++-- .../pbmc_bank_tubes_content_report.csv.erb_spec.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 001e4cb4d..486379192 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -68,8 +68,8 @@ rows_array << [ source_well.name, # Well name ✅ donor_id, # Donor ID ✅ # Deep behind sample manifest UAT action on the SS side - @ancestor_tubes.values.last.labware_barcode, # Vacutainer/stock barcode (lrc blood vac purpose) - @ancestor_tubes.values.first.labware_barcode, # FluidX barcode (child tube barcode) + @ancestor_tubes[sample_uuid].labware_barcode.human, # Vacutainer/stock barcode (LRC Blood Vac purpose) ✅ + child_tube_v2.barcode , # FluidX barcode (child tube barcode) ✅ child_tube_v2.created_at , # Extraction and freeze date (created-at for child tube) ✅ purpose, # Sequencing or contingency ✅ source_well.latest_live_cell_count.value, # Cell count ✅ diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index c22d9df0d..9298c41a8 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -192,12 +192,12 @@ 'Study name', 'Collection site' ], - %W[DN1S:A1 donor1 NT2P NT1O #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], - %W[DN1S:B1 donor2 NT2P NT1O #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], - %W[DN1S:A2 donor1 NT2P NT1O #{created_at} Contingency 20000 75 135 #{study_name} Sanger], - %W[DN1S:B2 donor2 NT2P NT1O #{created_at} Contingency 20000 75 135 #{study_name} Sanger], - %W[DN1S:A3 donor1 NT2P NT1O #{created_at} Contingency 20000 75 135 #{study_name} Sanger], - %W[DN1S:B3 donor2 NT2P NT1O #{created_at} Contingency 20000 75 135 #{study_name} Sanger] + %W[DN1S:A1 donor1 NT1O FX4B #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], + %W[DN1S:B1 donor2 NT2P FX7E #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], + %W[DN1S:A2 donor1 NT1O FX5C #{created_at} Contingency 20000 75 135 #{study_name} Sanger], + %W[DN1S:B2 donor2 NT2P FX8F #{created_at} Contingency 20000 75 135 #{study_name} Sanger], + %W[DN1S:A3 donor1 NT1O FX6D #{created_at} Contingency 20000 75 135 #{study_name} Sanger], + %W[DN1S:B3 donor2 NT2P FX9G #{created_at} Contingency 20000 75 135 #{study_name} Sanger] ] end From a742683d603e12e5062b3eabea1bdecadcaf654a Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 16:48:25 +0100 Subject: [PATCH 34/43] style: remove development comments --- .../pbmc_bank_tubes_content_report.csv.erb | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 486379192..b553ce504 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -30,11 +30,6 @@ # skip if no downstream tubes for this well (not set up children in Limber yet) next if source_well.downstream_tubes.empty? - # expecting ? sample tube - # TODO: check for states and get the last tube - # TODO: check what downstream_tubes does - # Check for ascendence method to get specific purpose - child_tube = source_well.downstream_tubes.last child_tube_v2 = Sequencescape::Api::V2.tube_with_custom_includes( 'custom_metadatum_collection', @@ -61,22 +56,23 @@ child_tube_name_array = child_tube_v2.name.split(':') sample_metadata = source_well.aliquots.first.sample.sample_metadata + # sourced from deep behind sample manifest UAT action on the SS side donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil purpose = ((child_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') volume = 135 rows_array << [ - source_well.name, # Well name ✅ - donor_id, # Donor ID ✅ # Deep behind sample manifest UAT action on the SS side - @ancestor_tubes[sample_uuid].labware_barcode.human, # Vacutainer/stock barcode (LRC Blood Vac purpose) ✅ - child_tube_v2.barcode , # FluidX barcode (child tube barcode) ✅ - child_tube_v2.created_at , # Extraction and freeze date (created-at for child tube) ✅ - purpose, # Sequencing or contingency ✅ - source_well.latest_live_cell_count.value, # Cell count ✅ - source_well.latest_cell_viability.value, # Viability ✅ - volume, # Volume # ✅ TODO: units - source_well.aliquots.first.study.name, # Study name ✅ - source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site ✅ + source_well.name, # Well name + donor_id, # Donor ID + @ancestor_tubes[sample_uuid].labware_barcode.human, # LRC Blood Vac purpose barcode + child_tube_v2.barcode , # FluidX barcode + child_tube_v2.created_at , # Extraction and freeze date + purpose, # Sequencing or contingency + source_well.latest_live_cell_count.value, # Cell count + source_well.latest_cell_viability.value, # Viability + volume, # Volume + source_well.aliquots.first.study.name, # Study name + source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site ] end %> From fbc7a10bdc021f56bc64065f0150d09c642a3556 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 16:48:50 +0100 Subject: [PATCH 35/43] refactor: rename child_tube -> child_tube_v1 --- app/views/exports/pbmc_bank_tubes_content_report.csv.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index b553ce504..6d5e29850 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -30,11 +30,12 @@ # skip if no downstream tubes for this well (not set up children in Limber yet) next if source_well.downstream_tubes.empty? + child_tube_v1 = source_well.downstream_tubes.last child_tube_v2 = Sequencescape::Api::V2.tube_with_custom_includes( 'custom_metadatum_collection', nil, - barcode: child_tube.labware_barcode.machine + barcode: child_tube_v1.labware_barcode.machine ) next unless child_tube_v2 && child_tube_v2.custom_metadatum_collection From 96cc5f5b01a15bb070134de79d246a116a63d673 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 16:51:23 +0100 Subject: [PATCH 36/43] style: lint --- app/views/exports/pbmc_bank_tubes_content_report.csv.erb | 5 +++-- .../exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 6d5e29850..9d53d6bd5 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -57,6 +57,7 @@ child_tube_name_array = child_tube_v2.name.split(':') sample_metadata = source_well.aliquots.first.sample.sample_metadata + # sourced from deep behind sample manifest UAT action on the SS side donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil purpose = ((child_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') @@ -66,8 +67,8 @@ source_well.name, # Well name donor_id, # Donor ID @ancestor_tubes[sample_uuid].labware_barcode.human, # LRC Blood Vac purpose barcode - child_tube_v2.barcode , # FluidX barcode - child_tube_v2.created_at , # Extraction and freeze date + child_tube_v2.barcode, # FluidX barcode + child_tube_v2.created_at, # Extraction and freeze date purpose, # Sequencing or contingency source_well.latest_live_cell_count.value, # Cell count source_well.latest_cell_viability.value, # Viability diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 9298c41a8..8e5397a5d 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -228,7 +228,7 @@ end it 'renders the expected content row by row' do - for row in CSV.parse(render) + CSV.parse(render).each do |row| expect(row).to eq(expected_content.shift) end end From 2b6b7967b9f0070eb7063c9d0b860ea09bb2ef65 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 16:57:42 +0100 Subject: [PATCH 37/43] style: lindt --- .../exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 8e5397a5d..3943d16e1 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -228,9 +228,7 @@ end it 'renders the expected content row by row' do - CSV.parse(render).each do |row| - expect(row).to eq(expected_content.shift) - end + CSV.parse(render).each { |row| expect(row).to eq(expected_content.shift) } end context 'when transfers are not done yet' do From cfc6c80d7bb9b22d7ec57d54fbedb73a48d6582a Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Oct 2023 17:07:01 +0100 Subject: [PATCH 38/43] tests: specify donor_id --- ..._bank_tubes_content_report.csv.erb_spec.rb | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 3943d16e1..a99c27290 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -13,11 +13,15 @@ let(:study) { create(:v2_study, name: study_name) } # samples + + let(:sample_metadata1) { create(:v2_sample_metadata, donor_id: 'Donor1') } + let(:sample_metadata2) { create(:v2_sample_metadata, donor_id: 'Donor2') } + let(:sample1_uuid) { SecureRandom.uuid } let(:sample2_uuid) { SecureRandom.uuid } - let(:sample1) { create(:v2_sample, name: 'Sample1', uuid: sample1_uuid) } - let(:sample2) { create(:v2_sample, name: 'Sample2', uuid: sample2_uuid) } + let(:sample1) { create(:v2_sample, name: 'Sample1', uuid: sample1_uuid, sample_metadata: sample_metadata1) } + let(:sample2) { create(:v2_sample, name: 'Sample2', uuid: sample2_uuid, sample_metadata: sample_metadata2) } # ancestor vac tubes let(:vac_aliquot1) { create(:v2_aliquot, sample: sample1) } @@ -192,12 +196,12 @@ 'Study name', 'Collection site' ], - %W[DN1S:A1 donor1 NT1O FX4B #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], - %W[DN1S:B1 donor2 NT2P FX7E #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], - %W[DN1S:A2 donor1 NT1O FX5C #{created_at} Contingency 20000 75 135 #{study_name} Sanger], - %W[DN1S:B2 donor2 NT2P FX8F #{created_at} Contingency 20000 75 135 #{study_name} Sanger], - %W[DN1S:A3 donor1 NT1O FX6D #{created_at} Contingency 20000 75 135 #{study_name} Sanger], - %W[DN1S:B3 donor2 NT2P FX9G #{created_at} Contingency 20000 75 135 #{study_name} Sanger] + %W[DN1S:A1 Donor1 NT1O FX4B #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], + %W[DN1S:B1 Donor2 NT2P FX7E #{created_at} Sequencing 20000 75 135 #{study_name} Sanger], + %W[DN1S:A2 Donor1 NT1O FX5C #{created_at} Contingency 20000 75 135 #{study_name} Sanger], + %W[DN1S:B2 Donor2 NT2P FX8F #{created_at} Contingency 20000 75 135 #{study_name} Sanger], + %W[DN1S:A3 Donor1 NT1O FX6D #{created_at} Contingency 20000 75 135 #{study_name} Sanger], + %W[DN1S:B3 Donor2 NT2P FX9G #{created_at} Contingency 20000 75 135 #{study_name} Sanger] ] end From 9d013dbb3032db5205c4ec7a6a3ac5392ce5d595 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 10:03:02 +0000 Subject: [PATCH 39/43] Bump puma from 6.0.0 to 6.3.1 Bumps [puma](https://github.com/puma/puma) from 6.0.0 to 6.3.1. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v6.0.0...v6.3.1) --- updated-dependencies: - dependency-name: puma dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5171f5da8..4dcc123a6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -246,7 +246,7 @@ GEM byebug (~> 11.0) pry (>= 0.13, < 0.15) public_suffix (5.0.0) - puma (6.0.0) + puma (6.3.1) nio4r (~> 2.0) racc (1.7.1) rack (2.2.8) From f6c477bdf5f2d297fcb6adfd65bccd16a48bfade Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 30 Oct 2023 13:50:04 +0000 Subject: [PATCH 40/43] fix: revert inadvertent debugging changes --- config/exports/exports.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/config/exports/exports.yml b/config/exports/exports.yml index bc63d9b9a..926219046 100644 --- a/config/exports/exports.yml +++ b/config/exports/exports.yml @@ -149,14 +149,10 @@ hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare: csv: hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare workflow: scRNA Core PBMC Bank plate_includes: + - wells.downstream_tubes - wells.aliquots - wells.aliquots.sample - - wells.aliquots.sample.component_samples - wells.aliquots.sample.sample_metadata - - wells.downstream_tubes - - wells.qc_results - - wells.transfer_requests_as_target.source_asset - - wells.upstream_tubes ancestor_tube_purpose: LRC Blood Vac hamilton_lrc_blood_bank_to_lrc_pbmc_bank: csv: hamilton_lrc_blood_bank_to_lrc_pbmc_bank From 7d3868a7a24b03475146af442917c5598102fdfc Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 30 Oct 2023 13:54:06 +0000 Subject: [PATCH 41/43] fix: rename Parent barcode -> Stock barcode --- app/views/exports/pbmc_bank_tubes_content_report.csv.erb | 2 +- .../pbmc_bank_tubes_content_report.csv.erb_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 9d53d6bd5..582367182 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -6,7 +6,7 @@ CSV.generate_line [ 'Well name', 'Donor ID', - 'Parent barcode', + 'Stock barcode', 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index a99c27290..299ef12d3 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -186,7 +186,7 @@ [ 'Well name', 'Donor ID', - 'Parent barcode', + 'Stock barcode', 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', @@ -252,7 +252,7 @@ [ 'Well name', 'Donor ID', - 'Parent barcode', + 'Stock barcode', 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', @@ -345,7 +345,7 @@ [ 'Well name', 'Donor ID', - 'Parent barcode', + 'Stock barcode', 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', @@ -440,7 +440,7 @@ [ 'Well name', 'Donor ID', - 'Parent barcode', + 'Stock barcode', 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', From 3a4e64dc80cbbac9e26a18a61d577b7e8fc96d4f Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 30 Oct 2023 15:05:39 +0000 Subject: [PATCH 42/43] fix: use purpose name instead of tube name to determine destination --- .../exports/pbmc_bank_tubes_content_report.csv.erb | 10 ++++------ .../pbmc_bank_tubes_content_report.csv.erb_spec.rb | 10 ++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 582367182..7e4f0f7fd 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -53,14 +53,12 @@ sample_uuid = source_well.aliquots.first.sample.uuid source_well_posn = source_well.position['name'] - # e.g. SEQ:CHILD_TUBE:A1 - child_tube_name_array = child_tube_v2.name.split(':') - sample_metadata = source_well.aliquots.first.sample.sample_metadata # sourced from deep behind sample manifest UAT action on the SS side - donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil - purpose = ((child_tube_name_array[0] == 'SEQ') ? 'Sequencing' : 'Contingency') + donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nils + child_tube_purpose = child_tube_v2.purpose.name + destination = ((child_tube_purpose == 'LRC Blood Seq') ? 'Sequencing' : 'Contingency') volume = 135 rows_array << [ @@ -69,7 +67,7 @@ @ancestor_tubes[sample_uuid].labware_barcode.human, # LRC Blood Vac purpose barcode child_tube_v2.barcode, # FluidX barcode child_tube_v2.created_at, # Extraction and freeze date - purpose, # Sequencing or contingency + destination, # Sequencing or contingency source_well.latest_live_cell_count.value, # Cell count source_well.latest_cell_viability.value, # Viability volume, # Volume diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 299ef12d3..c10200d91 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -106,10 +106,15 @@ let(:dest_tube5_uuid) { SecureRandom.uuid } let(:dest_tube6_uuid) { SecureRandom.uuid } + # destination purposes + let(:lrc_blood_seq) { create(:v2_purpose, name: 'LRC Blood Seq') } + let(:lrc_blood_spare) { create(:v2_purpose, name: 'LRC Blood Spare') } + # destination tubes let(:dest_tube1) do create( :v2_tube_with_metadata, + purpose: lrc_blood_seq, uuid: dest_tube1_uuid, barcode_prefix: 'FX', barcode_number: 4, @@ -121,6 +126,7 @@ let(:dest_tube2) do create( :v2_tube_with_metadata, + purpose: lrc_blood_spare, uuid: dest_tube2_uuid, barcode_prefix: 'FX', barcode_number: 5, @@ -132,6 +138,7 @@ let(:dest_tube3) do create( :v2_tube_with_metadata, + purpose: lrc_blood_spare, uuid: dest_tube3_uuid, barcode_prefix: 'FX', barcode_number: 6, @@ -143,6 +150,7 @@ let(:dest_tube4) do create( :v2_tube_with_metadata, + purpose: lrc_blood_seq, uuid: dest_tube4_uuid, barcode_prefix: 'FX', barcode_number: 7, @@ -154,6 +162,7 @@ let(:dest_tube5) do create( :v2_tube_with_metadata, + purpose: lrc_blood_spare, uuid: dest_tube5_uuid, barcode_prefix: 'FX', barcode_number: 8, @@ -165,6 +174,7 @@ let(:dest_tube6) do create( :v2_tube_with_metadata, + purpose: lrc_blood_spare, uuid: dest_tube6_uuid, barcode_prefix: 'FX', barcode_number: 9, From 613c3bc89f155f262f57afbba986a702eecb27e3 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 30 Oct 2023 15:07:07 +0000 Subject: [PATCH 43/43] fix: update dev comment --- app/views/exports/pbmc_bank_tubes_content_report.csv.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 7e4f0f7fd..88365bb08 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -55,7 +55,7 @@ sample_metadata = source_well.aliquots.first.sample.sample_metadata - # sourced from deep behind sample manifest UAT action on the SS side + # donor_id is sourced from the sample metadata provided by Sequencescape donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nils child_tube_purpose = child_tube_v2.purpose.name destination = ((child_tube_purpose == 'LRC Blood Seq') ? 'Sequencing' : 'Contingency')