From 7cfa2c97b1d2c3c7d330199697bb4d444f7f2786 Mon Sep 17 00:00:00 2001 From: "Chris J. Karr" Date: Sun, 6 Aug 2017 21:46:02 -0500 Subject: [PATCH] Additional IndexedDB work --- www/scripts/controllers/daily_check_in.js | 2 +- www/scripts/controllers/fetch_content.js | 24 +- www/scripts/controllers/home.js | 2 + www/scripts/controllers/weekly_check_in.js | 34 +- www/scripts/services/database.js | 969 +++++++++++-------- www/views/questionGroups/question_group.html | 14 + 6 files changed, 610 insertions(+), 435 deletions(-) diff --git a/www/scripts/controllers/daily_check_in.js b/www/scripts/controllers/daily_check_in.js index a36c9f5b..137117c9 100644 --- a/www/scripts/controllers/daily_check_in.js +++ b/www/scripts/controllers/daily_check_in.js @@ -503,7 +503,7 @@ angular.module('livewellApp').controller('DailyCheckInCtrl', function($scope, $l }, function() { Database.updateClinicalStatus(function() { Database.updateDailyReachout(function() { - Database.filter('clinial_reachout', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + Database.filter('clinical_reachout', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { $scope.emergency = false; $scope.reachoutMessage = null; diff --git a/www/scripts/controllers/fetch_content.js b/www/scripts/controllers/fetch_content.js index 3852210f..665058e7 100644 --- a/www/scripts/controllers/fetch_content.js +++ b/www/scripts/controllers/fetch_content.js @@ -8,7 +8,7 @@ * Controller of the livewellApp */ -angular.module('livewellApp').controller('FetchContentCtrl', function ($scope,$http) { +angular.module('livewellApp').controller('FetchContentCtrl', function ($scope, $http, Database) { // var SERVER_LOCATION = 'https://livewell2.firebaseio.com/'; var SERVER_LOCATION = 'https://livewellcss.northwestern.edu/firebase-proxy/'; var SECURE_CONTENT = 'https://mohrlab.northwestern.edu/livewell-dash/content/'; @@ -75,6 +75,17 @@ angular.module('livewellApp').controller('FetchContentCtrl', function ($scope,$h if (oldStatus == undefined || oldStatus == null) { console.log('SAVE 1: ' + JSON.stringify(response)); localStorage[el.route] = JSON.stringify(response); + + var dbObject = { + updated: Date.now(), + status_code: response['currentCode'], + version: response['version'], + source: 'server' + }; + + Database.insertWithCallback('clinical_status', dbObject, function() { + console.log('STATUS CODE INITED: ' + JSON.stringify(dbObject)) + }); } else { oldStatus = JSON.parse(oldStatus); @@ -90,7 +101,16 @@ angular.module('livewellApp').controller('FetchContentCtrl', function ($scope,$h localStorage[el.route] = JSON.stringify(newStatus); - // TODO + var dbObject = { + updated: Date.now(), + status_code: response['currentCode'], + version: response['version'], + source: 'server' + }; + + Database.insertWithCallback('clinical_status', dbObject, function() { + console.log('STATUS CODE UPDATED: ' + JSON.stringify(dbObject)) + }); } } } diff --git a/www/scripts/controllers/home.js b/www/scripts/controllers/home.js index f982dc5a..b71f6933 100644 --- a/www/scripts/controllers/home.js +++ b/www/scripts/controllers/home.js @@ -15,6 +15,8 @@ angular.module('livewellApp').controller('HomeCtrl', function ($scope, Pound, Da {name:"Toolbox", href:"skills", class: "btn-info"}, {name:"Wellness Plan", href:"wellness/resources", class: "btn-info"}, ]; + + console.log('LIVEWELL'); var now = Date.now() var studyStart = parseFloat(localStorage['startDate']); diff --git a/www/scripts/controllers/weekly_check_in.js b/www/scripts/controllers/weekly_check_in.js index 6c1cecb8..97cf592c 100644 --- a/www/scripts/controllers/weekly_check_in.js +++ b/www/scripts/controllers/weekly_check_in.js @@ -147,8 +147,36 @@ angular.module('livewellApp').controller('WeeklyCheckInCtrl', function($scope, $ dbObject[response['name']] = parseInt(response['value']); } - Database.insert('weekly_check_in', dbObject); - - $location.path("/ews"); + Database.insertWithCallback('weekly_check_in', dbObject, function() { + console.log('000001'); + + Database.updateWeeklyReachout(function() { + console.log('000002'); + + Database.filter('clinical_weekly_reachout', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + console.log("GOT MESSAGE"); + + $scope.reachoutMessage = null; + + if (cursor != null) { + $scope.reachoutMessage = cursor.value.message + } + + console.log("NEW WEEKLY REVIEW MESSAGE: " + $scope.reachoutMessage); + + $scope.$apply(); + + $("#continue").modal(); + + $('#continue').on('hide.bs.modal', function (e) { + console.log('HIDE'); + console.log($location); + + $location.path("/ews"); + $scope.$apply(); + }); + }); + }); + }); } }); \ No newline at end of file diff --git a/www/scripts/services/database.js b/www/scripts/services/database.js index 8df544d9..2aedea15 100644 --- a/www/scripts/services/database.js +++ b/www/scripts/services/database.js @@ -11,7 +11,7 @@ angular.module('livewellApp').service('Database', function (UserData) { window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction || { READ_WRITE: "readwrite" }; // This line should only be needed if it is needed to support the object's constants for older browsers window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange; - var DATABASE_VERSION = 3; + var DATABASE_VERSION = 4; var database = { db: null @@ -138,15 +138,17 @@ angular.module('livewellApp').service('Database', function (UserData) { dailyReviewStore.createIndex('initialCode', 'initialCode'); dailyReviewStore.createIndex('finalCode', 'finalCode'); case 2: - var clinicalStatusStore = db.createObjectStore('clinial_status', { + var clinicalStatusStore = db.createObjectStore('clinical_status', { keypath: 'id', autoIncrement: true }); clinicalStatusStore.createIndex('updated', 'updated'); clinicalStatusStore.createIndex('status_code', 'status_code'); + clinicalStatusStore.createIndex('version', 'version'); + clinicalStatusStore.createIndex('source', 'source'); - var clinicalReachoutStore = db.createObjectStore('clinial_reachout', { + var clinicalReachoutStore = db.createObjectStore('clinical_reachout', { keypath: 'id', autoIncrement: true }); @@ -158,8 +160,19 @@ angular.module('livewellApp').service('Database', function (UserData) { clinicalReachoutStore.createIndex('coach_email', 'coach_email'); clinicalReachoutStore.createIndex('message', 'message'); clinicalReachoutStore.createIndex('notify', 'notify'); - - break; + case 3: + var clinicalWeeklyReachoutStore = db.createObjectStore('clinical_weekly_reachout', { + keypath: 'id', + autoIncrement: true + }); + + clinicalWeeklyReachoutStore.createIndex('updated', 'updated'); + clinicalWeeklyReachoutStore.createIndex('reachout_code', 'reachout_code'); + clinicalWeeklyReachoutStore.createIndex('provider_call', 'provider_call'); + clinicalWeeklyReachoutStore.createIndex('provider_email', 'provider_email'); + clinicalWeeklyReachoutStore.createIndex('coach_email', 'coach_email'); + clinicalWeeklyReachoutStore.createIndex('message', 'message'); + clinicalWeeklyReachoutStore.createIndex('notify', 'notify'); } window.localStorage.setItem('livewell_last_database_version', DATABASE_VERSION); @@ -300,8 +313,8 @@ angular.module('livewellApp').service('Database', function (UserData) { database.filter = function(tableName, indexName, valueQuery, direction, filterCallback, failCallback) { database.waitForDatabase(function() { - console.log('FILTER ' + tableName + ' -- ' + indexName); - + console.log('FILTER ' + tableName + ' -- ' + indexName); + var transaction = database.db.transaction([ tableName ], "readonly"); var store = transaction.objectStore(tableName); @@ -335,96 +348,96 @@ angular.module('livewellApp').service('Database', function (UserData) { }; database.updateDailyReachout = function(callback) { - var statusCodes = []; - - database.filter('clinial_status', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { - if (cursor && statusCodes.length < 2) { + var statusCodes = []; + + database.filter('clinical_status', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + if (cursor && statusCodes.length < 2) { statusCodes.push(cursor.value.status_code); cursor.continue(); } else { - while (statusCodes.length < 2) { - statusCodes.push(1); - } - - var wellnessList = []; - var medicationList = []; - var sleepDurationList = []; - - var sleepRoutineRanges = UserData.query('sleepRoutineRanges'); - - database.filter('daily_check_in', 'created', IDBKeyRange.lowerBound(0), "prev", function(cursor) { - if (cursor && wellnessList.length < 7) { - wellnessList.push(parseInt("" + cursor.value.wellness)); - medicationList.push(parseInt("" + cursor.value.medications)); - - var duration = parseInt("" + cursor.value.sleepDuration); - - // TODO: Code against latest goals at the time... - - if (duration <= sleepRoutineRanges.LessSevere) { - sleepDurationList.push(-2); - } else if (duration < sleepRoutineRanges.Less && duration >= sleepRoutineRanges.LessSevere) { - sleepDurationList.push(-1); - } else if (duration >= sleepRoutineRanges.Less && duration <= sleepRoutineRanges.More) { - sleepDurationList.push(0); - } else if (duration > sleepRoutineRanges.More && duration <= sleepRoutineRanges.MoreSevere) { - sleepDurationList.push(1); - } else if (duration >= sleepRoutineRanges.MoreSevere) { - sleepDurationList.push(2); - } - - cursor.continue(); - } else { - while (wellnessList.length < 7) { - wellnessList.push(0); - } - - while (medicationList.length < 7) { - medicationList.push(2); - } - - while (sleepDurationList.length < 7) { - sleepDurationList.push(0); - } - - var reachoutList = []; - var notifyList = []; - - database.filter('clinial_reachout', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { - if (cursor && reachoutList.length < 7) { - reachoutList.push(parseInt("" + cursor.value.reachout_code)); - notifyList.push(cursor.value.notify); - - cursor.continue(); - } else { - while (reachoutList.length < 7) { - reachoutList.push(0); - } - - while (notifyList.length < 7) { - notifyList.push(false); - } - - database.calculateClinicalReachout(statusCodes, wellnessList, medicationList, sleepDurationList, reachoutList, notifyList, function(newReachoutItem) { - database.insertWithCallback('clinial_reachout', { - updated: Date.now(), - reachout_code: newReachoutItem['reachout_code'], - provider_call: newReachoutItem['provider_call'], - provider_email: newReachoutItem['provider_email'], - coach_email: newReachoutItem['coach_email'], - message: newReachoutItem['message'], - notify: newReachoutItem['notify'], - }, callback); - }); - } - }, function() { - console.log('DATABASE: Unable to fetch last reachouts to update reachout...'); - }); - } - }, function() { - console.log('DATABASE: Unable to fetch last daily check-ins to update reachout...'); - }); + while (statusCodes.length < 2) { + statusCodes.push(1); + } + + var wellnessList = []; + var medicationList = []; + var sleepDurationList = []; + + var sleepRoutineRanges = UserData.query('sleepRoutineRanges'); + + database.filter('daily_check_in', 'created', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + if (cursor && wellnessList.length < 7) { + wellnessList.push(parseInt("" + cursor.value.wellness)); + medicationList.push(parseInt("" + cursor.value.medications)); + + var duration = parseInt("" + cursor.value.sleepDuration); + + // TODO: Code against latest goals at the time... + + if (duration <= sleepRoutineRanges.LessSevere) { + sleepDurationList.push(-2); + } else if (duration < sleepRoutineRanges.Less && duration >= sleepRoutineRanges.LessSevere) { + sleepDurationList.push(-1); + } else if (duration >= sleepRoutineRanges.Less && duration <= sleepRoutineRanges.More) { + sleepDurationList.push(0); + } else if (duration > sleepRoutineRanges.More && duration <= sleepRoutineRanges.MoreSevere) { + sleepDurationList.push(1); + } else if (duration >= sleepRoutineRanges.MoreSevere) { + sleepDurationList.push(2); + } + + cursor.continue(); + } else { + while (wellnessList.length < 7) { + wellnessList.push(0); + } + + while (medicationList.length < 7) { + medicationList.push(2); + } + + while (sleepDurationList.length < 7) { + sleepDurationList.push(0); + } + + var reachoutList = []; + var notifyList = []; + + database.filter('clinical_reachout', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + if (cursor && reachoutList.length < 7) { + reachoutList.push(parseInt("" + cursor.value.reachout_code)); + notifyList.push(cursor.value.notify); + + cursor.continue(); + } else { + while (reachoutList.length < 7) { + reachoutList.push(0); + } + + while (notifyList.length < 7) { + notifyList.push(false); + } + + database.calculateClinicalReachout(statusCodes, wellnessList, medicationList, sleepDurationList, reachoutList, notifyList, function(newReachoutItem) { + database.insertWithCallback('clinical_reachout', { + updated: Date.now(), + reachout_code: newReachoutItem['reachout_code'], + provider_call: newReachoutItem['provider_call'], + provider_email: newReachoutItem['provider_email'], + coach_email: newReachoutItem['coach_email'], + message: newReachoutItem['message'], + notify: newReachoutItem['notify'], + }, callback); + }); + } + }, function() { + console.log('DATABASE: Unable to fetch last reachouts to update reachout...'); + }); + } + }, function() { + console.log('DATABASE: Unable to fetch last daily check-ins to update reachout...'); + }); } }, function() { console.log('DATABASE: Unable to fetch last clinical status to update reachout...'); @@ -432,96 +445,120 @@ angular.module('livewellApp').service('Database', function (UserData) { }; database.updateClinicalStatus = function(callback) { - database.filter('clinial_status', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + database.filter('clinical_status', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { var lastStatusCode = 1; if (cursor != null) { lastStatusCode = cursor.value.status_code; } - var lastSevenResponses = []; + var lastSevenResponses = []; database.filter('daily_check_in', 'created', IDBKeyRange.lowerBound(0), "prev", function(cursor) { - // TODO: Add check if last status is an override and add tests to - // determine if enough data has been submitted to move out of overridden - // state. Example: at least 5 days passed since clinical status was - // overridden... + // TODO: Add check if last status is an override and add tests to + // determine if enough data has been submitted to move out of overridden + // state. Example: at least 5 days passed since clinical status was + // overridden... - if (cursor && lastSevenResponses.length < 7) { + if (cursor && lastSevenResponses.length < 7) { lastSevenResponses.push(parseInt("" + cursor.value.wellness)); cursor.continue(); - } else { - while (lastSevenResponses.length < 7) { - lastSevenResponses.push(0); - } - - var newStatusCode = lastStatusCode; - - if (lastStatusCode == 1) { // Well - var prodromalCount = 0; - - for (var i = 0; i < lastSevenResponses.length; i++) { - if (Math.abs(lastSevenResponses[i]) >= 2) { - prodromalCount += 1; - } - } - - if (prodromalCount >= 4) { - newStatusCode = 2; - } - } else if (lastStatusCode == 2) { // Prodromal - var wellCount = 0; - var unwellCount = 0; - - for (var i = 0; i < lastSevenResponses.length; i++) { - if (Math.abs(lastSevenResponses[i]) <= 1) { - wellCount += 1; - } else if (Math.abs(lastSevenResponses[i]) >= 3) { - unwellCount += 1; - } - } - - if (wellCount >= 5) { - newStatusCode = 1; - } else if (unwellCount >= 5) { - newStatusCode = 4; - } - } else if (lastStatusCode == 3) { // Recovering - var wellCount = 0; - var unwellCount = 0; - - for (var i = 0; i < lastSevenResponses.length; i++) { - if (Math.abs(lastSevenResponses[i]) <= 1) { - wellCount += 1; - } else if (Math.abs(lastSevenResponses[i]) >= 3) { - unwellCount += 1; - } - } - - if (wellCount >= 5) { - newStatusCode = 1; - } else if (unwellCount >= 5) { - newStatusCode = 4; - } - } else if (lastStatusCode == 4) { - var recoveringCount = 0; - - for (var i = 0; i < lastSevenResponses.length; i++) { - if (Math.abs(lastSevenResponses[i]) <= 2) { - recoveringCount += 1; - } - } - - if (recoveringCount >= 5) { - newStatusCode = 3; - } - } - - database.insertWithCallback('clinial_status', { - updated: Date.now(), - status_code: newStatusCode - }, callback); - } + } else { + while (lastSevenResponses.length < 7) { + lastSevenResponses.push(0); + } + + var newStatusCode = lastStatusCode; + + if (lastStatusCode == 1) { // Well + var prodromalCount = 0; + + for (var i = 0; i < lastSevenResponses.length; i++) { + if (Math.abs(lastSevenResponses[i]) >= 2) { + prodromalCount += 1; + } + } + + if (prodromalCount >= 4) { + newStatusCode = 2; + } + } else if (lastStatusCode == 2) { // Prodromal + var wellCount = 0; + var unwellCount = 0; + + for (var i = 0; i < lastSevenResponses.length; i++) { + if (Math.abs(lastSevenResponses[i]) <= 1) { + wellCount += 1; + } else if (Math.abs(lastSevenResponses[i]) >= 3) { + unwellCount += 1; + } + } + + if (wellCount >= 5) { + newStatusCode = 1; + } else if (unwellCount >= 5) { + newStatusCode = 4; + } + } else if (lastStatusCode == 3) { // Recovering + var wellCount = 0; + var unwellCount = 0; + + for (var i = 0; i < lastSevenResponses.length; i++) { + if (Math.abs(lastSevenResponses[i]) <= 1) { + wellCount += 1; + } else if (Math.abs(lastSevenResponses[i]) >= 3) { + unwellCount += 1; + } + } + + if (wellCount >= 5) { + newStatusCode = 1; + } else if (unwellCount >= 5) { + newStatusCode = 4; + } + } else if (lastStatusCode == 4) { + var recoveringCount = 0; + + for (var i = 0; i < lastSevenResponses.length; i++) { + if (Math.abs(lastSevenResponses[i]) <= 2) { + recoveringCount += 1; + } + } + + if (recoveringCount >= 5) { + newStatusCode = 3; + } + } + + var lastServerUpdate = 0; + + database.filter('clinical_status', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + if (cursor && lastServerUpdate == 0) { + if (cursor.value.source == 'server') { + lastServerUpdate = cursor.value.updated; + cursor.continue(); + } + } else { + if (lastServerUpdate > 0) { + var delta = Date.now() - lastServerUpdate; + + if (delta > (1000 * 60 * 60 * 24 * 4)) { + database.insertWithCallback('clinical_status', { + updated: Date.now(), + status_code: newStatusCode, + source: 'app' + }, callback); + } else { + console.log("NOT UPDATING. DELTA = " + (delta / (1000 * 60 * 60 * 24))); + callback(); + } + } else { + console.log("NOT UPDATING. NO DELTA"); + callback(); + } + } + }); + } }, function() { console.log('DATABASE: Unable to fetch daily reviews to update clinical status...'); }); @@ -530,10 +567,62 @@ angular.module('livewellApp').service('Database', function (UserData) { }); }; - database.calculateWeeklyReachout = function(callback) { - - - + database.updateWeeklyReachout = function(callback) { + var phq_composites = []; + var amrs_composites = []; + + database.filter('weekly_check_in', 'created', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + if (cursor && phq_composites.length < 2) { + phq_composites.push(cursor.value.phq_composite); + amrs_composites.push(cursor.value.amrs_composite); + + cursor.continue(); + } else { + var reachout = { + updated: Date.now(), + reachout_code: 0, + provider_call: false, + provider_email: false, + coach_email: false, + message: null, + notify: false + }; + + if (amrs_composites.length == 2) { + if (amrs_composites[0] >= 6 && amrs_composites[1] < 6) { + reachout['reachout_code'] = 18; + reachout['message'] = 'Looks like you may be entering a manic episode. Call your psychiatrist to check in. '; + reachout['provider_call'] = true; + reachout['provider_email'] = true; + reachout['coach_email'] = true; + } else if (phq_composites[0] >= 10 && phq_composites[1] < 10) { + reachout['reachout_code'] = 19; + reachout['message'] = 'Looks like you may be entering a depressive episode. Call your psychiatrist to check in. '; + reachout['provider_call'] = true; + reachout['provider_email'] = true; + reachout['coach_email'] = true; + } + } else if (amrs_composites.length == 1) { + if (amrs_composites[0] >= 6) { + reachout['reachout_code'] = 18; + reachout['message'] = 'Looks like you may be entering a manic episode. Call your psychiatrist to check in. '; + reachout['provider_call'] = true; + reachout['provider_email'] = true; + reachout['coach_email'] = true; + } else if (phq_composites[0] >= 10) { + reachout['reachout_code'] = 19; + reachout['message'] = 'Looks like you may be entering a depressive episode. Call your psychiatrist to check in. '; + reachout['provider_call'] = true; + reachout['provider_email'] = true; + reachout['coach_email'] = true; + } + } + + database.insertWithCallback('clinical_weekly_reachout', reachout, callback); + } + }, function() { + console.log('DATABASE: Unable to fetch last weekly check-in to update reachout...'); + }); }; database.calculateClinicalReachout = function(statusCodes, wellnessList, medicationList, sleepDurationList, reachoutList, notifyList, callback) { @@ -591,32 +680,32 @@ angular.module('livewellApp').service('Database', function (UserData) { if (wellnessList[0] == 4) { // Crisis-Up (1) reachout['reachout_code'] = 1; - reachout['message'] = 'TODO: Prompt 1'; + reachout['message'] = 'Looks like you are in a crisis. Call your psychiatrist, call 911, or go to the nearest emergency room.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else if (wellnessList[0] == -4) { // Crisis-Down (2) reachout['reachout_code'] = 2; - reachout['message'] = 'TODO: Prompt 2'; + reachout['message'] = 'Looks like you are in a crisis. Call your psychiatrist, call 911, or go to the nearest emergency room.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else if (statusCodes[0] == 4 && (statusCodes[0] == 2 || statusCodes[0] == 3)) { if (wellnessSevenModerateUp > wellnessSevenModerateDown) { // Clinical Status to Manic (3) reachout['reachout_code'] = 3; - reachout['message'] = 'TODO: Prompt 3'; + reachout['message'] = 'Looks like you may be entering a manic episode. Call your psychiatrist to check in.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else if (wellnessSevenModerateUp < wellnessSevenModerateDown) { // Clinical Status to Depressed (4) reachout['reachout_code'] = 4; - reachout['message'] = 'TODO: Prompt 4'; + reachout['message'] = 'Looks like you may be entering a depressive episode. Call your psychiatrist to check in.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else { // Clinical Status to Unwell (5) reachout['reachout_code'] = 5; - reachout['message'] = 'TODO: Prompt 5'; + reachout['message'] = 'Looks like you may be entering a mood episode. Call your psychiatrist to check in.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; @@ -624,19 +713,19 @@ angular.module('livewellApp').service('Database', function (UserData) { } else if (statusCodes[0] == 2 && statusCodes[1] == 1) { if (wellnessSevenMildModerateUp > wellnessSevenMildModerateDown) { // Clinical Status to Prodromal-Mania (6) reachout['reachout_code'] = 6; - reachout['message'] = 'TODO: Prompt 6'; + reachout['message'] = 'Looks like you may be having early warning signs of mania. Call your psychiatrist to check in.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else if (wellnessSevenMildModerateUp < wellnessSevenMildModerateDown) { // Clinical Status to Prodromal-Depression (7) reachout['reachout_code'] = 7; - reachout['message'] = 'TODO: Prompt 7'; + reachout['message'] = 'Looks like you may be having early warning signs of depression. Call your psychiatrist to check in.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else { // Clinical Status to Prodromal (8) reachout['reachout_code'] = 8; - reachout['message'] = 'TODO: Prompt 8'; + reachout['message'] = 'Looks like you may be having early warning signs. Call your psychiatrist to check in.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; @@ -644,19 +733,19 @@ angular.module('livewellApp').service('Database', function (UserData) { } else if (statusCodes[0] < 4) { if (wellnessList[0] == 3 && (wellnessFourModerateUp >= 3 || wellnessSevenModerateUp >= 4)) { // Worsening Symptoms-Mania (9) reachout['reachout_code'] = 9; - reachout['message'] = 'TODO: Prompt 9'; + reachout['message'] = 'Looks like you may be having worsening symptoms of mania. Call your psychiatrist to check in.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else if (wellnessList[0] == -3 && wellnessSevenModerateDown >= 4) { // Worsening Symptoms-Depression (10) reachout['reachout_code'] = 10; - reachout['message'] = 'TODO: Prompt 10'; + reachout['message'] = 'Looks like you may be having worsening symptoms of depression. Call your psychiatrist to check in. '; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else if (Math.abs(wellnessList[0]) == 3 && wellnessFourModerateUp >=2 && wellnessSevenModerateDown >= 2) { // Worsening Symptoms-Unwell (11) reachout['reachout_code'] = 11; - reachout['message'] = 'TODO: Prompt 11'; + reachout['message'] = 'Looks like you may be having worsening symptoms. Call your psychiatrist to check in.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; @@ -666,13 +755,13 @@ angular.module('livewellApp').service('Database', function (UserData) { if (medicationList[0] < 2) { if (medicationFourAll == 0) { // High Risk-Medications-Mail (12) reachout['reachout_code'] = 12; - reachout['message'] = 'TODO: Prompt 12'; + reachout['message'] = 'Looks like you have been missing medication doses. Call your psychiatrist to discuss any problems you may be having.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else if (medicationFourAll == 1) { // High Risk-Medications-Call (13) reachout['reachout_code'] = 13; - reachout['message'] = 'TODO: Prompt 13'; + reachout['message'] = 'Looks like you have been missing medication doses. Call your psychiatrist to discuss any problems you may be having.'; reachout['provider_call'] = true; reachout['provider_email'] = false; reachout['coach_email'] = false; @@ -680,13 +769,13 @@ angular.module('livewellApp').service('Database', function (UserData) { } else if (sleepDurationList[0] == -2) { if (sleepDurationFourLessSevere >= 3) { // High Risk-Sleep Less-Mail (14) reachout['reachout_code'] = 14; - reachout['message'] = 'TODO: Prompt 14'; + reachout['message'] = 'Looks like you have been sleeping too little. Call your psychiatrist to discuss any problems you may be having.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else if (sleepDurationFourLessSevere == 2) { // High Risk-Sleep Less-Call (15) reachout['reachout_code'] = 15; - reachout['message'] = 'TODO: Prompt 15'; + reachout['message'] = 'Looks like you have been sleeping less than usual. Call your psychiatrist to discuss any problems you may be having.'; reachout['provider_call'] = true; reachout['provider_email'] = false; reachout['coach_email'] = false; @@ -694,13 +783,13 @@ angular.module('livewellApp').service('Database', function (UserData) { } else if (sleepDurationList[0] == 2) { if (sleepDurationFourMoreSevere == 4) { // High Risk-Sleep More-Mail (16) reachout['reachout_code'] = 16; - reachout['message'] = 'TODO: Prompt 16'; + reachout['message'] = 'Looks like you have been sleeping too much. Call your psychiatrist to discuss any problems you may be having.'; reachout['provider_call'] = true; reachout['provider_email'] = true; reachout['coach_email'] = true; } else if (sleepDurationFourMoreSevere == 3) { // High Risk-Sleep More-Call (17) reachout['reachout_code'] = 17; - reachout['message'] = 'TODO: Prompt 17'; + reachout['message'] = 'Looks like you have been sleeping more than usual. Call your psychiatrist to discuss any problems you may be having.'; reachout['provider_call'] = true; reachout['provider_email'] = false; reachout['coach_email'] = false; @@ -711,257 +800,279 @@ angular.module('livewellApp').service('Database', function (UserData) { // Notification / pop-ups: // 1-8: always show pop-up - // 9: Only show if show(9) < 3 in the last week. - // 10: Only show if show(9, 10) < 3 in the last week. + // 9: Only show if show(9) < 3 in the last week. + // 10: Only show if show(10) < 3 in the last week. // 11: Only show if show(9, 10, 11) < 3 in the last week. // 12: Only show if show(12) < 3 in the last week. // 13: Only show if show(12, 13) < 3 in the last week. // 14: Only show if show(14) < 3 in the last week. // 15: Only show if show(14, 15) < 3 in the last week. - // 16: Only show if show(14, 15, 16) < 3 in the last week. - // 17: Only show if show(14, 15, 16, 17) < 3 in the last week. + // 16: Only show if show(16) < 3 in the last week. + // 17: Only show if show(16, 17) < 3 in the last week. if (reachout['reachout_code'] > 0 && reachout['reachout_code'] <= 8) { reachout['notify'] = true; } else if (reachout['reachout_code'] >= 9) { - var notifyCount = 0; - - for (var i = 0; i < 7; i++) { - if (notifyList[i]) { - notifyCount += 1; - } - } - - if (notifyCount <= 2) { - reachout['notify'] = true; - } + var counts = []; + + for (var i = 0; i <= 18; i++) { + counts.push(0); + } + + for (var i = 0; i < reachoutList.length && i < notifyList.length; i++) { + if (notifyList[i]) { + counts[reachoutList[i]] += 1; + } + } + + if (reachout['reachout_code'] == 9 && counts[9] < 3) { + reachout['notify'] = true; + } else if (reachout['reachout_code'] == 10 && counts[10] < 3) { + reachout['notify'] = true; + } else if (reachout['reachout_code'] == 11 && (counts[9] + counts[10] + counts[11]) < 3) { + reachout['notify'] = true; + } else if (reachout['reachout_code'] == 12 && counts[12] < 3) { + reachout['notify'] = true; + } else if (reachout['reachout_code'] == 13 && (counts[12] + counts[13]) < 3) { + reachout['notify'] = true; + } else if (reachout['reachout_code'] == 14 && counts[14] < 3) { + reachout['notify'] = true; + } else if (reachout['reachout_code'] == 15 && (counts[14] + counts[15]) < 3) { + reachout['notify'] = true; + } else if (reachout['reachout_code'] == 16 && counts[16] < 3) { + reachout['notify'] = true; + } else if (reachout['reachout_code'] == 17 && (counts[16] + counts[17]) < 3) { + reachout['notify'] = true; + } } callback(reachout); }; database.updateDailyReview = function(callback) { - database.filter('clinial_status', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { - if (cursor) { - var currentStatusCode = cursor.value.status_code; - // TODO: ^ get prior, pre-daily-check-in status code... - - var sleepRoutineRanges = UserData.query('sleepRoutineRanges'); - - var bedTimeStart = parseInt(sleepRoutineRanges.BedTimeStrt_MT); - var bedTimeStop = parseInt(sleepRoutineRanges.BedTimeStop_MT); - var riseTimeStart = parseInt(sleepRoutineRanges.RiseTimeStrt_MT); - var riseTimeStop = parseInt(sleepRoutineRanges.RiseTimeStop_MT); - - if (bedTimeStart > bedTimeStop) { - bedTimeStop = bedTimeStop + 2400; - } - - if (riseTimeStart > riseTimeStop) { - riseTimeStop = riseTimeStop + 2400; - } - - var dailyWellnesses = []; - var dailyMedications = []; - var dailySleepDurations = []; - var dailySleepRoutines = []; - - database.filter('daily_check_in', 'created', IDBKeyRange.lowerBound(0), "prev", function(cursor) { - if (cursor && dailyWellnesses.length < 4) { - dailyWellnesses.push(parseInt("" + cursor.value.wellness)); - - console.log('PUSHING MEDICATION(' + dailyMedications.length + '): ' + cursor.value.medications); - - dailyMedications.push(parseInt("" + cursor.value.medications)); - - var duration = parseInt("" + cursor.value.sleepDuration); - - if (duration <= sleepRoutineRanges.LessSevere) { - dailySleepDurations.push(-2); - } else if (duration < sleepRoutineRanges.Less && duration >= sleepRoutineRanges.LessSevere) { - dailySleepDurations.push(1); - } else if (duration >= sleepRoutineRanges.Less && duration <= sleepRoutineRanges.More) { - dailySleepDurations.push(0); - } else if (duration > sleepRoutineRanges.More && duration <= sleepRoutineRanges.MoreSevere) { - dailySleepDurations.push(1); - } else if (duration >= sleepRoutineRanges.MoreSevere) { - dailySleepDurations.push(2); - } - - var windowsHit = 0; - - var toBed = parseInt("" + cursor.value.toBed); - var gotUp = parseInt("" + cursor.value.gotUp); - - if (gotUp < riseTimeStart) { - gotUp = gotUp + 2400; - } - - if (toBed < bedTimeStart) { - toBed = toBed + 2400; - } - - if (gotUp >= riseTimeStart && gotUp <= riseTimeStop) { - windowsHit += 1; - } - - if (toBed >= bedTimeStart && toBed <= bedTimeStop) { - windowsHit += 1; - } - - dailySleepRoutines.push(windowsHit); - - cursor.continue(); - } else { - while (dailyWellnesses.length < 4) { - dailyWellnesses.push(0); - } - - while (dailyMedications.length < 4) { - dailyMedications.push(2); - } - - while (dailySleepDurations.length < 4) { - dailySleepDurations.push(0); - } - - while (dailySleepRoutines.length < 4) { - dailySleepRoutines.push(2); - } - - database.filter('daily_review', 'started', IDBKeyRange.lowerBound(0), "prev", function(cursor) { - var lastCode = 26; - - if (cursor) { - lastCode = cursor.value.finalCode; - } - - var dbObject = { - started: Date.now(), - userStarted: true, - initialCode: lastCode, - finalCode: 26 // Staying Well (26) - }; - - if (dailyWellnesses[0] == 4) { // Crisis-Up (1) - dbObject['finalCode'] = 1; - } else if (dailyWellnesses[0] == -4) { // Crisis-Down (2) - dbObject['finalCode'] = 2; - } else if (currentStatusCode == 4) { - if (dailyWellnesses[0] == 3) { // Episode-Continuing-Up (3) - dbObject['finalCode'] = 3; - } else if (dailyWellnesses[0] == -3) { // Episode-Continuing-Down (4) - dbObject['finalCode'] = 4; - } else if (dailyWellnesses[0] == 2) { // Episode-Improving-Up (5) - dbObject['finalCode'] = 5; - } else if (dailyWellnesses[0] == -2) { // Episode-Improving-Down (6) - dbObject['finalCode'] = 6; - } else if (Math.abs(dailyWellnesses[0]) <= 1) { // Episode-Improving-Balanced (7) - dbObject['finalCode'] = 7; - } - } else { - if (dailyWellnesses[0] == 3) { // Worsening Symptoms-Up (8) - dbObject['finalCode'] = 8; - } else if (dailyWellnesses[0] == -3) { // Worsening Symptoms-Down (9) - dbObject['finalCode'] = 9; - } else if (currentStatusCode == 3 && dailyWellnesses[0] == 2) { // Recovering-Continuing-Up (10) - dbObject['finalCode'] = 10; - } else if (currentStatusCode == 3 && dailyWellnesses[0] == -2) { // Recovering-Continuing-Down (11) - dbObject['finalCode'] = 11; - } else if (currentStatusCode == 2 && dailyWellnesses[0] == 2) { // Prodormal-Continuing-Up (12) - dbObject['finalCode'] = 12; - } else if (currentStatusCode == 2 && dailyWellnesses[0] == -2) { // Prodormal-Continuing-Down (13) - dbObject['finalCode'] = 13; - } else if (currentStatusCode == 3 && Math.abs(dailyWellnesses[0]) <= 1) { // Recovering-Improving-Balanced (14) - dbObject['finalCode'] = 14; - } else if (currentStatusCode == 2 && Math.abs(dailyWellnesses[0]) <= 1) { // Prodormal-Improving-Balanced (15) - dbObject['finalCode'] = 15; - } else if (currentStatusCode == 1 && dailyWellnesses[0] == 2) { // Early Warning Signs-Up (16) - dbObject['finalCode'] = 16; - } else if (currentStatusCode == 1 && dailyWellnesses[0] == -2) { // Early Warning Signs-Down (17) - dbObject['finalCode'] = 17; - } else if (currentStatusCode == 1 && Math.abs(dailyWellnesses[0]) <= 1) { - var medicationsPastFourAll = 0; - - for (var i = 0; i < dailyMedications.length; i++) { - if (dailyMedications[i] == 2) { - medicationsPastFourAll += 1; - } - } - - if (dailyMedications[0] < 2 && medicationsPastFourAll <= 1) { // High Risk-Medication Adherence (18) - dbObject['finalCode'] = 18; - } else { - var moreSevere = 0; - var more = 0; - var baseline = 0; - var less = 0; - var lessSevere = 0; - - for (var i = 0; i < dailySleepDurations.length; i++) { - switch (dailySleepDurations[i]) { - case -2: - lessSevere += 1; - break; - case -1: - less += 1; - break; - case 0: - baseline += 1; - break; - case 1: - more += 1; - break; - case 2: - moreSevere += 1; - break; - } - } - - if (dailySleepDurations[0] == -2 && lessSevere >= 2) { // High Risk-Sleeping Too Little (19) - dbObject['finalCode'] = 19; - } else if (dailySleepDurations[0] == 2 && moreSevere >= 3) { // High Risk-Sleeping Too Much (20) - dbObject['finalCode'] = 20; - } else if (dailyMedications[0] < 2) { // Moderate Risk-Medication Adherence (21) - dbObject['finalCode'] = 21; - } else if (dailyMedications[0] == 2) { - if (dailySleepDurations[0] < 0 && (lessSevere + less >= 2) && (moreSevere + more) <= 1) { // Moderate Risk-Sleeping Too Little (22) - dbObject['finalCode'] = 22; - } else if (dailySleepDurations[0] > 0 && (lessSevere + less) <= 1 && (moreSevere + more) >= 2) { // Moderate Risk-Sleeping Too Much (23) - dbObject['finalCode'] = 23; - } else if (dailySleepDurations[0] != 0 && baseline <= 2) { // Moderate Risk-Sleeping Erratically (24) - dbObject['finalCode'] = 24; - } else { - var windowSum = 0; - - for (var i = 0; i < dailySleepRoutines.length; i++) { - windowSum += dailySleepRoutines[i]; - } - - if (dailySleepRoutines[0] < 2 && windowSum <= 5) { // Moderate Risk-Irregular Routine (25) - dbObject['finalCode'] = 25; - } - } - } - } - } - } - - database.insertWithCallback('daily_review', dbObject, function() { - callback(dbObject['finalCode']); - }); - }, function () { - console.log('DATABASE: Unable to fetch last daily review to update daily review...'); - }); - } - }, function() { - console.log('DATABASE: Unable to fetch last daily check-ins to update daily review...'); - }); - } - }, function() { - console.log('DATABASE: Unable to fetch clinical status to update daily review...'); - }); - }; + database.filter('clinical_status', 'updated', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + var codes = []; + + if (cursor && codes.length < 2) { + codes.push(cursor.value.status_code); + cursor.continue(); + } else { + var currentStatusCode = codes[1]; + + var sleepRoutineRanges = UserData.query('sleepRoutineRanges'); + + var bedTimeStart = parseInt(sleepRoutineRanges.BedTimeStrt_MT); + var bedTimeStop = parseInt(sleepRoutineRanges.BedTimeStop_MT); + var riseTimeStart = parseInt(sleepRoutineRanges.RiseTimeStrt_MT); + var riseTimeStop = parseInt(sleepRoutineRanges.RiseTimeStop_MT); + + if (bedTimeStart > bedTimeStop) { + bedTimeStop = bedTimeStop + 2400; + } + + if (riseTimeStart > riseTimeStop) { + riseTimeStop = riseTimeStop + 2400; + } + + var dailyWellnesses = []; + var dailyMedications = []; + var dailySleepDurations = []; + var dailySleepRoutines = []; + + database.filter('daily_check_in', 'created', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + if (cursor && dailyWellnesses.length < 4) { + dailyWellnesses.push(parseInt("" + cursor.value.wellness)); + + dailyMedications.push(parseInt("" + cursor.value.medications)); + + var duration = parseInt("" + cursor.value.sleepDuration); + + if (duration <= sleepRoutineRanges.LessSevere) { + dailySleepDurations.push(-2); + } else if (duration < sleepRoutineRanges.Less && duration >= sleepRoutineRanges.LessSevere) { + dailySleepDurations.push(1); + } else if (duration >= sleepRoutineRanges.Less && duration <= sleepRoutineRanges.More) { + dailySleepDurations.push(0); + } else if (duration > sleepRoutineRanges.More && duration <= sleepRoutineRanges.MoreSevere) { + dailySleepDurations.push(1); + } else if (duration >= sleepRoutineRanges.MoreSevere) { + dailySleepDurations.push(2); + } + + var windowsHit = 0; + + var toBed = parseInt("" + cursor.value.toBed); + var gotUp = parseInt("" + cursor.value.gotUp); + + if (gotUp < riseTimeStart) { + gotUp = gotUp + 2400; + } + + if (toBed < bedTimeStart) { + toBed = toBed + 2400; + } + + if (gotUp >= riseTimeStart && gotUp <= riseTimeStop) { + windowsHit += 1; + } + + if (toBed >= bedTimeStart && toBed <= bedTimeStop) { + windowsHit += 1; + } + + dailySleepRoutines.push(windowsHit); + + cursor.continue(); + } else { + while (dailyWellnesses.length < 4) { + dailyWellnesses.push(0); + } + + while (dailyMedications.length < 4) { + dailyMedications.push(2); + } + + while (dailySleepDurations.length < 4) { + dailySleepDurations.push(0); + } + + while (dailySleepRoutines.length < 4) { + dailySleepRoutines.push(2); + } + + database.filter('daily_review', 'started', IDBKeyRange.lowerBound(0), "prev", function(cursor) { + var lastCode = 26; + + if (cursor) { + lastCode = cursor.value.finalCode; + } + + var dbObject = { + started: Date.now(), + userStarted: true, + initialCode: lastCode, + finalCode: 26 // Staying Well (26) + }; + + if (dailyWellnesses[0] == 4) { // Crisis-Up (1) + dbObject['finalCode'] = 1; + } else if (dailyWellnesses[0] == -4) { // Crisis-Down (2) + dbObject['finalCode'] = 2; + } else if (currentStatusCode == 4) { + if (dailyWellnesses[0] == 3) { // Episode-Continuing-Up (3) + dbObject['finalCode'] = 3; + } else if (dailyWellnesses[0] == -3) { // Episode-Continuing-Down (4) + dbObject['finalCode'] = 4; + } else if (dailyWellnesses[0] == 2) { // Episode-Improving-Up (5) + dbObject['finalCode'] = 5; + } else if (dailyWellnesses[0] == -2) { // Episode-Improving-Down (6) + dbObject['finalCode'] = 6; + } else if (Math.abs(dailyWellnesses[0]) <= 1) { // Episode-Improving-Balanced (7) + dbObject['finalCode'] = 7; + } + } else { + if (dailyWellnesses[0] == 3) { // Worsening Symptoms-Up (8) + dbObject['finalCode'] = 8; + } else if (dailyWellnesses[0] == -3) { // Worsening Symptoms-Down (9) + dbObject['finalCode'] = 9; + } else if (currentStatusCode == 3 && dailyWellnesses[0] == 2) { // Recovering-Continuing-Up (10) + dbObject['finalCode'] = 10; + } else if (currentStatusCode == 3 && dailyWellnesses[0] == -2) { // Recovering-Continuing-Down (11) + dbObject['finalCode'] = 11; + } else if (currentStatusCode == 2 && dailyWellnesses[0] == 2) { // Prodormal-Continuing-Up (12) + dbObject['finalCode'] = 12; + } else if (currentStatusCode == 2 && dailyWellnesses[0] == -2) { // Prodormal-Continuing-Down (13) + dbObject['finalCode'] = 13; + } else if (currentStatusCode == 3 && Math.abs(dailyWellnesses[0]) <= 1) { // Recovering-Improving-Balanced (14) + dbObject['finalCode'] = 14; + } else if (currentStatusCode == 2 && Math.abs(dailyWellnesses[0]) <= 1) { // Prodormal-Improving-Balanced (15) + dbObject['finalCode'] = 15; + } else if (currentStatusCode == 1 && dailyWellnesses[0] == 2) { // Early Warning Signs-Up (16) + dbObject['finalCode'] = 16; + } else if (currentStatusCode == 1 && dailyWellnesses[0] == -2) { // Early Warning Signs-Down (17) + dbObject['finalCode'] = 17; + } else if (currentStatusCode == 1 && Math.abs(dailyWellnesses[0]) <= 1) { + var medicationsPastFourAll = 0; + + for (var i = 0; i < dailyMedications.length; i++) { + if (dailyMedications[i] == 2) { + medicationsPastFourAll += 1; + } + } + + if (dailyMedications[0] < 2 && medicationsPastFourAll <= 1) { // High Risk-Medication Adherence (18) + dbObject['finalCode'] = 18; + } else { + var moreSevere = 0; + var more = 0; + var baseline = 0; + var less = 0; + var lessSevere = 0; + + for (var i = 0; i < dailySleepDurations.length; i++) { + switch (dailySleepDurations[i]) { + case -2: + lessSevere += 1; + break; + case -1: + less += 1; + break; + case 0: + baseline += 1; + break; + case 1: + more += 1; + break; + case 2: + moreSevere += 1; + break; + } + } + + if (dailySleepDurations[0] == -2 && lessSevere >= 2) { // High Risk-Sleeping Too Little (19) + dbObject['finalCode'] = 19; + } else if (dailySleepDurations[0] == 2 && moreSevere >= 3) { // High Risk-Sleeping Too Much (20) + dbObject['finalCode'] = 20; + } else if (dailyMedications[0] < 2) { // Moderate Risk-Medication Adherence (21) + dbObject['finalCode'] = 21; + } else if (dailyMedications[0] == 2) { + if (dailySleepDurations[0] < 0 && (lessSevere + less >= 2) && (moreSevere + more) <= 1) { // Moderate Risk-Sleeping Too Little (22) + dbObject['finalCode'] = 22; + } else if (dailySleepDurations[0] > 0 && (lessSevere + less) <= 1 && (moreSevere + more) >= 2) { // Moderate Risk-Sleeping Too Much (23) + dbObject['finalCode'] = 23; + } else if (dailySleepDurations[0] != 0 && baseline <= 2) { // Moderate Risk-Sleeping Erratically (24) + dbObject['finalCode'] = 24; + } else { + var windowSum = 0; + + for (var i = 0; i < dailySleepRoutines.length; i++) { + windowSum += dailySleepRoutines[i]; + } + + if (dailySleepRoutines[0] < 2 && windowSum <= 5) { // Moderate Risk-Irregular Routine (25) + dbObject['finalCode'] = 25; + } + } + } + } + } + } + + database.insertWithCallback('daily_review', dbObject, function() { + callback(dbObject['finalCode']); + }); + }, function () { + console.log('DATABASE: Unable to fetch last daily review to update daily review...'); + }); + } + }, function() { + console.log('DATABASE: Unable to fetch last daily check-ins to update daily review...'); + }); + } + }, function() { + console.log('DATABASE: Unable to fetch clinical status to update daily review...'); + }); + }; return database; }); diff --git a/www/views/questionGroups/question_group.html b/www/views/questionGroups/question_group.html index a89e4213..a6aabbde 100644 --- a/www/views/questionGroups/question_group.html +++ b/www/views/questionGroups/question_group.html @@ -1,3 +1,17 @@ + + +