Skip to content

Commit

Permalink
Merge pull request #213 from bcgsc/release/v7.11.1
Browse files Browse the repository at this point in the history
Release/v7.11.1
  • Loading branch information
Nithriel authored Nov 26, 2022
2 parents 1074c4c + ac1c729 commit dfff510
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/routes/report/kbMatches.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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({
Expand Down
Binary file added ipr_demodb.postgres.dump
Binary file not shown.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -60,4 +60,4 @@
"jsdoc": "^3.6.10",
"supertest": "^6.2.3"
}
}
}
40 changes: 37 additions & 3 deletions test/routes/report/kbMatches.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;}))) {
Expand Down Expand Up @@ -75,6 +81,7 @@ describe('/reports/{REPORTID}/kb-matches', () => {
let rapidDataUnknownNull;
let rapidDataTherapeuticNull;
let rapidDataIprAMatchedCancerFalse;
let rapidDataExp;

let kbMatchRapidDataIprA;
let kbMatchRapidDataIprB;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -228,6 +249,9 @@ describe('/reports/{REPORTID}/kb-matches', () => {
kbMatchRapidDataIprUnknownNull,
kbMatchRapidDataIprAMatchedCancerFalse,
];
excludedMatches = [
kbMatchRapidDataExp,
];
}, LONGER_TIMEOUT);

describe('GET', () => {
Expand Down Expand Up @@ -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 () => {
Expand All @@ -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,
);
});
});

Expand Down

0 comments on commit dfff510

Please sign in to comment.