From 3c771fc15d65d628b5b6e82b6810b74b1d56f30f Mon Sep 17 00:00:00 2001 From: Hongxin Date: Thu, 15 Jun 2023 11:22:14 -0400 Subject: [PATCH] Remove sendEmail method (#155) * Remove sendEmail method Use sentry to capture exception instead. --- README.md | 6 - app/index.html | 1 - app/scripts/app.spec.js | 414 --------------------- app/scripts/controllers/drugs.js | 1 - app/scripts/controllers/emailDialogCtrl.js | 16 - app/scripts/controllers/gene.js | 13 +- app/scripts/controllers/genes.js | 1 - app/scripts/controllers/nav.js | 3 +- app/scripts/directives/createnewdrug.js | 1 - app/scripts/directives/curationQueue.js | 77 ---- app/scripts/factories/VariantFactory.js | 21 -- app/scripts/services/databaseconnector.js | 53 +-- app/scripts/services/mainutils.js | 46 --- app/scripts/services/mainutils.spec.js | 50 +-- app/views/curationQueue.html | 3 - 15 files changed, 34 insertions(+), 672 deletions(-) delete mode 100644 app/scripts/app.spec.js delete mode 100644 app/scripts/controllers/emailDialogCtrl.js diff --git a/README.md b/README.md index a7ebef4..be2caea 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,6 @@ For example, if concokb-core runs at `http://localhost:8888/oncokb`, you should ... ``` -## Testing -For front-end, we use Karma and Jasmin to run unit test cases. -1. Install karma-cli (globally). -2. Copy /app/data/config.json to **OncoKB.config** in /app/scripts/app.spec.js. -3. Run **karma start** at root folder. - ## FAQs #### Can’t getAllUsers() because of the different rules set in Firebase. It still shows 'don’t have access...' after logging in successfully. Add rules to the database. diff --git a/app/index.html b/app/index.html index fef2b73..1544d00 100644 --- a/app/index.html +++ b/app/index.html @@ -199,7 +199,6 @@ - diff --git a/app/scripts/app.spec.js b/app/scripts/app.spec.js deleted file mode 100644 index 97d48f2..0000000 --- a/app/scripts/app.spec.js +++ /dev/null @@ -1,414 +0,0 @@ -'use strict'; -/** - * @ngdoc overview - * @name oncokb - * @description - * # oncokb - * - * Main module of the application. - */ -var OncoKB = { - global: {}, - config: {}, - backingUp: false, - gene: { - "background": "AKT1 is a serine/threonine protein kinase that is a critical downstream effector in the PI3K (phosphoinositide 3-kinase) signaling pathway. Following activation of PI3K, cytosolic inactive AKT1 is recruited to the membrane and engages PIP3 (PtdIns3,4,5-P3), leading to phosphorylation and activation of AKT1 (PMID: 28431241). AKT1 can activate a number of downstream substrates, including GSK3, FOXO and mTORC1, which are critical for cellular survival, proliferation, and metabolism (PMID: 9843996, 7611497). Negative regulation of AKT1 occurs when PI3K signaling is terminated by PTEN phosphatase activity (PMID: 28431241). AKT1 is frequently activated in cancers, typically through activation of the PI3K pathway or by inactivation of PTEN (PMID: 28431241). Activating mutations in AKT1 (PMID: 17611497, 23134728, 20440266) and infrequent AKT1 gene amplification (PMID: 18767981) have been identified in human cancers, which allow for phosphoinositide-independent AKT1 activation. The ATP-competitive AKT1 inhibitor AZD5363 has demonstrated activity in patients with AKT1-mutant cancers (PMID: 28489509). Negative feedback mechanisms can mediate AKT-inhibitor resistance in human cancers with dysregulated AKT signaling (PMID: 29535262, 29339542).", - "background_review": { - "lastReviewed": "", - "updateTime": 1524594735169, - "updatedBy": "Moriah Nissan" - }, - "background_uuid": "82d247bc-2178-4273-96c2-ce7b6ca9ea15", - "dmp_refseq_id": "NM_001014431.1", - "isoform_override": "ENST00000349310", - "mutations": [{ - "mutation_effect": { - "description": "The AKT1 E17K mutation is located within the protein's pleckstrin homology domain (PMID: 17611497, 20440266). This mutation alters the lipid binding specificity of AKT1, allowing P13K-independent constitutive membrane localization and deregulated activation of AKT1 (PMID: 17611497, 18256540, 9843996). In vitro, AKT1 E17K alone was unable to support growth-factor independent growth of BaF3 pro-B cells (PMID: 23134728). However, co-expression of AKT1 E17K with an activated form of MEK1 promoted factor-independent growth in vitro, and promoted massive growth of subcutaneously implanted tumors in mice; this suggests cooperation between AKT1 and MEK in oncogenic activation (PMID: 23134728). In addition, the E17K mutation partially disrupts inhibitory interactions between the pleckstrin homology domain (PHD) and the kinase domain (KD) (PMID: 23134728). Expression of the mutant in cells causes increased signaling to AKT substrates and cell transformation (PMID: 17611497, 23134728, 23741320). AKT1 E17K mutations have also been identified in the tissue overgrowth Proteus syndrome (PMID: 21793738).", - "description_review": { - "updateTime": 1493325255069 - }, - "description_uuid": "83b8a796-0f4b-4555-96ae-809d2aa45d62", - "effect": "Gain-of-function", - "effect_review": { - "updateTime": 1493325255069 - }, - "effect_uuid": "d9043ef0-6106-4951-af64-f934d00041c7", - "oncogenic": "Yes", - "oncogenic_review": { - "updateTime": 1490821090000, - "updatedBy": "Debyani Chakravarty" - }, - "oncogenic_uuid": "ef3e7a30-73e5-41b0-8b3e-f9f08b92c50a", - "short": "" - }, - "mutation_effect_comments": [{ - "content": "taken from 3A clinical summaries sheet", - "date": "1473355244883", - "email": "moriah.heller@gmail.com", - "resolved": "false", - "userName": "Moriah Nissan" - }, { - "content": "While there are no FDA-approved or NCCN-compendium listed treatments specifically for patients with breast cancer harboring the AKT1 E17K mutation, there is compelling clinical and preclinical data supporting the use of AKT-inhibitors in this patient population. In multiple phase I clinical studies patients with solid tumors harboring activating AKT1 mutations achieved clinical benefit following treatment with an orally available, ATP-competitive pan-AKT inhibitor and independent preclinical studies have biologically characterized this mutant to be associated with sensitivity to AKT-targeted inhibitors, as evidenced by target and consequent pathway inhibition upon drug treatment.", - "date": "1490821094497", - "email": "debyani.c@gmail.com", - "resolved": "false", - "userName": "Debyani Chakravarty" - }], - "mutation_effect_uuid": "91d73a66-0a4b-472e-8b6a-95e87e4e5520", - "name": "E17K", - "name_review": { - "updateTime": 1493325255069 - }, - "name_uuid": "606c509a-c9f4-4541-8b93-58491e6ba8eb", - "tumors": [{ - "TIs": [{ - "name": "Standard implications for sensitivity to therapy", - "name_uuid": "a441a693-f5be-4abb-b634-d36529b4862d", - "type": "SS" - }, { - "name": "Standard implications for resistance to therapy", - "name_uuid": "05e34064-376f-4745-bf17-ca3e01f24ed1", - "type": "SR" - }, { - "name": "Investigational implications for sensitivity to therapy", - "name_uuid": "b7c07f98-47fa-4a80-b72b-d496c97929d8", - "treatments": [{ - "description": "AZD5363 is an orally available, ATP-competitive pan-AKT inhibitor that targets the PI3K/AKT/mTOR signaling pathway (PMID: 23394218). In a Phase I basket study of AZD5363 in AKT E17K-mutated cancers, AZD5363 treatment induced target lesion regression in fifteen of twenty evaluable patients with breast cancer, including four RECIST partial responses, with a median progression-free survival of 5.5 months (PMID: 28489509). In a second Phase I study of 41 patients with solid tumors in Japan, two patients with the AKT E17K mutation, one having breast cancer and the other having ovarian cancer, had partial responses to AZD5363 (PMID: 26351323). In vitro studies of breast cancer explants harboring the AKT E17K mutation have shown that AZD5363 inhibits tumor growth and reduces signaling downstream of AKT, including reduced phosphorylation of PRAS40 and S6 (PMID: 22294718).", - "description_review": { - "updateTime": 1517434586075, - "updatedBy": "Moriah Nissan" - }, - "description_uuid": "4aedd549-8199-4790-9532-35bcf94e7302", - "indication": "", - "indication_review": { - "updateTime": 1493325255069 - }, - "indication_uuid": "95694ac1-4d1a-443b-af3a-2f5912137955", - "level": "3A", - "level_review": { - "updateTime": 1493325255069 - }, - "level_uuid": "49fd8572-55aa-4b12-afe4-6672e4ac9399", - "fdaLevel": "Fda2", - "fdaLevel_review": { - "updateTime": 1493325255069 - }, - "fdaLevel_uuid": "ad61ee62-a655-4d3c-b278-b3c6e9e9120c", - "name": "AZD5363", - "name_comments": [{ - "content": "Add the PMID for level 3 evidence: 26351323; Hyman et al, Abstract#B109, Nov 7 2015 AACR-NCI-EORTC International Conference on Molecular Targets and Cancer Therapeutic", - "date": "1445367262725", - "email": "s.m.phillips2@gmail.com", - "resolved": "true", - "userName": "Sarah Phillips" - }, { - "content": "Hyman et al, Abstract#B109, Nov 7 2015 AACR-NCI-EORTC International Conference on Molecular Targets and Cancer Therapeutic", - "date": "1458854439398", - "email": "s.m.phillips2@gmail.com", - "resolved": "true", - "userName": "Sarah Phillips" - }], - "name_review": { - "updateTime": 1517434586075 - }, - "name_uuid": "9d49b289-fb22-4736-aab2-74b201ce68f5", - "propagation": "3B", - "propagation_uuid": "7e83f7c5-d359-45aa-b5f2-b4757a881107", - "short": "" - }], - "type": "IS" - }, { - "name": "Investigational implications for resistance to therapy", - "name_uuid": "5d225e58-dcc4-4b68-b18b-5c2849ff9395", - "type": "IR" - }], - "cancerTypes": [{ - "code": "", - "mainType": "Breast Cancer", - "subtype": "" - }], - "cancerTypes_uuid": "a6ef94e4-f8c9-489e-b1d9-5a7b1821698e", - "diagnostic": { - "description": "", - "description_review": { - "updateTime": 1512692798251 - }, - "description_uuid": "bb8b36d4-40a3-4d40-819d-6e1f76e005da", - "level": "", - "level_uuid": "2fbb9ec4-6869-4a9f-a67a-1df6b4a5d3f6", - "short": "" - }, - "diagnostic_uuid": "80b401af-d302-4437-9dad-4e72be534662", - "prognostic": { - "description": "", - "description_review": { - "updateTime": 1512692797994 - }, - "description_uuid": "4f106a5f-9909-4381-bb9e-e193ecd8327f", - "level": "", - "level_uuid": "c4bcd35c-ed2c-478f-8d9e-234c0b07321c", - "short": "" - }, - "prognostic_uuid": "33741aa9-014d-4582-9268-452db26b96a3", - "summary": "There is promising clinical data in patients with AKT1 E17K mutant ER+ ductal breast cancer treated with the pan-AKT targeted inhibitor AZD5363.", - "summary_review": { - "lastReviewed": "There is promising clinical data in patients with AKT1 E17K mutant ER+ ductal breast cancer treated with the pan-AKT targeted inhibitor AZD5363.", - "updateTime": 1508179719974 - }, - "summary_uuid": "66667275-ca5c-4357-80e5-790747fc6c1b" - }, { - "TIs": [{ - "name": "Standard implications for sensitivity to therapy", - "name_uuid": "75f2ba31-595e-40ff-a54a-9246e85201ff", - "type": "SS" - }, { - "name": "Standard implications for resistance to therapy", - "name_uuid": "dec0092d-b031-49de-ad16-c88c6f575fca", - "type": "SR" - }, { - "name": "Investigational implications for sensitivity to therapy", - "name_uuid": "af8079eb-fc14-41bd-93e3-5419f8425ce7", - "treatments": [{ - "description": "AZD5363 is an orally available, ATP-competitive pan-AKT inhibitor that targets the PI3K/AKT/mTOR signaling pathway (PMID: 23394218). In a Phase I basket study of AZD5363 in AKT E17K-mutated cancers, AZD5363 treatment induced partial responses in two patients with endometrial cancer and one patient with cervical cancer, with a median progression-free survival of 6.6 months (PMID: 28489509). In a second Phase I study of 41 patients with solid tumors in Japan, two patients with the AKT E17K mutation, one having breast cancer and the other having ovarian cancer, had partial responses to AZD5363 (PMID: 26351323). In vitro studies of breast cancer explants harboring the AKT E17K mutation have shown that AZD5363 inhibits tumor growth and reduces signaling downstream of AKT, including reduced phosphorylation of PRAS40 and S6 (PMID: 22294718).", - "description_review": { - "updateTime": 1517434686850, - "updatedBy": "Moriah Nissan" - }, - "description_uuid": "c5f3a0f0-8581-4069-992b-63893c2e5c79", - "indication": "", - "indication_review": { - "updateTime": 1493325255069 - }, - "indication_uuid": "d55bee63-62db-4464-8fd6-ebbffccbca5e", - "level": "3A", - "level_review": { - "updateTime": 1493325255069 - }, - "level_uuid": "2700403e-d188-41c5-95b1-8635ff6a6904", - "name": "AZD5363", - "name_comments": [{ - "content": "Hyman et al, Abstract#B109, Nov 7 2015 AACR-NCI-EORTC International Conference on Molecular Targets and Cancer Therapeutic", - "date": "1458854483280", - "email": "s.m.phillips2@gmail.com", - "resolved": "false", - "userName": "Sarah Phillips" - }, { - "content": "For Level 3A: 26351323; Hyman et al, Abstract#B109, Nov 7 2015 AACR-NCI-EORTC International Conference on Molecular Targets and Cancer Therapeutic", - "date": "1459273152271", - "email": "s.m.phillips2@gmail.com", - "resolved": "false", - "userName": "Sarah Phillips" - }], - "name_review": { - "updateTime": 1517434686850 - }, - "name_uuid": "4a98d8b8-29bd-4d6f-8ec1-e1eedf125c80", - "propagation": "3B", - "propagation_uuid": "05a56a07-d1e5-4778-b4d9-5679dbe294f2", - "short": "" - }], - "type": "IS" - }, { - "name": "Investigational implications for resistance to therapy", - "name_uuid": "43d443b5-24b4-469b-987e-14016c69aed2", - "type": "IR" - }], - "cancerTypes": [{ - "code": "", - "mainType": "Endometrial Cancer", - "subtype": "" - }, { - "code": "", - "mainType": "Ovarian Cancer", - "subtype": "" - }], - "cancerTypes_uuid": "9ada42fa-fa40-455b-a2c2-508a2492e5fa", - "diagnostic": { - "description": "", - "description_uuid": "74e1d8a8-f4e8-4353-884b-ad721ce5881d", - "level": "", - "level_uuid": "4dfb8f9b-fc5b-4979-a19f-8d92c6176f00", - "short": "" - }, - "diagnostic_uuid": "97e41c59-054f-4f42-94b2-01b58f3b7d6c", - "prognostic": { - "description": "", - "description_review": { - "updateTime": 1493325255069 - }, - "description_uuid": "2be3d33e-daae-4b66-99bd-0c747cb77733", - "level": "", - "level_uuid": "b7ff9248-3bd1-4c1a-b55f-29e4cbd3f54c", - "short": "" - }, - "prognostic_uuid": "1924db33-3e49-4df9-a5ca-a5bdd9088f5e", - "summary": "There is promising clinical data in patients with AKT1 E17K mutant gynecological cancer treated with the pan-AKT targeted inhibitor AZD5363.", - "summary_review": { - "updateTime": 1508177294799, - "updatedBy": "Debyani Chakravarty" - }, - "summary_uuid": "84b36b75-e817-47f0-bce3-c4d7f108a49b" - }] - }], - "name": "AKT1", - "name_comments": [{ - "content": "Hi Andy, In your cleanup please make sure that PMIDs: 9843996, 23134728 are curated. Thanks so much!", - "date": "1425671517595", - "email": "debyani.c@gmail.com", - "resolved": "true", - "userName": "Debyani Chakravarty" - }], - "summary": "AKT1, an intracellular kinase, is mutated at low frequencies in a diverse range of cancers.", - "summary_comments": [{ - "content": "AKT1 encodes an intracellular kinase which is a critical downstream effector in the oncogenic PI3K signaling pathway. Mutation of the AKT1 gene are observed at low frequencies (<5%) in a range of tumors including breast, lung and colorectal.", - "date": "1460659497528", - "email": "s.m.phillips2@gmail.com", - "resolved": "true", - "userName": "Sarah Phillips" - }, { - "content": "AKT1 encodes a serine/threonine kinase involved in metabolism, proliferation, cell survival, growth and angiogenesis. Mutations of AKT1 gene are found in breast, lung and colorectal cancers, among others.", - "date": "1460659543592", - "email": "s.m.phillips2@gmail.com", - "resolved": "true", - "userName": "Sarah Phillips" - }], - "summary_review": { - "lastReviewed": "", - "updateTime": 1493325255069, - "updatedBy": 'Jiaojiao wang' - }, - "summary_uuid": "7c2782d9-fbde-417b-817f-b16448b931f5", - "type": { - "ocg": "Oncogene", - "ocg_review": { - "updateTime": 1493325255069 - }, - "ocg_uuid": "55c0ed9b-477e-469b-ae8a-9a14572ae8ac", - "tsg": "", - "tsg_review": { - "updateTime": 1493325255069 - }, - "tsg_uuid": "ad6e2b65-f03c-4385-b5fa-e162ce26f2f6" - }, - "type_uuid": "a3c1500e-46fb-4834-ae06-eadc6f6ca341" - } -}; -OncoKB.config = { - "apiLink": "", - "curationLink": "", - "privateApiLink": "", - "internalPrivateApiLink": "", - "publicApiLink": "", - "internalPublicApiLink": "", - "testing": true, - "production": false, - "firebaseConfig": { - "apiKey": "", - "authDomain": "", - "databaseURL": "", - "projectId": "", - "storageBucket": "", - "messagingSenderId": "" - } -}; -var oncokbApp = angular.module('oncokbApp', [ - 'ngAnimate', - 'ngCookies', - 'ngResource', - 'ngRoute', - 'ngSanitize', - 'ngTouch', - 'ui.bootstrap', - 'localytics.directives', - 'dialogs.main', - 'dialogs.default-translations', - 'RecursionHelper', - 'xml', - 'datatables', - 'datatables.bootstrap', - 'ui.sortable', - 'firebase' -]) - .value('OncoKB', OncoKB) - // This is used for typeahead - .constant('SecretEmptyKey', '[$empty$]') - .constant('loadingScreen', window.loadingScreen) - .constant('S', window.S) - .constant('_', window._) - .constant('Levenshtein', window.Levenshtein) - .constant('PDF', window.jsPDF) - .constant('UUIDjs', window.UUIDjs) - .config(function ($provide, $locationProvider, $routeProvider, $sceProvider, dialogsProvider, $animateProvider, x2jsProvider) { - }); - -angular.module('oncokbApp').run( - ['$window', '$timeout', '$rootScope', '$location', 'loadingScreen', 'DatabaseConnector', 'dialogs', 'mainUtils', 'user', 'loadFiles', - function ($window, $timeout, $rootScope, $location, loadingScreen, DatabaseConnector, dialogs, mainUtils, user, loadFiles) { - $rootScope.errors = []; - $rootScope.internal = true; - $rootScope.meta = { - levelsDesc: { - '1': 'FDA-recognized biomarker predictive of response to an FDA-approved drug in this indication', - '2': 'Standard care biomarker predictive of response to an FDA-approved drug in this indication', - '3A': 'Compelling clinical evidence supports the biomarker as being predictive of response to a drug in this indication', - '3B': 'Compelling clinical evidence supports the biomarker as being predictive of response to a drug in another indication', - '4': 'Compelling biological evidence supports the biomarker as being predictive of response to a drug', - 'R1': 'Standard care biomarker predictive of resistance to an FDA-approved drug in this indication', - 'R2': 'Compelling clinical evidence supports the biomarker as being predictive of resistance to a drug', - 'R3': '' - }, - levelsDescHtml: { - '1': 'FDA-recognized biomarker predictive of response to an FDA-approved drug in this indication', - '2': 'Standard of care biomarker predictive of response to an FDA-approved drug in this indication', - '3A': 'Compelling clinical evidence supports the biomarker as being predictive of response to a drug in this indication but neither biomarker and drug are standard of care', - '3B': 'Compelling clinical evidence supports the biomarker as being predictive of response to a drug in another indication but neither biomarker and drug are standard of care', - '4': 'Compelling biological evidence supports the biomarker as being predictive of response to a drug but neither biomarker and drug are standard of care', - 'R1': 'Standard of care biomarker predictive of resistance to an FDA-approved drug in this indication', - 'R2': 'Compelling clinical evidence supports the biomarker as being predictive of resistance to a drug', - 'R3': '' - }, - colorsByLevel: { - Level_1: '#33A02C', - Level_2: '#1F78B4', - Level_3A: '#984EA3', - Level_3B: '#BE98CE', - Level_4: '#424242', - Level_R1: '#EE3424', - Level_R2: '#F79A92', - Level_R3: '#FCD6D3' - } - }; - - $rootScope.addError = function (error) { - $rootScope.errors.push(error); - }; - $rootScope.me = { - admin: true, - name: 'Jiaojiao wang', - email: 'jiaojiaowanghere@gmail.com' - }; - }]); - -/** - * Bootstrap the app - */ -(function (_, angular, $) { - /** - * Get OncoKB configurations - */ - function fetchData() { - firebase.initializeApp(OncoKB.config.firebaseConfig); - bootstrapApplication(); - } - - /** - * Bootstrap Angular application - */ - function bootstrapApplication() { - angular.element(document).ready(function () { - angular.bootstrap(document, ['oncokbApp']); - }); - } - - fetchData(); -})(window._, window.angular, window.jQuery); diff --git a/app/scripts/controllers/drugs.js b/app/scripts/controllers/drugs.js index 3b19cfc..6d097d4 100644 --- a/app/scripts/controllers/drugs.js +++ b/app/scripts/controllers/drugs.js @@ -114,7 +114,6 @@ angular.module('oncokbApp') }, function(reason) { // something goes wrong then the data in database should not be updated. }); - mainUtils.sendEmailtoMultipulUsers(['kundrar@mskcc.org', 'chakravd@mskcc.org', 'nissanm@mskcc.org'], 'Reminder: A therapy preferred name changed.', content); } } }; diff --git a/app/scripts/controllers/emailDialogCtrl.js b/app/scripts/controllers/emailDialogCtrl.js deleted file mode 100644 index a9c58b1..0000000 --- a/app/scripts/controllers/emailDialogCtrl.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; -angular.module('oncokbApp') - .controller('emailDialogCtrl', function($scope, $uibModalInstance) { - $scope.user = {email: ''}; - - $scope.cancel = function() { - $uibModalInstance.dismiss('canceled'); - }; // end cancel - - $scope.done = function() { - $uibModalInstance.close($scope.user.email); - }; // end save - }) - .run(function($templateCache) { - $templateCache.put('views/emailDialog.html', ''); - }); // end run / module diff --git a/app/scripts/controllers/gene.js b/app/scripts/controllers/gene.js index cc4b52b..f48eaa1 100644 --- a/app/scripts/controllers/gene.js +++ b/app/scripts/controllers/gene.js @@ -3387,18 +3387,7 @@ angular.module('oncokbApp') }, function (error) { // Something goes wrong, this needs to be stored into meta file for future update. console.log('Failed to update priority.'); - DatabaseConnector.sendEmail({ - sendTo: 'dev.oncokb@gmail.com', - subject: 'Error when updating treatments\' priority', - content: JSON.stringify(postData) - }, - function (result) { - deferred.rejected(error); - }, - function (error) { - deferred.rejected(error); - } - ); + Sentry.captureException(new Exception('Error when updating treatments\' priority. Data: ' + JSON.stringify(postData))); }); } else { deferred.resolve(); diff --git a/app/scripts/controllers/genes.js b/app/scripts/controllers/genes.js index a848434..9f0ba78 100644 --- a/app/scripts/controllers/genes.js +++ b/app/scripts/controllers/genes.js @@ -140,7 +140,6 @@ angular.module('oncokbApp') rendering: true, queueRendering: true }; - $scope.adminEmails = []; $scope.oncoTree = { mainTypes: {} }; diff --git a/app/scripts/controllers/nav.js b/app/scripts/controllers/nav.js index 2b0e035..3976f51 100644 --- a/app/scripts/controllers/nav.js +++ b/app/scripts/controllers/nav.js @@ -62,8 +62,7 @@ angular.module('oncokbApp') $location.url('/genes'); } }, function(error) { - mainUtils.sendEmail('dev.oncokb@gmail.com', 'Failed to set user role.', - 'Content: \n' + JSON.stringify(firebaseUser) + '\n\nError: \n' + JSON.stringify(error)); + Sentry.captureException(new Exception('Failed to set user role. Content: \n' + JSON.stringify(firebaseUser) + '\n\nError: \n' + JSON.stringify(error))); }); } else { console.log('not logged in yet'); diff --git a/app/scripts/directives/createnewdrug.js b/app/scripts/directives/createnewdrug.js index 49cfe26..27f1ccc 100644 --- a/app/scripts/directives/createnewdrug.js +++ b/app/scripts/directives/createnewdrug.js @@ -36,7 +36,6 @@ angular.module('oncokbApp') $scope.addDrugErrorMessage = 'Failed to create the drug ' + drugName + '! Please contact developers.'; deferred.reject(error); }); - mainUtils.sendEmailtoMultipulUsers(['kundrar@mskcc.org', 'chakravd@mskcc.org', 'nissanm@mskcc.org'], 'Reminder: A therapy has been added.', content); } else { $scope.addDrugErrorMessage = "Sorry, same drug exists."; diff --git a/app/scripts/directives/curationQueue.js b/app/scripts/directives/curationQueue.js index de0cb15..5f8d457 100644 --- a/app/scripts/directives/curationQueue.js +++ b/app/scripts/directives/curationQueue.js @@ -34,13 +34,11 @@ angular.module('oncokbApp') formExpanded: false, editing: false, hugoVariantMapping: {}, - resendEmail: false, queueItemInEditing: '', invalidData: false, hugoSymbols: [], loading: true }; - scope.resendEmail = false; scope.input = { article: '', link: '', @@ -83,7 +81,6 @@ angular.module('oncokbApp') }); } scope.data.loading = false; - scope.secondTimeAutoNotify(); }); // The column difference in terms of curation queue location in queues page or gene page it that, // gene page has an unique column 'Previously curated in', and queues page has an unique column 'Gene' @@ -206,9 +203,6 @@ angular.module('oncokbApp') currentQueues.push(item); $scope.updateQueueInDB(hugoSymbol, currentQueues).then(function(result) { $scope.queue.push(item); - if (item.curator) { - $scope.sendEmail(item); - } }); } $scope.initialProcess = function(x, type) { @@ -239,7 +233,6 @@ angular.module('oncokbApp') }; function editCuration(queueItem) { - $scope.data.resendEmail = false; $scope.data.editing = true; $scope.data.queueItemInEditing = queueItem; $scope.data.modifiedCurator = {}; @@ -334,9 +327,6 @@ angular.module('oncokbApp') _.each(_.keys(item), function(key) { $scope.data.queueItemInEditing[key] = item[key]; }); - if ($scope.resendEmail) { - $scope.sendEmail(queueItem); - } }); } function completeCuration(queueItem) { @@ -417,60 +407,6 @@ angular.module('oncokbApp') console.log('error'); }); }; - $scope.sendEmail = function(queueItem) { - var expiredCuration = false; - if ($scope.isExpiredCuration(queueItem.dueDay)) { - expiredCuration = true; - } - var email = ''; - for (var i = 0; i < $scope.data.curators.length; i++) { - if (queueItem.curator === $scope.data.curators[i].name) { - email = $scope.data.curators[i].email; - break; - } - } - if (!email) return; - var content = 'Dear ' + queueItem.curator.split(' ')[0] + ',\n\n'; - if (expiredCuration) { - content += 'You have not completed curation of the assigned publication: ' + queueItem.article; - if (queueItem.link) { - content += '(' + queueItem.link + ')'; - } - content += ' which was due on ' + $scope.getFormattedDate(queueItem.dueDay) + '. Please complete this assignment as soon as possible and let us know when you have done this. \n\nIf you have already completed this task, please remember to CLICK THE GREEN CHECK BOX BUTTON at the Curation Queue page or the bottom of the gene page (this will let us know the task is complete). If you have any questions or concerns please email or slack us as needed.'; - content += 'Thank you, \nOncoKB Admin'; - } else { - content += queueItem.addedBy + ' of OncoKB would like you curate the following publications in the indicated alteration, tumor type and section:\n\n'; - var tempArr = [queueItem.article]; - if (queueItem.link) { - tempArr = tempArr.concat(['(', queueItem.link, ')']); - } - if (queueItem.variant) { - tempArr = tempArr.concat(['Alteration:', queueItem.variant + ',']); - } - if (queueItem.subType) { - tempArr = tempArr.concat(['Tumor type:', queueItem.subType + ',']); - } - if (queueItem.section) { - tempArr = tempArr.concat(['Section:', queueItem.section]); - } - content += tempArr.join(' ') + '\n'; - if (queueItem.comment) { - content += queueItem.comment + '\n'; - } - content += '\nPlease try to curate this literature before ' + $scope.getFormattedDate(queueItem.dueDay) + ' and remember to log your hours for curating this data.\n\n'; - content += 'IMPORTANT: Please remember to CLICK THE GREEN CHECK BOX BUTTON at the Curation Queue page or the bottom of the gene page (this will let us know the task is complete).\n\n'; - content += 'If you have any questions or concerns please email or slack ' + queueItem.addedBy + '.\n\n'; - content += 'Thank you, \nOncoKB Admin'; - } - var subject = 'OncoKB Curation Assignment'; - mainUtils.sendEmail(email, subject, content).then(function() { - if (expiredCuration) { - setCurationNotified(queueItem); - } - }, function(error) { - dialogs.error('Error', 'Failed to notify curator automatically. Please send curator email manually.'); - }); - }; var annotationLocation = $scope.specifyAnnotationInGene(); $scope.getAnnotationLocation = function(x) { @@ -513,7 +449,6 @@ angular.module('oncokbApp') $scope.data.editing = false; $scope.predictedArticle = ''; $scope.validPMID = false; - $scope.data.resendEmail = false; }; $scope.isExpiredCuration = mainUtils.isExpiredCuration; $scope.checkInput = function() { @@ -526,20 +461,8 @@ angular.module('oncokbApp') if ($scope.data.editing && !$scope.data.invalidData) { if ($scope.input.curator && queueItem.curator !== $scope.input.curator.name || $scope.input.dueDay && queueItem.dueDay !== new Date($scope.input.dueDay).getTime()) { - $scope.data.resendEmail = true; - } else { - $scope.data.resendEmail = false; } } - $scope.resendEmail = $scope.data.resendEmail; - }; - $scope.secondTimeAutoNotify = function() { - _.each($scope.queue, function (queueItem) { - var hugoSymbol = queueItem.hugoSymbol; - if (hugoSymbol && queueItem.curator && !queueItem.curated && mainUtils.isExpiredCuration(queueItem.dueDay) && !queueItem.notified) { - $scope.sendEmail(queueItem); - } - }); }; $scope.getQueuesByGene = function(hugoSymbol) { return $rootScope.firebaseQueues[hugoSymbol] ? angular.copy($rootScope.firebaseQueues[hugoSymbol].queue) : []; diff --git a/app/scripts/factories/VariantFactory.js b/app/scripts/factories/VariantFactory.js index 692192e..f9e1e60 100644 --- a/app/scripts/factories/VariantFactory.js +++ b/app/scripts/factories/VariantFactory.js @@ -154,27 +154,6 @@ angular.module('oncokbApp').config(function($httpProvider) { }; }]); -angular.module('oncokbApp').factory('SendEmail', ['$http', 'OncoKB', function($http, OncoKB) { - 'use strict'; - var transform = function(data) { - return $.param(data); - }; - - function init(params) { - return $http.post( - OncoKB.config.curationLink + 'sendEmail', - params, - { - headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}, - transformRequest: transform - }); - } - - return { - init: init - }; -}]); - angular.module('oncokbApp').factory('DriveAnnotation', ['$http', 'OncoKB', '_', function($http, OncoKB, _) { 'use strict'; var transform = function(data) { diff --git a/app/scripts/services/databaseconnector.js b/app/scripts/services/databaseconnector.js index ab1f353..54bf31a 100644 --- a/app/scripts/services/databaseconnector.js +++ b/app/scripts/services/databaseconnector.js @@ -10,7 +10,7 @@ angular.module('oncokbApp') 'Evidence', 'SearchVariant', 'DriveAnnotation', - 'SendEmail', + 'Sentry', 'onLocalhost', 'DataSummary', 'Drugs', @@ -29,7 +29,7 @@ angular.module('oncokbApp') Evidence, SearchVariant, DriveAnnotation, - SendEmail, + Sentry, onLocalhost, DataSummary, Drugs, @@ -51,16 +51,7 @@ angular.module('oncokbApp') .then(function(data) { deferred.resolve(data.data); }, function(error) { - var subject = 'searchDrugs Error'; - var content = 'The system error returned is ' + JSON.stringify(error); - sendEmail({sendTo: 'dev.oncokb@gmail.com', subject: subject, content: content}, - function(result) { - console.log('sent searchDrugs Error to oncokb dev account'); - }, - function(error) { - console.log('fail to send searchDrugs Error to oncokb dev account', error); - } - ); + Sentry.captureException(new Exception('Failed to add a new history record for ' + hugoSymbol + '. \n\n Content: ' + JSON.stringify(historyData) + '\n\nError: \n' + JSON.stringify(error))); deferred.reject(error); }); return deferred.promise; @@ -246,16 +237,9 @@ angular.module('oncokbApp') .then(function(data) { success(data); }, function(error) { - var subject = 'VUS update Error for ' + hugoSymbol; - var content = 'The system error returned is ' + JSON.stringify(error); - sendEmail({sendTo: 'dev.oncokb@gmail.com', subject: subject, content: content}, - function(result) { - console.log('sent old history to oncokb dev account'); - }, - function(error) { - console.log('fail to send old history to oncokb dev account', error); - } - ); + var content = 'VUS update Error for ' + hugoSymbol; + content = content + '\nThe system error returned is ' + JSON.stringify(error); + Sentry.captureException(new Exception(content)); fail(error); setAPIData('vus', hugoSymbol, data); }); @@ -312,20 +296,6 @@ angular.module('oncokbApp') return DriveAnnotation.updateEvidenceRelevantCancerTypesBatch(data); } - function sendEmail(params, success, fail) { - if (testing || !inProduction) { - success(true); - } else { - SendEmail - .init(params) - .then(function(data) { - success(data); - }, function() { - fail(); - }); - } - } - function timeout(callback, timestamp) { $timeout(function() { if (numOfLocks[timestamp] === 0) { @@ -490,15 +460,7 @@ angular.module('oncokbApp') }).then(function(ref) { console.log('Added a new history record.'); }, function (error) { - sendEmail({sendTo: 'dev.oncokb@gmail.com', subject: 'Failed to add a new history record for ' + hugoSymbol - + '.', content: JSON.stringify(historyData) + '\n\nError: \n' + JSON.stringify(error)}, - function(result) { - console.log('sent history error to oncokb dev account'); - }, - function(error) { - console.log('fail to send history error to oncokb dev account', error); - } - ); + Sentry.captureException(new Exception('Failed to add a new history record for ' + hugoSymbol + '. \n\n Content: ' + JSON.stringify(historyData) + '\n\nError: \n' + JSON.stringify(error))); }); } @@ -585,7 +547,6 @@ angular.module('oncokbApp') updateEvidenceTreatmentPriorityBatch: updateEvidenceTreatmentPriorityBatch, updateEvidenceRelevantCancerTypesBatch: updateEvidenceRelevantCancerTypesBatch, addHistoryRecord: addHistoryRecord, - sendEmail: sendEmail, getCacheStatus: getCacheStatus, updateGeneCache: function(hugoSymbol) { return updateGeneCache(hugoSymbol); diff --git a/app/scripts/services/mainutils.js b/app/scripts/services/mainutils.js index e9b6b4e..afbf71c 100644 --- a/app/scripts/services/mainutils.js +++ b/app/scripts/services/mainutils.js @@ -279,49 +279,6 @@ angular.module('oncokbApp') return deferred.promise; } - /** - * Util to send email systematically - * @param {string} sendTo The recipient - * @param {string} subject The email subject - * @param {string} content The email content - * @return {*|h.promise|promise|r.promise|d.promise} Promise - * */ - function sendEmail(sendTo, subject, content) { - var deferred = $q.defer(); - if(sendTo && content){ - var param = {sendTo: sendTo, subject: subject, content: content}; - DatabaseConnector.sendEmail( - param, - function(result) { - deferred.resolve(result); - }, - function(result) { - deferred.reject(result); - } - ); - return deferred.promise; - } else { - return deferred.reject('Undefined sendTo or content'); - } - } - /** - * Util to send email to multipul users systematically - * sendToArray is a String array which contains users' email address - * */ - function sendEmailtoMultipulUsers(sendToArray, subject, content) { - _.forEach(sendToArray, function (sendTo) { - sendEmail(sendTo, subject, content); - }) - } - /** - * Util to send email to developer account - * @param {string} subject The email subject - * @param {string} content The email content - * @return Promise - * */ - function notifyDeveloper(subject, content) { - sendEmail('dev.oncokb@gmail.com', subject, content); - } /** * Get Oncotree main types and sub tumor types. @@ -739,12 +696,9 @@ angular.module('oncokbApp') getIsoform: getIsoform, getOncogeneTSG: getOncogeneTSG, getLastReviewedCancerTypesName: getLastReviewedCancerTypesName, - sendEmail: sendEmail, - sendEmailtoMultipulUsers: sendEmailtoMultipulUsers, getTumorTypes: getTumorTypes, isExpiredCuration: isExpiredCuration, processedInReview: processedInReview, - notifyDeveloper: notifyDeveloper, updateLastModified: updateLastModified, updateLastSavedToDB: updateLastSavedToDB, trimMutationName: trimMutationName, diff --git a/app/scripts/services/mainutils.spec.js b/app/scripts/services/mainutils.spec.js index f0bc9fc..3694547 100644 --- a/app/scripts/services/mainutils.spec.js +++ b/app/scripts/services/mainutils.spec.js @@ -70,15 +70,15 @@ describe('Mainutils', function() { summary_comments: [ { "content" : "Needs additional curation", "date" : "1445975597693", - "email" : "s.m.phillips2@gmail.com", + "email" : "test3@gmail.com", "resolved" : "false", - "userName" : "Sarah Phillips" + "userName" : "Test3" }], summary: 'This is the gene summay content', summary_review: { lastReviewed: 'This is the previsoud gene summary content', updateTime: 1531828464480, - updatedBy: 'Jiaojiao wang' + updatedBy: 'Developer1' } }; var keys = ['summary']; @@ -87,7 +87,7 @@ describe('Mainutils', function() { summary_review: { lastReviewed: 'This is the previsoud gene summary content', updateTime: 1531828464480, - updatedBy: 'Jiaojiao wang' + updatedBy: 'Developer1' } }; // this should be the json data that will be passed into database @@ -96,7 +96,7 @@ describe('Mainutils', function() { summary_review: { lastReviewed: 'This is the previsoud gene summary content', updateTime: 1531828464480, - updatedBy: 'Jiaojiao wang' + updatedBy: 'Developer1' } }; var data = angular.copy(originalData); @@ -124,8 +124,8 @@ describe('Mainutils', function() { "name" : "T104P", "time" : { "by" : { - "email" : "kpgala15@gmail.com", - "name" : "Kinisha Gala" + "email" : "test1@gmail.com", + "name" : "Test1" }, "value" : 1514944647037 } @@ -135,14 +135,14 @@ describe('Mainutils', function() { "name_comments" : [ { "content" : "PMID: 23009571", "date" : "1515703300669", - "email" : "moriah.heller@gmail.com", + "email" : "test2@gmail.com", "resolved" : "false", - "userName" : "Moriah Nissan" + "userName" : "Test2" } ], "time" : { "by" : { - "email" : "moriah.heller@gmail.com", - "name" : "Moriah Nissan" + "email" : "test2@gmail.com", + "name" : "Test2" }, "value" : 1515703295003 } @@ -152,8 +152,8 @@ describe('Mainutils', function() { "name" : "T104P", "time" : { "by" : { - "email" : "kpgala15@gmail.com", - "name" : "Kinisha Gala" + "email" : "test1@gmail.com", + "name" : "Test1" }, "value" : 1514944647037 } @@ -161,8 +161,8 @@ describe('Mainutils', function() { "name" : "Y326H", "time" : { "by" : { - "email" : "moriah.heller@gmail.com", - "name" : "Moriah Nissan" + "email" : "test2@gmail.com", + "name" : "Test2" }, "value" : 1515703295003 } @@ -171,8 +171,8 @@ describe('Mainutils', function() { "name" : "T104P", "time" : { "by" : { - "email" : "kpgala15@gmail.com", - "name" : "Kinisha Gala" + "email" : "test1@gmail.com", + "name" : "Test1" }, "value" : 1514944647037 } @@ -181,14 +181,14 @@ describe('Mainutils', function() { "name_comments" : [ { "content" : "PMID: 23009571", "date" : "1515703300669", - "email" : "moriah.heller@gmail.com", + "email" : "test2@gmail.com", "resolved" : "false", - "userName" : "Moriah Nissan" + "userName" : "Test2" } ], "time" : { "by" : { - "email" : "moriah.heller@gmail.com", - "name" : "Moriah Nissan" + "email" : "test2@gmail.com", + "name" : "Test2" }, "value" : 1515703295003 } @@ -201,12 +201,12 @@ describe('Mainutils', function() { var newlyAddedReviewObj = { added: true, updateTime: 1515703295003, - updatedBy: 'Jiaojiao wang' + updatedBy: 'Developer1' }; var newlyRemovedReviewObj = { removed: true, updateTime: 1515703295003, - updatedBy: 'Jiaojiao wang' + updatedBy: 'Developer1' }; expect(mainUtilsFactory.shouldExclude(true, newlyAddedReviewObj)).toEqual(true); expect(mainUtilsFactory.shouldExclude(true, newlyRemovedReviewObj)).toEqual(false); @@ -227,11 +227,11 @@ describe('Mainutils', function() { updateTime: yesterday.getTime(), lastReviewed: 'Previous effect value' }, { - updatedBy: 'Jiaojiao wang', + updatedBy: 'Developer1', updateTime: now.getTime(), lastReviewed: 'Previous oncogenic value' }, { - updatedBy: 'Jiaojiao wang', + updatedBy: 'Developer1', updateTime: twoDaysAgo.getTime(), lastReviewed: 'Previous description content' }]; diff --git a/app/views/curationQueue.html b/app/views/curationQueue.html index b26f003..c9b25c9 100644 --- a/app/views/curationQueue.html +++ b/app/views/curationQueue.html @@ -88,9 +88,6 @@

Curation Queue -
-

Email will be resent after saving modified curation because of changes in Curator or Due date.

-