From f16696c27be4271617292e2f92a487338e751e45 Mon Sep 17 00:00:00 2001 From: rpletz Date: Mon, 16 Oct 2023 14:35:48 -0700 Subject: [PATCH 1/3] Add base mock rapid report --- test/testData/mockRapidReportData.json | 219 +++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 test/testData/mockRapidReportData.json diff --git a/test/testData/mockRapidReportData.json b/test/testData/mockRapidReportData.json new file mode 100644 index 000000000..05ea0d769 --- /dev/null +++ b/test/testData/mockRapidReportData.json @@ -0,0 +1,219 @@ +{ + "template": "rapid", + "patientId": "UPLOADPAT01", + "project": "TEST", + "kbMatches": [ + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "TA", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "this should be in table 1", + "matchedCancer": true, + "evidenceLevel": "table 1" + }, + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "TA", + "iprEvidenceLevel": "IPR-B", + "kbVariant": "thisshouldbeintable1", + "matchedCancer": true, + "evidenceLevel": "table 1" + }, + { + "category": "unknown", + "variantType": "cnv", + "variant": "TA", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "geneX specific mutation 1", + "evidenceLevel": "table null" + }, + { + "category": "unknown", + "variantType": "cnv", + "variant": "CR", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "this.should.be:table2", + "evidenceLevel": "table 2" + }, + { + "category": "unknown", + "variantType": "msi", + "variant": "msi", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "also should be table 2", + "evidenceLevel": "table 2" + }, + { + "category": "unknown", + "variantType": "tmb", + "variant": "tmb", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "geneX specific mutation 2", + "evidenceLevel": "table 2" + }, + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "CR", + "iprEvidenceLevel": "IPR-C", + "kbVariant": "table2 specific mutation", + "evidenceLevel": "table 2" + }, + { + "category": "unknown", + "variantType": "cnv", + "variant": "CR", + "iprEvidenceLevel": "IPR-C", + "kbVariant": "geneX specific mutation 3", + "evidenceLevel": "table 2" + }, + { + "category": "unknown", + "variantType": "cnv", + "variant": "CR", + "iprEvidenceLevel": null, + "kbVariant": "geneX specific mutation 4", + "evidenceLevel": "table 2" + }, + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "CR", + "iprEvidenceLevel": null, + "kbVariant": "geneX specific mutation 5", + "evidenceLevel": "table 2" + }, + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "CR", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "geneX specific mutation 6", + "matchedCancer": false, + "evidenceLevel": "table 2" + }, + { + "category": "therapeutic", + "variantType": "exp", + "variant": "alltrueexp", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "geneX specific mutation 7", + "matchedCancer": true, + "evidenceLevel": "table null" + }, + { + "category": "therapeutic", + "variantType": "mut", + "variant": "tageneric", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "geneX missense", + "matchedCancer": true, + "evidenceLevel": "table 3" + }, + { + "category": "therapeutic", + "variantType": "mut", + "variant": "crgeneric", + "iprEvidenceLevel": "IPR-C", + "kbVariant": "geneX mutation", + "evidenceLevel": "table 3" + } + ], + "genes": [ + { + "name": "oncogene", + "oncogene": true, + "tumourSuppressor": false + }, + { + "name": "tumoursupressor", + "oncogene": false, + "tumourSuppressor": true + }, + { + "name": "alltrue", + "oncogene": true, + "tumourSuppressor": true + }, + { + "name": "allfalse", + "oncogene": false, + "tumourSuppressor": false + }, + { + "name": "table1CV" + }, + { + "name": "table2CV" + } + ], + "smallMutations": [ + { + "gene": "alltrue", + "key": "tageneric", + "displayName": "table 3" + }, + { + "gene": "alltrue", + "key": "crgeneric", + "displayName": "table 3" + }, + { + "gene": "oncogene", + "key": "usoncogene", + "displayName": "table 3" + }, + { + "gene": "tumoursupressor", + "key": "ustumoursupressor", + "displayName": "table 3" + }, + { + "gene": "alltrue", + "key": "usalltrue", + "displayName": "table 3" + }, + { + "gene": "allfalse", + "key": "usallfalse", + "displayName": "table null" + } + ], + "copyVariants": [ + { + "gene": "table1CV", + "key": "TA", + "displayName": "table 1" + }, + { + "gene": "table2CV", + "key": "CR", + "displayName": "table 2" + } + ], + "expressionVariants": [ + { + "gene": "allfalse", + "key": "alltrueexp", + "displayName": "table null" + } + ], + "tmburMutationBurden": { + "key": "tmb", + "displayName": "table 2" + }, + "msi": [ + { + "score": 100, + "key": "msi", + "displayName": "table 2" + }, + { + "score": 15, + "key": "mss", + "displayName": "table null" + } + ] +} \ No newline at end of file From d80ce18c49c5bb10cda3a022f3388f2627e73e07 Mon Sep 17 00:00:00 2001 From: rpletz Date: Mon, 16 Oct 2023 15:33:23 -0700 Subject: [PATCH 2/3] Update tests for rapidReport filters --- test/routes/report/variants.test.js | 411 ++----------------------- test/testData/mockRapidReportData.json | 34 +- 2 files changed, 38 insertions(+), 407 deletions(-) diff --git a/test/routes/report/variants.test.js b/test/routes/report/variants.test.js index aeb5301c8..72a47cb83 100644 --- a/test/routes/report/variants.test.js +++ b/test/routes/report/variants.test.js @@ -4,7 +4,8 @@ const supertest = require('supertest'); const getPort = require('get-port'); const db = require('../../../app/models'); -const mockReportData = require('../../testData/mockReportData.json'); +const mockReportData = require('../../testData/mockRapidReportData.json'); +const createReport = require('../../../app/libs/createReport'); const CONFIG = require('../../../app/config'); const {listen} = require('../../../app'); @@ -30,8 +31,7 @@ const checkVariants = (variantsObject) => { const checkRapidReportMatches = ( variants, - expectedMatches, - unexpectedMatches, + expectedTable, ) => { let found = true; @@ -41,38 +41,27 @@ const checkRapidReportMatches = ( kbMatches = kbMatches.concat(variant.kbMatches); } - expectedMatches.forEach((expectedMatch) => { - if (!(kbMatches.find((kbMatch) => {return kbMatch.ident === expectedMatch.ident;}))) { + kbMatches.forEach((match) => { + if (!match.evidenceLevel === expectedTable) { found = false; } }); - unexpectedMatches.forEach((unexpectedMatch) => { - if (kbMatches.find((kbMatch) => {return kbMatch.ident === unexpectedMatch.ident;})) { - found = false; - } - }); expect(found).toBe(true); }; const checkVariantsFilter = ( variants, - expectedVariants, - unexpectedVariants, + expectedTable, ) => { let found = true; - expectedVariants.forEach((expectedVariant) => { - if (!(variants.find((variant) => {return variant.ident === expectedVariant.ident;}))) { + variants.forEach((variant) => { + if (!variant.displayName === expectedTable) { found = false; } }); - unexpectedVariants.forEach((unexpectedVariant) => { - if ((variants.find((variant) => {return variant.ident === unexpectedVariant.ident;}))) { - found = false; - } - }); expect(found).toBe(true); }; @@ -85,70 +74,10 @@ beforeAll(async () => { // Tests for /kb-matches endpoint describe('/reports/{REPORTID}/kb-matches', () => { - let rapidReport; - - let rapidGeneTA; - let rapidGeneCR; - let rapidGeneGeneric; - let rapidGeneUSOncogene; - let rapidGeneUStumourSuppressor; - let rapidGeneUSAllTrue; - let rapidGeneUSAllFalse; - - let rapidVariantTA; - let rapidVariantCR; - let rapidVariantTAGeneric; - let rapidVariantCRGeneric; - let rapidVariantUSOncogene; - let rapidVariantUStumourSuppressor; - let rapidVariantUSAllTrue; - let rapidVariantUSAllFalse; - let rapidVariantMsi; - let rapidVariantMss; - let rapidVariantTmb; - - let rapidDataIprA; - let rapidDataIprAGeneric; - let rapidDataIprB; - let rapidDataAlreadyReported; - let rapidDataIprANotTherapeuticMsi; - let rapidDataIprANotTherapeuticTmb; - let rapidDataIprANotTherapeutic; - let rapidDataTherapeuticIprC; - let rapidDataTherapeuticIprCGeneric; - let rapidDataUnknownIprC; - let rapidDataUnknownNull; - let rapidDataTherapeuticNull; - let rapidDataIprAMatchedCancerFalse; - let rapidDataExp; - - let kbMatchRapidDataIprA; - let kbMatchRapidDataIprAGeneric; - let kbMatchRapidDataIprB; - let kbMatchRapidDataIprANotTherapeutic; - let kbMatchRapidDataIprANotTherapeuticMsi; - let kbMatchRapidDataIprANotTherapeuticTmb; - let kbMatchRapidDataAlreadyReported; - let kbMatchRapidDataTherapeuticIprC; - let kbMatchRapidDataTherapeuticIprCGeneric; - let kbMatchRapidDataUnknownIprC; - let kbMatchRapidDataIprTherapeuticNull; - let kbMatchRapidDataIprUnknownNull; - let kbMatchRapidDataIprAMatchedCancerFalse; - let kbMatchRapidDataExp; - - let therapeuticAssociationMatches; - let cancerRelevanceMatches; - let unknownSignificanceMatches; - let excludedMatches; - - let therapeuticAssociationVariants; - let cancerRelevanceVariants; - let unknownSignificanceVariants; - let excludedVariants; + let rapidReportIdent; beforeAll(async () => { - // Get genomic template + // Get rapid template let rapidTemplate = await db.models.template.findOne({where: {name: 'rapid'}}); if (!rapidTemplate) { @@ -158,304 +87,13 @@ describe('/reports/{REPORTID}/kb-matches', () => { }); } - rapidReport = await db.models.report.create({ - templateId: rapidTemplate.id, - patientId: mockReportData.patientId, - }); - rapidGeneTA = await db.models.genes.create({ - reportId: rapidReport.id, - name: 'TA', - }); - rapidGeneCR = await db.models.genes.create({ - reportId: rapidReport.id, - name: 'CR', - }); - rapidGeneGeneric = await db.models.genes.create({ - reportId: rapidReport.id, - name: 'Generic', - oncogene: true, - tumourSuppressor: true, - }); - - rapidGeneUSOncogene = await db.models.genes.create({ - reportId: rapidReport.id, - name: 'US1', - oncogene: true, - tumourSuppressor: false, - }); - rapidGeneUStumourSuppressor = await db.models.genes.create({ - reportId: rapidReport.id, - name: 'US2', - oncogene: false, - tumourSuppressor: true, - }); - rapidGeneUSAllTrue = await db.models.genes.create({ - reportId: rapidReport.id, - name: 'US3', - oncogene: true, - tumourSuppressor: true, - }); - rapidGeneUSAllFalse = await db.models.genes.create({ - reportId: rapidReport.id, - name: 'US4', - oncogene: false, - tumourSuppressor: false, - }); - - rapidVariantTA = await db.models.copyVariants.create({ - reportId: rapidReport.id, - geneId: rapidGeneTA.id, - }); - rapidVariantCR = await db.models.copyVariants.create({ - reportId: rapidReport.id, - geneId: rapidGeneCR.id, - }); - - rapidVariantTAGeneric = await db.models.smallMutations.create({ - reportId: rapidReport.id, - geneId: rapidGeneGeneric.id, - }); - rapidVariantCRGeneric = await db.models.smallMutations.create({ - reportId: rapidReport.id, - geneId: rapidGeneGeneric.id, - }); - - rapidVariantUSOncogene = await db.models.smallMutations.create({ - reportId: rapidReport.id, - geneId: rapidGeneUSOncogene.id, - }); - rapidVariantUStumourSuppressor = await db.models.smallMutations.create({ - reportId: rapidReport.id, - geneId: rapidGeneUStumourSuppressor.id, - }); - rapidVariantUSAllTrue = await db.models.smallMutations.create({ - reportId: rapidReport.id, - geneId: rapidGeneUSAllTrue.id, - }); - rapidVariantUSAllFalse = await db.models.smallMutations.create({ - reportId: rapidReport.id, - geneId: rapidGeneUSAllFalse.id, - }); - - rapidVariantMsi = await db.models.msi.create({ - reportId: rapidReport.id, - score: 100.00, - }); - rapidVariantMss = await db.models.msi.create({ - reportId: rapidReport.id, - score: 15.00, - }); - rapidVariantTmb = await db.models.tmburMutationBurden.create({ - reportId: rapidReport.id, - }); - - rapidDataIprA = { - reportId: rapidReport.id, - variantId: rapidVariantTA.id, - category: 'therapeutic', - variantType: 'cnv', - iprEvidenceLevel: 'IPR-A', - kbVariant: 'this should be in table 1', - matchedCancer: true, - }; - - rapidDataIprB = { - reportId: rapidReport.id, - variantId: rapidVariantTA.id, - category: 'therapeutic', - variantType: 'cnv', - iprEvidenceLevel: 'IPR-B', - matchedCancer: true, - kbVariant: 'thisshouldbeintable1', - }; - - rapidDataAlreadyReported = { - reportId: rapidReport.id, - variantId: rapidVariantTA.id, - category: 'unknown', - variantType: 'cnv', - iprEvidenceLevel: 'IPR-A', - kbVariant: 'geneX specific mutation', - }; - - rapidDataIprANotTherapeutic = { - reportId: rapidReport.id, - variantId: rapidVariantCR.id, - category: 'unknown', - variantType: 'cnv', - iprEvidenceLevel: 'IPR-A', - kbVariant: 'this.should.be:table2', - }; - - rapidDataIprANotTherapeuticMsi = { - reportId: rapidReport.id, - variantId: rapidVariantMsi.id, - category: 'unknown', - variantType: 'msi', - iprEvidenceLevel: 'IPR-A', - kbVariant: 'also should be table 2', - }; - - rapidDataIprANotTherapeuticTmb = { - reportId: rapidReport.id, - variantId: rapidVariantTmb.id, - category: 'unknown', - variantType: 'tmb', - iprEvidenceLevel: 'IPR-A', - kbVariant: 'geneX specific mutation', - }; - - rapidDataTherapeuticIprC = { - reportId: rapidReport.id, - variantId: rapidVariantCR.id, - category: 'therapeutic', - variantType: 'cnv', - iprEvidenceLevel: 'IPR-C', - kbVariant: 'table2 specific mutation', - }; - - rapidDataUnknownIprC = { - reportId: rapidReport.id, - variantId: rapidVariantCR.id, - category: 'unknown', - variantType: 'cnv', - iprEvidenceLevel: 'IPR-C', - kbVariant: 'geneX specific mutation', - }; - - rapidDataUnknownNull = { - reportId: rapidReport.id, - variantId: rapidVariantCR.id, - category: 'unknown', - variantType: 'cnv', - iprEvidenceLevel: null, - kbVariant: 'geneX specific mutation', - }; - - rapidDataTherapeuticNull = { - reportId: rapidReport.id, - variantId: rapidVariantCR.id, - category: 'therapeutic', - variantType: 'cnv', - iprEvidenceLevel: null, - kbVariant: 'geneX specific mutation', - }; - - rapidDataIprAMatchedCancerFalse = { - reportId: rapidReport.id, - variantId: rapidVariantCR.id, - category: 'therapeutic', - variantType: 'cnv', - iprEvidenceLevel: 'IPR-A', - matchedCancer: false, - kbVariant: 'geneX specific mutation', - }; - - rapidDataExp = { - reportId: rapidReport.id, - variantId: rapidVariantCR.id, - category: 'therapeutic', - variantType: 'exp', - iprEvidenceLevel: 'IPR-A', - matchedCancer: true, - kbVariant: 'geneX specific mutation', - }; - - rapidDataIprAGeneric = { - reportId: rapidReport.id, - variantId: rapidVariantTAGeneric.id, - category: 'therapeutic', - variantType: 'mut', - iprEvidenceLevel: 'IPR-A', - kbVariant: 'geneX missense', - matchedCancer: true, - }; - - rapidDataTherapeuticIprCGeneric = { - reportId: rapidReport.id, - variantId: rapidVariantCRGeneric.id, - category: 'therapeutic', - variantType: 'mut', - iprEvidenceLevel: 'IPR-C', - kbVariant: 'geneX mutation', - }; - - kbMatchRapidDataIprA = await db.models.kbMatches.create(rapidDataIprA); - kbMatchRapidDataIprB = await db.models.kbMatches.create(rapidDataIprB); - kbMatchRapidDataIprANotTherapeutic = await db.models.kbMatches.create( - rapidDataIprANotTherapeutic, - ); - kbMatchRapidDataIprANotTherapeuticMsi = await db.models.kbMatches.create( - rapidDataIprANotTherapeuticMsi, - ); - kbMatchRapidDataIprANotTherapeuticTmb = await db.models.kbMatches.create( - rapidDataIprANotTherapeuticTmb, - ); - kbMatchRapidDataAlreadyReported = await db.models.kbMatches.create( - rapidDataAlreadyReported, - ); - kbMatchRapidDataTherapeuticIprC = await db.models.kbMatches.create(rapidDataTherapeuticIprC); - kbMatchRapidDataUnknownIprC = await db.models.kbMatches.create(rapidDataUnknownIprC); - - kbMatchRapidDataIprTherapeuticNull = await db.models.kbMatches.create(rapidDataTherapeuticNull); - kbMatchRapidDataIprUnknownNull = await db.models.kbMatches.create(rapidDataUnknownNull); - - kbMatchRapidDataIprAMatchedCancerFalse = await - db.models.kbMatches.create(rapidDataIprAMatchedCancerFalse); - - kbMatchRapidDataExp = await - db.models.kbMatches.create(rapidDataExp); - - kbMatchRapidDataIprAGeneric = await db.models.kbMatches.create(rapidDataIprAGeneric); - kbMatchRapidDataTherapeuticIprCGeneric = await db.models.kbMatches.create( - rapidDataTherapeuticIprCGeneric, - ); - - therapeuticAssociationMatches = [ - kbMatchRapidDataIprA, - kbMatchRapidDataIprB, - ]; - cancerRelevanceMatches = [ - kbMatchRapidDataIprANotTherapeutic, - kbMatchRapidDataTherapeuticIprC, - kbMatchRapidDataUnknownIprC, - kbMatchRapidDataIprTherapeuticNull, - kbMatchRapidDataIprUnknownNull, - kbMatchRapidDataIprAMatchedCancerFalse, - kbMatchRapidDataIprANotTherapeuticMsi, - kbMatchRapidDataIprANotTherapeuticTmb, - ]; - unknownSignificanceMatches = [ - kbMatchRapidDataIprAGeneric, - kbMatchRapidDataTherapeuticIprCGeneric, - ]; - excludedMatches = [ - kbMatchRapidDataExp, - kbMatchRapidDataAlreadyReported, - ]; - - therapeuticAssociationVariants = [ - rapidVariantTA, - ]; - cancerRelevanceVariants = [ - rapidVariantCR, - rapidVariantMsi, - rapidVariantTmb, - ]; - unknownSignificanceVariants = [ - rapidVariantUSOncogene, - rapidVariantUStumourSuppressor, - rapidVariantUSAllTrue, - rapidVariantTAGeneric, - rapidVariantCRGeneric, - ]; - excludedVariants = [rapidVariantUSAllFalse, rapidVariantMss]; + rapidReportIdent = await createReport(mockReportData); }, LONGER_TIMEOUT); describe('GET', () => { test('Getting Therapeutic Association - OK', async () => { const res = await request - .get(`/api/reports/${rapidReport.ident}/variants`) + .get(`/api/reports/${rapidReportIdent}/variants`) .query({rapidTable: 'therapeuticAssociation'}) .auth(username, password) .type('json') @@ -466,19 +104,17 @@ describe('/reports/{REPORTID}/kb-matches', () => { checkVariantsFilter( res.body, - therapeuticAssociationVariants, - [...cancerRelevanceVariants, ...excludedVariants, ...unknownSignificanceVariants], + 'table 1', ); checkRapidReportMatches( res.body, - therapeuticAssociationMatches, - [...cancerRelevanceMatches, ...excludedMatches], + 'table 1', ); }); test('Getting Cancer Relevance - OK', async () => { const res = await request - .get(`/api/reports/${rapidReport.ident}/variants`) + .get(`/api/reports/${rapidReportIdent}/variants`) .query({rapidTable: 'cancerRelevance'}) .auth(username, password) .type('json') @@ -489,19 +125,17 @@ describe('/reports/{REPORTID}/kb-matches', () => { checkVariantsFilter( res.body, - cancerRelevanceVariants, - [...therapeuticAssociationVariants, ...excludedVariants, ...unknownSignificanceVariants], + 'table 2', ); checkRapidReportMatches( res.body, - cancerRelevanceMatches, - [...therapeuticAssociationMatches, ...excludedMatches, ...unknownSignificanceVariants], + 'table 2', ); }); test('Getting Unknown Significance - OK', async () => { const res = await request - .get(`/api/reports/${rapidReport.ident}/variants`) + .get(`/api/reports/${rapidReportIdent}/variants`) .query({rapidTable: 'unknownSignificance'}) .auth(username, password) .type('json') @@ -512,21 +146,18 @@ describe('/reports/{REPORTID}/kb-matches', () => { checkVariantsFilter( res.body, - unknownSignificanceVariants, - [...therapeuticAssociationVariants, ...excludedVariants, ...cancerRelevanceVariants], + 'table 3', ); - checkRapidReportMatches( res.body, - unknownSignificanceMatches, - [...therapeuticAssociationMatches, ...excludedMatches, cancerRelevanceMatches], + 'table 3', ); }); }); // delete report afterAll(async () => { - await db.models.report.destroy({where: {id: rapidReport.id}, force: true}); + // await db.models.report.destroy({where: {ident: rapidReportIdent}, force: true}); }, LONGER_TIMEOUT); }); diff --git a/test/testData/mockRapidReportData.json b/test/testData/mockRapidReportData.json index 05ea0d769..45a473daa 100644 --- a/test/testData/mockRapidReportData.json +++ b/test/testData/mockRapidReportData.json @@ -21,14 +21,6 @@ "matchedCancer": true, "evidenceLevel": "table 1" }, - { - "category": "unknown", - "variantType": "cnv", - "variant": "TA", - "iprEvidenceLevel": "IPR-A", - "kbVariant": "geneX specific mutation 1", - "evidenceLevel": "table null" - }, { "category": "unknown", "variantType": "cnv", @@ -94,15 +86,6 @@ "matchedCancer": false, "evidenceLevel": "table 2" }, - { - "category": "therapeutic", - "variantType": "exp", - "variant": "alltrueexp", - "iprEvidenceLevel": "IPR-A", - "kbVariant": "geneX specific mutation 7", - "matchedCancer": true, - "evidenceLevel": "table null" - }, { "category": "therapeutic", "variantType": "mut", @@ -119,6 +102,23 @@ "iprEvidenceLevel": "IPR-C", "kbVariant": "geneX mutation", "evidenceLevel": "table 3" + }, + { + "category": "unknown", + "variantType": "cnv", + "variant": "TA", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "geneX specific mutation 1", + "evidenceLevel": "table null" + }, + { + "category": "therapeutic", + "variantType": "exp", + "variant": "alltrueexp", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "geneX specific mutation 7", + "matchedCancer": true, + "evidenceLevel": "table null" } ], "genes": [ From fba2ec93c8b998ca2e207778c302efbc349dee53 Mon Sep 17 00:00:00 2001 From: rpletz Date: Tue, 17 Oct 2023 15:06:25 -0700 Subject: [PATCH 3/3] Update filters for rapid report --- app/routes/report/variants.js | 9 ++++++ test/routes/report/variants.test.js | 4 +-- test/testData/mockRapidReportData.json | 41 ++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/app/routes/report/variants.js b/app/routes/report/variants.js index 46b6b73a1..6439dc30c 100644 --- a/app/routes/report/variants.js +++ b/app/routes/report/variants.js @@ -40,6 +40,15 @@ const therapeuticAssociationFilter = { {[Op.is]: literal('distinct from \'msi\'')}, {[Op.is]: literal('distinct from \'tmb\'')}, ]}, + [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}}, diff --git a/test/routes/report/variants.test.js b/test/routes/report/variants.test.js index 72a47cb83..fa86eb8e1 100644 --- a/test/routes/report/variants.test.js +++ b/test/routes/report/variants.test.js @@ -42,7 +42,7 @@ const checkRapidReportMatches = ( } kbMatches.forEach((match) => { - if (!match.evidenceLevel === expectedTable) { + if (!(match.evidenceLevel === expectedTable)) { found = false; } }); @@ -57,7 +57,7 @@ const checkVariantsFilter = ( let found = true; variants.forEach((variant) => { - if (!variant.displayName === expectedTable) { + if (!(variant.displayName === expectedTable)) { found = false; } }); diff --git a/test/testData/mockRapidReportData.json b/test/testData/mockRapidReportData.json index 45a473daa..fffee74ff 100644 --- a/test/testData/mockRapidReportData.json +++ b/test/testData/mockRapidReportData.json @@ -10,6 +10,17 @@ "iprEvidenceLevel": "IPR-A", "kbVariant": "this should be in table 1", "matchedCancer": true, + "relevance": "sensitivity", + "evidenceLevel": "table 1" + }, + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "TA", + "iprEvidenceLevel": "IPR-B", + "kbVariant": "this should be in table 1", + "matchedCancer": true, + "relevance": "resistance", "evidenceLevel": "table 1" }, { @@ -19,8 +30,38 @@ "iprEvidenceLevel": "IPR-B", "kbVariant": "thisshouldbeintable1", "matchedCancer": true, + "relevance": "sensitivity", "evidenceLevel": "table 1" }, + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "TA", + "iprEvidenceLevel": "IPR-B", + "kbVariant": "thisshouldbeintable2", + "matchedCancer": true, + "relevance": "resistance", + "evidenceLevel": "table 2" + }, + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "TA", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "this should be in table 2", + "matchedCancer": true, + "relevance": "no sensitivity", + "evidenceLevel": "table 2" + }, + { + "category": "therapeutic", + "variantType": "cnv", + "variant": "TA", + "iprEvidenceLevel": "IPR-A", + "kbVariant": "this should be in table 2", + "matchedCancer": true, + "evidenceLevel": "table 2" + }, { "category": "unknown", "variantType": "cnv",