From 5089411e618672d1adcaf4b0c9fa91186b07a976 Mon Sep 17 00:00:00 2001 From: rpletz Date: Fri, 10 Nov 2023 10:43:48 -0800 Subject: [PATCH] Fix rapidReport filter --- app/routes/report/variants.js | 28 ++++++++++---------------- test/testData/mockRapidReportData.json | 12 ++++++++++- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/routes/report/variants.js b/app/routes/report/variants.js index 6439dc30c..d11458e09 100644 --- a/app/routes/report/variants.js +++ b/app/routes/report/variants.js @@ -40,15 +40,17 @@ const therapeuticAssociationFilter = { {[Op.is]: literal('distinct from \'msi\'')}, {[Op.is]: literal('distinct from \'tmb\'')}, ]}, - [Op.or]: [ - { - relevance: 'resistance', - iprEvidenceLevel: 'IPR-A', - }, - { - relevance: 'sensitivity', - }, - ], + [Op.and]: { + [Op.or]: [ + { + relevance: 'resistance', + iprEvidenceLevel: 'IPR-A', + }, + { + relevance: 'sensitivity', + }, + ], + }, // Regex filter for finding columns with 2 or more spaces that end with // mutation or mutations [Op.not]: {kbVariant: {[Op.regexp]: MUTATION_REGEX}}, @@ -58,14 +60,6 @@ const therapeuticAssociationFilter = { // Literal is used in order to accomodate NULL rows. const cancerRelevanceFilter = { id: {[Op.ne]: null}, - [Op.not]: { - [Op.or]: [ - {iprEvidenceLevel: {[Op.is]: literal('not distinct from \'IPR-A\'')}}, - {iprEvidenceLevel: {[Op.is]: literal('not distinct from \'IPR-B\'')}}, - ], - category: 'therapeutic', - matchedCancer: true, - }, variantType: {[Op.and]: [ {[Op.is]: literal('distinct from \'exp\'')}, ]}, diff --git a/test/testData/mockRapidReportData.json b/test/testData/mockRapidReportData.json index fffee74ff..bef17a68c 100644 --- a/test/testData/mockRapidReportData.json +++ b/test/testData/mockRapidReportData.json @@ -17,7 +17,7 @@ "category": "therapeutic", "variantType": "cnv", "variant": "TA", - "iprEvidenceLevel": "IPR-B", + "iprEvidenceLevel": "IPR-A", "kbVariant": "this should be in table 1", "matchedCancer": true, "relevance": "resistance", @@ -43,6 +43,16 @@ "relevance": "resistance", "evidenceLevel": "table 2" }, + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "CR", + "iprEvidenceLevel": "IPR-D", + "kbVariant": "geneX specific mutation 7", + "matchedCancer": true, + "relevance": "sensitivity", + "evidenceLevel": "table 2" + }, { "category": "therapeutic", "variantType": "cnv",