Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/DEVSU-2524-reorder-graphkb-evidenc…
Browse files Browse the repository at this point in the history
…e-levels
  • Loading branch information
bnguyen-bcgsc authored Nov 25, 2024
2 parents c09c0d0 + f0d452f commit 6075fd9
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/libs/createReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ const createReportKbMatchSection = async (reportId, modelName, sectionContent, o
variantType: record.variantType,
variantId: record.variantId,
kbVariant: record.kbVariant,
kbVariantId: record.kbVariantId,
};

const statementCopy = {...record};
delete statementCopy.variantType;
delete statementCopy.variantId;
delete statementCopy.kbVariant;
delete statementCopy.kbVariantId;
statementData = [{...statementCopy}];
}

Expand Down
2 changes: 1 addition & 1 deletion app/libs/getUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const getUser = async (req, res) => {
}
// Check for IPR access
if (!decoded.realm_access.roles.includes(nconf.get('keycloak:role'))) {
return res.status(HTTP_STATUS.FORBIDDEN).json({message: 'IPR Access Error'});
return res.status(HTTP_STATUS.FORBIDDEN).json({message: 'IPR Access Error: Keycloak role missing'});
}
const username = decoded.preferred_username;
const expiry = decoded.exp;
Expand Down
10 changes: 10 additions & 0 deletions app/models/reports/kbMatchJoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ module.exports = (sequelize, Sq) => {
},
},
},
indexes: [
{
name: 'idx_kb_match_id_join',
fields: ['kb_match_id'],
},
{
name: 'idx_kb_matched_statement_id_join',
fields: ['kb_matched_statement_id'],
},
],
},
);
};
2 changes: 1 addition & 1 deletion app/models/reports/mutationBurden.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module.exports = (sequelize, Sq) => {
name: 'svBurdenHidden',
field: 'sv_burden_hidden',
type: Sq.BOOLEAN,
defaultValue: false,
defaultValue: true,
allowNull: false,
jsonSchema: {
description: 'SV Burden Hidden',
Expand Down
5 changes: 5 additions & 0 deletions app/models/reports/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ module.exports = (sequelize, Sq) => {
field: 'hrdetect_score',
type: Sq.FLOAT,
},
intersectTmbScore: {
name: 'intersectTmbScore',
field: 'intersect_tmb_score',
type: Sq.FLOAT,
},
alternateIdentifier: {
name: 'alternateIdentifier',
field: 'alternate_identifier',
Expand Down
4 changes: 4 additions & 0 deletions app/routes/variantText/variantText.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ router.route('/')
delete req.body.project;
delete req.body.template;

if (typeof req.body.cancerType === 'string') {
req.body.cancerType = [req.body.cancerType];
}

await validateAgainstSchema(createSchema, req.body);
} catch (error) {
const message = `Error while validating variant text create request ${error}`;
Expand Down
1 change: 1 addition & 0 deletions app/schemas/report/reportUpload/kbMatches.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = (isJsonSchema) => {
type: 'array', description: 'kbMatched statement object',
},
category: {type: 'string', description: 'legacy kbMatch loading'},
approvedTherapy: {type: 'boolean', description: 'legacy kbMatch loading'},
disease: {type: 'string', description: 'legacy kbMatch loading'},
relevance: {type: 'string', description: 'legacy kbMatch loading'},
context: {type: 'string', description: 'legacy kbMatch loading'},
Expand Down
20 changes: 20 additions & 0 deletions migrations/20241106215517-DEVSU-2462-new-report-field.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const TABLE = 'reports';

module.exports = {
async up(queryInterface, Sq) {
return queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
TABLE,
'intersect_tmb_score',
{
type: Sq.FLOAT,
},
{transaction},
);
});
},

async down() {
throw new Error('Not Implemented!');
},
};
22 changes: 22 additions & 0 deletions migrations/20241107001943-DEVSU-2473-default-hidesvburden-true.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const TABLE = 'reports_mutation_burden';

module.exports = {
async up(queryInterface, Sq) {
return queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.changeColumn(
TABLE,
'sv_burden_hidden',
{
type: Sq.BOOLEAN,
defaultValue: true,
allowNull: false,
},
{transaction},
);
});
},

