diff --git a/app/routes/report/kbMatches.js b/app/routes/report/kbMatches.js index 0e3321147..e96e0af73 100644 --- a/app/routes/report/kbMatches.js +++ b/app/routes/report/kbMatches.js @@ -80,6 +80,7 @@ router.route('/') [Op.or]: [{iprEvidenceLevel: ['IPR-A', 'IPR-B']}], category: 'therapeutic', matchedCancer: true, + variantType: {[Op.is]: literal('distinct from \'exp\'')}, }; // PSQL natively ignores null on equal checks. @@ -93,6 +94,7 @@ router.route('/') category: 'therapeutic', matchedCancer: true, }, + variantType: {[Op.is]: literal('distinct from \'exp\'')}, }; const results = await db.models.kbMatches.scope('public').findAll({ diff --git a/ipr_demodb.postgres.dump b/ipr_demodb.postgres.dump new file mode 100644 index 000000000..09051e44a Binary files /dev/null and b/ipr_demodb.postgres.dump differ diff --git a/package-lock.json b/package-lock.json index 892a89a76..e87a3eaab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ipr-api", - "version": "7.10.0", + "version": "7.11.1", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index bf24c19a3..4beb8b06a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "ipr-api", - "version": "7.11.0", + "version": "7.11.1", "description": "Integrated Pipeline Reports API", "main": "bin/server.js", "scripts": { @@ -60,4 +60,4 @@ "jsdoc": "^3.6.10", "supertest": "^6.2.3" } -} +} \ No newline at end of file diff --git a/test/routes/report/kbMatches.test.js b/test/routes/report/kbMatches.test.js index 4b6c3d889..d1509c8c7 100644 --- a/test/routes/report/kbMatches.test.js +++ b/test/routes/report/kbMatches.test.js @@ -32,8 +32,14 @@ const checkKbMatch = (kbMatchObject) => { expect(kbMatchObject.variant).toHaveProperty('ident'); }; -const checkRapidReportMatches = (kbMatches, expectedMatches, unexpectedMatches) => { +const checkRapidReportMatches = ( + kbMatches, + expectedMatches, + unexpectedMatches, + excludedMatches, +) => { let found = true; + unexpectedMatches = [...unexpectedMatches, ...excludedMatches]; expectedMatches.forEach((expectedMatch) => { if (!(kbMatches.find((kbMatch) => {return kbMatch.ident === expectedMatch.ident;}))) { @@ -75,6 +81,7 @@ describe('/reports/{REPORTID}/kb-matches', () => { let rapidDataUnknownNull; let rapidDataTherapeuticNull; let rapidDataIprAMatchedCancerFalse; + let rapidDataExp; let kbMatchRapidDataIprA; let kbMatchRapidDataIprB; @@ -84,9 +91,11 @@ describe('/reports/{REPORTID}/kb-matches', () => { let kbMatchRapidDataIprTherapeuticNull; let kbMatchRapidDataIprUnknownNull; let kbMatchRapidDataIprAMatchedCancerFalse; + let kbMatchRapidDataExp; let therapeuticAssociationMatches; let cancerRelevanceMatches; + let excludedMatches; beforeAll(async () => { // Get genomic template @@ -201,6 +210,15 @@ describe('/reports/{REPORTID}/kb-matches', () => { matchedCancer: false, }; + rapidDataExp = { + reportId: rapidReport.id, + variantId: rapidVariant.id, + category: 'therapeutic', + variantType: 'exp', + iprEvidenceLevel: 'IPR-A', + matchedCancer: true, + }; + kbMatch = await db.models.kbMatches.create(createData); kbMatchRapidDataIprA = await db.models.kbMatches.create(rapidDataIprA); kbMatchRapidDataIprB = await db.models.kbMatches.create(rapidDataIprB); @@ -216,6 +234,9 @@ describe('/reports/{REPORTID}/kb-matches', () => { kbMatchRapidDataIprAMatchedCancerFalse = await db.models.kbMatches.create(rapidDataIprAMatchedCancerFalse); + kbMatchRapidDataExp = await + db.models.kbMatches.create(rapidDataExp); + therapeuticAssociationMatches = [ kbMatchRapidDataIprA, kbMatchRapidDataIprB, @@ -228,6 +249,9 @@ describe('/reports/{REPORTID}/kb-matches', () => { kbMatchRapidDataIprUnknownNull, kbMatchRapidDataIprAMatchedCancerFalse, ]; + excludedMatches = [ + kbMatchRapidDataExp, + ]; }, LONGER_TIMEOUT); describe('GET', () => { @@ -265,7 +289,12 @@ describe('/reports/{REPORTID}/kb-matches', () => { expect(Array.isArray(res.body)).toBe(true); checkKbMatch(res.body[0]); - checkRapidReportMatches(res.body, therapeuticAssociationMatches, cancerRelevanceMatches); + checkRapidReportMatches( + res.body, + therapeuticAssociationMatches, + cancerRelevanceMatches, + excludedMatches, + ); }); test('Getting Cancer Relevance - OK', async () => { @@ -279,7 +308,12 @@ describe('/reports/{REPORTID}/kb-matches', () => { expect(Array.isArray(res.body)).toBe(true); checkKbMatch(res.body[0]); - checkRapidReportMatches(res.body, cancerRelevanceMatches, therapeuticAssociationMatches); + checkRapidReportMatches( + res.body, + cancerRelevanceMatches, + therapeuticAssociationMatches, + excludedMatches, + ); }); });