async down() {
throw new Error('Not Implemented!');
},
};
10 changes: 10 additions & 0 deletions migrations/20241112210700-DEVSU-2457-fix-id-sequence.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
up: async (queryInterface) => {
// eslint-disable-next-line max-len
queryInterface.sequelize.query('SELECT setval(\'reports_kb_matches_id_seq\', (SELECT MAX(id) FROM reports_kb_matches) + 1);');
},

down: async () => {
throw new Error('Not Implemented!');
},
};
14 changes: 14 additions & 0 deletions migrations/20241112211455-DEVSU-2483-add-kb-match-index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
up: async (queryInterface) => {
await queryInterface.addIndex('reports_kb_match_join', ['kb_match_id'], {
name: 'idx_kb_match_id_join',
});
await queryInterface.addIndex('reports_kb_match_join', ['kb_matched_statement_id'], {
name: 'idx_kb_matched_statement_id_join',
});
},

down: async () => {
throw new Error('Not Implemented!');
},
};
1 change: 1 addition & 0 deletions test/routes/report/report.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const checkReport = (report) => {
'biopsyDate', 'biopsyName', 'presentationDate', 'kbDiseaseMatch',
'kbUrl', 'pediatricIds', 'captiv8Score', 'appendix', 'hrdetectScore',
'legacyReportFilepath', 'legacyPresentationFilepath', 'signatures',
'intersectTmbScore',
].forEach((element) => {
expect(report).toHaveProperty(element);
});
Expand Down
1 change: 1 addition & 0 deletions test/routes/report/reportAsync.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const checkReport = (report) => {
'state', 'expression_matrix', 'alternateIdentifier', 'ageOfConsent',
'biopsyDate', 'biopsyName', 'presentationDate', 'kbDiseaseMatch',
'kbUrl', 'pediatricIds', 'captiv8Score', 'hrdetectScore', 'appendix',
'intersectTmbScore',
].forEach((element) => {
expect(report).toHaveProperty(element);
});
Expand Down
6 changes: 3 additions & 3 deletions test/routes/report/signatureVariants.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('/reports/{REPORTID}/sigv', () => {
});

afterEach(async () => {
await db.models.signatureVariants.destroy({where: {ident: sigvUpdate.ident}, force: true});
await db.models.signatureVariants.destroy({where: {ident: sigvUpdate.ident}});
});

test('/{sigv} - 200 Success', async () => {
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('/reports/{REPORTID}/sigv', () => {
});

afterEach(async () => {
await db.models.signatureVariants.destroy({where: {ident: sigvDelete.ident}, force: true});
await db.models.signatureVariants.destroy({where: {ident: sigvDelete.ident}});
});

test('/{sigv} - 204 No content', async () => {
Expand Down Expand Up @@ -201,7 +201,7 @@ describe('/reports/{REPORTID}/sigv', () => {
afterAll(async () => {
// delete newly created report and all of it's components
// indirectly by hard deleting newly created patient
report.destroy({force: true});
report.destroy();
});
});

Expand Down
5 changes: 4 additions & 1 deletion test/testData/mockReportData.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"template": "genomic",
"captiv8Score": 20,
"hrdetectScore": 10.5,
"intersectTmbScore": 9.75,
"appendix": "this is an example of an appendix",
"sampleInfo": [
{
Expand Down Expand Up @@ -255,6 +256,7 @@
"variantType": "exp",
"variant": "hash12345678",
"kbVariant": "protein increased expression",
"kbVariantId": "123321",
"category": "cancer predisposition",
"disease": "colorectal cancer",
"relevance": "unfavourable",
Expand All @@ -268,7 +270,8 @@
"kbStatementId": "prognostic_unfavourable_lower overall survival_(ELV-PROT_ZNF703_increased expression,True,ns)_colorectal cancer_reported_pubmed_25017610",
"externalSource": "CIViC",
"externalStatementId": "1234",
"reviewStatus": "pending"
"reviewStatus": "pending",
"approvedTherapy": true
},
{
"variantType": "msi",
Expand Down

0 comments on commit 6075fd9

Please sign in to comment.