Merge branch 'auditTrial'

This commit is contained in:
Aysel Afsar 2016-04-06 15:37:35 -04:00
commit 513abfeeb5
18 changed files with 258 additions and 69 deletions

View File

@ -52,3 +52,5 @@ aldeed:template-extension@4.0.0
zuuk:stale-session
gilbertwat:bootstrap3-daterangepicker
email
peppelg:bootstrap-3-modal
simple:reactive-method

View File

@ -83,6 +83,7 @@ npm-bcrypt@0.7.8_2
npm-mongo@1.4.39_1
observe-sequence@1.0.7
ordered-dict@1.0.4
peppelg:bootstrap-3-modal@1.0.4
practicalmeteor:chai@2.1.0_1
practicalmeteor:loglevel@1.2.0_2
promise@0.5.1
@ -98,6 +99,7 @@ service-configuration@1.0.5
session@1.1.1
sha@1.0.4
silentcicero:jszip@0.0.4
simple:reactive-method@1.0.2
spacebars@1.0.7
spacebars-compiler@1.0.7
srp@1.0.4

View File

@ -26,7 +26,8 @@ var data = {
'associationModal',
'optionsModal',
'serverInformationModal',
'confirmRemoveTimepointAssociation'
'confirmRemoveTimepointAssociation',
'lastLoginModal'
]
};

View File

@ -40,12 +40,8 @@ Meteor.startup(function() {
// Bind events if window is closed
$(window).bind('beforeunload', function (e) {
closingWindow();
// have to return null, unless you want a chrome popup alert
//return 'If you leave this page then any unsaved changes will be lost.';
// return 'If you leave this page then any unsaved changes will be lost.';
});
});
closingWindow = function(){
Meteor.call('removeUserFromReviewers', Meteor.userId());
};

View File

@ -123,7 +123,12 @@ Meteor.methods({
},
updateLastLoginDate: function () {
Meteor.users.update({_id: Meteor.userId()}, {$set: {lastLoginDate: new Date()}});
var user = Meteor.users.findOne(Meteor.userId());
if (!user) {
return;
}
// Update priorLoginDate and lastLoginDate
Meteor.users.update({_id: Meteor.userId()}, {$set: {priorLoginDate: user.lastLoginDate, lastLoginDate: new Date()}});
},
isAccountInactive: function (inactivityParameters) {

View File

@ -16,7 +16,7 @@
<i class="pull-left fa fa-gears fa-2x lightgray"></i>
<div class="media-body">
<span class="small gray">{{entryTimestamp}}</span><br>
<span style="{{getHighlightColor}}">{{userName}}</span> initialized HIPAA Audit Log.
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> initialized HIPAA Audit Log.
</div>
</div>
</li>
@ -60,7 +60,7 @@
<div class="media-body">
<span class="small gray">{{entryTimestamp}}</span><br>
{{#if hasPatientInfo}}
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> modified record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span class="patientName {{getHighlightColor}}">{{getPatientName}}</span>.
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> modified record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span class="patientName" style="{{getHighlightColor}}">{{getPatientName}}</span>.
{{else}}
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> modified record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
{{/if}}
@ -77,7 +77,7 @@
<i class="pull-left fa fa-code-fork fa-2x lightgray"></i>
<div class="media-body">
<span class="small gray">{{entryTimestamp}}</span><br>
<span style="{{getHighlightColor}}">{{userName}}</span> cloned record <span style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> cloned record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
</div>
</div>
</li>
@ -90,7 +90,7 @@
<i class="pull-left fa fa-minus-circle fa-2x lightgray"></i>
<div class="media-body">
<span class="small gray">{{entryTimestamp}}</span><br>
<span style="{{getHighlightColor}}">{{userName}}</span> deleted record <span style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> deleted record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
</div>
</div>
</li>
@ -103,7 +103,7 @@
<i class="pull-left fa fa-warning fa-2x lightgray"></i>
<div class="media-body">
<span class="small gray">{{entryTimestamp}}</span><br>
<span style="{{getHighlightColor}}">{{userName}}</span> was denied access to record <span style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> was denied access to record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
</div>
</div>
</li>
@ -117,9 +117,9 @@
<div class="media-body">
<span class="small gray">{{entryTimestamp}}</span><br>
{{#if hasPatientInfo}}
<span style="{{getHighlightColor}}">{{userName}}</span> viewed record <span style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span style="{{getHighlightColor}}">{{getPatientName}}</span>.
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> viewed record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span class="patientName" style="{{getHighlightColor}}">{{getPatientName}}</span>.
{{else}}
<span style="{{getHighlightColor}}">{{userName}}</span> viewed record <span style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> viewed record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
{{/if}}
</div>
</div>
@ -133,7 +133,7 @@
<i class="pull-left fa fa-rss fa-2x lightgray"></i>
<div class="media-body">
<span class="small gray">{{entryTimestamp}}</span><br>
<span style="{{getHighlightColor}}">{{userName}}</span> published record <span style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> published record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
</div>
</div>
</li>
@ -146,7 +146,7 @@
<i class="pull-left fa fa-circle-o fa-2x lightgray"></i>
<div class="media-body">
<span class="small gray">{{entryTimestamp}}</span><br>
<span style="{{getHighlightColor}}">{{userName}}</span> unpublished record <span style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> unpublished record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
</div>
</div>
</li>
@ -159,7 +159,7 @@
<i class="pull-left fa fa-bomb fa-2x lightgray"></i>
<div class="media-body">
<span class="small gray">{{entryTimestamp}}</span><br>
<span style="{{getHighlightColor}}">{{userName}}</span> received a data access error while performing an action!<br>
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> received a data access error while performing an action!<br>
<span class="error">{{getErrorMessage}}</span>
</div>

View File

@ -20,7 +20,7 @@ Template.hipaaAuditLog.helpers({
},
hipaaAudit: function () {
// return HipaaLog.find();
return HipaaLog.find({
return HipaaLog.find({
$or: [
{
userName: {
@ -33,6 +33,18 @@ Template.hipaaAuditLog.helpers({
$regex: Session.get('hipaaSearchFilter'),
$options: 'i'
}
},
{
recordId: {
$regex: Session.get('hipaaSearchFilter'),
$options: 'i'
}
},
{
collectionName: {
$regex: Session.get('hipaaSearchFilter'),
$options: 'i'
}
}
],
eventType: {
@ -54,6 +66,23 @@ Template.hipaaAuditLog.helpers({
Template.hipaaAuditLog.events({
"keyup #hipaaSearchFilter": function (event, template) {
Session.set("hipaaSearchFilter", $('#hipaaSearchFilter').val());
},
"click .userName": function(event, template) {
var userName = $(event.currentTarget).text();
Session.set('hipaaSearchFilter', userName);
},
"click .patientName": function(event, template) {
var patientName = $(event.currentTarget).text();
var patientNameRegex = patientName.replace(/[!@#$%^&*()+=\-[\]\\';,./{}|":<>?~_]/g, "\\$&");
Session.set('hipaaSearchFilter', patientNameRegex);
},
"click .mongoRecordId": function(event, template) {
var mongoRecordId = $(event.currentTarget).text();
Session.set('hipaaSearchFilter', mongoRecordId);
},
"click .collectionName": function(event, template) {
var collectionName = $(event.currentTarget).text();
Session.set('hipaaSearchFilter', collectionName);
}
});

View File

@ -70,5 +70,9 @@
width: 100%;
}
.userName, .patientName, .mongoRecordId, .collectionName{
cursor: pointer;
}
}

View File

@ -1,13 +1,17 @@
<template name="hipaaRibbon">
<aside id="hipaaRibbon" class="{{getRibbonClass}}">
<input type="text" name="hipaaSearchFilter" id="hipaaSearchFilter" class="{{getInputClass}}" value="{{getHipaaSearchFilter}}" placeholder="Search User" style="{{getSearchFilterStyling}}">
<div class="btn-group">
<input type="text" name="hipaaSearchFilter" id="hipaaSearchFilter" class="{{getInputClass}}" value="{{getHipaaSearchFilter}}" placeholder="Search User" style="{{getSearchFilterStyling}}">
<span id="searchClear" class="glyphicon glyphicon-remove-circle"></span>
</div>
<!--<input type="text" name="hipaaSearchFilter" id="hipaaSearchFilter" class="{{getInputClass}}" value="{{getHipaaSearchFilter}}" placeholder="Search User" style="{{getSearchFilterStyling}}">-->
<input type="date" id="beginDateInput" class="{{getInputClass}}" value="{{getBeginDate}}" style="{{getDateRangeStyling}}">
<input type="date" id="endDateInput" class="{{getInputClass}}" value="{{getEndDate}}" style="{{getDateRangeStyling}}">
<select id="actionFilter" name="actionFilter" class="{{getSelectClass}}" style="{{getSelectStyling}}">
<option id="filterCreatedButton">Created</option>
<option id="filterModifiedButton">Modified</option>
<option id="filterViewedButton">Viewed</option>
<option id="filterAllButton">All</option>
<option id="filterCreatedButton" value="create">Created</option>
<option id="filterModifiedButton" value="modify">Modified</option>
<option id="filterViewedButton" value="viewed">Viewed</option>
<option id="filterAllButton" selected value="">All</option>
</select>
</aside>

View File

@ -8,7 +8,10 @@ Template.hipaaRibbon.events({
"change #endDateInput": function (event, template) {
Session.set("endDateFilter", $('#endDateInput').val() + "T00:00:00.000Z");
},
'change #actionFilter': function(e) {
var actionType = e.currentTarget.value;
Session.set("hipaaTypeFilter", actionType);
},
'click #filterCreatedButton': function () {
Session.set("hipaaTypeFilter", 'create');
},
@ -20,6 +23,9 @@ Template.hipaaRibbon.events({
},
'click #filterAllButton': function () {
Session.set("hipaaTypeFilter", '');
},
'click #searchClear': function() {
Session.set("hipaaSearchFilter", '');
}
});

View File

@ -28,6 +28,17 @@
.form-control{
display: inline-block !important;
}
#searchClear {
position: absolute;
right: 14px;
top: 0;
bottom: 0;
height: 14px;
margin: auto;
font-size: 14px;
cursor: pointer;
color: #ccc;
}
}
// @media only screen and (max-width: 850px) {

View File

@ -59,6 +59,10 @@ Template.associationModal.events({
// Sort the study dates, so we can get a range for these values
studyDates = studyDates.sort();
// HipaaEventType to log changes in collections
var hipaaEventType;
var hipaaEvent;
// Check if these studies are already associated with an existing Timepoint
var existingTimepoint;
if (timepointType === 'baseline') {
@ -91,6 +95,7 @@ Template.associationModal.events({
}
});
timepointId = existingTimepoint.timepointId;
hipaaEventType = 'modify';
} else {
// Create a new timepoint to represent the (baseline or follow-up) studies
var timepoint = {
@ -105,8 +110,20 @@ Template.associationModal.events({
// Insert this timepoint into the Timepoints Collection
Timepoints.insert(timepoint);
timepointId = timepoint.timepointId;
hipaaEventType = 'create';
}
// Log
hipaaEvent = {
eventType: hipaaEventType,
userId: Meteor.userId(),
userName: Meteor.user().profile.fullName,
collectionName: "Timepoints",
recordId: timepointId,
patientId: relatedStudies[0].patientId,
patientName: relatedStudies[0].patientName
};
// Loop through these studies to associate them with the newly created timepoint
relatedStudies.forEach(function(study) {
// Check if a study already exists in the Studies collection
@ -121,6 +138,8 @@ Template.associationModal.events({
timepointId: timepointId
}
});
// Log modify
hipaaEventType = 'modify';
} else {
// If no such study exists, update the entry with the new timepointId
@ -130,7 +149,22 @@ Template.associationModal.events({
// Attach the timepointId and insert it into the Studies Collection
study.timepointId = timepointId;
Studies.insert(study);
// Log create
hipaaEventType = 'create';
}
// Log
hipaaEvent = {
eventType: hipaaEventType,
userId: Meteor.userId(),
userName: Meteor.user().profile.fullName,
collectionName: "Studies",
recordId: study.studyInstanceUid,
patientId: study.patientId,
patientName: study.patientName
};
HipaaLogger.logEvent(hipaaEvent);
});
});

View File

@ -0,0 +1,16 @@
<template name="lastLoginModal">
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body" style="padding: 0;">
<div class="alert alert-info" style="margin: 0 auto;">
<a href="#" class="close" data-dismiss="modal">&times;</a>
{{#if lastLoginDate}}
<h5>You last logged in on <strong>{{lastLoginDate}}</strong></h5>
{{/if}}
</div>
</div>
</div>
</div>
</div>
</template>

View File

@ -0,0 +1,9 @@
Template.lastLoginModal.helpers({
lastLoginDate: function() {
var userLoginDate = ReactiveMethod.call('getPriorLoginDate');
if (userLoginDate && userLoginDate.priorLoginDate) {
return moment(userLoginDate.priorLoginDate).format("MMMM Do YYYY, HH:mm:ss A");
}
return;
}
});

View File

@ -1,42 +1,5 @@
Session.set('defaultSignInMessage', 'Tumor tracking in your browser.');
Template.lesionTrackerLayout.helpers({
fullName: function() {
return Meteor.user().profile.fullName;
},
showWorklistMenu: function() {
return Template.instance().showWorklistMenu.get();
},
currentUser: function() {
var verifyEmail = Meteor.settings && Meteor.settings.public && Meteor.settings.public.verifyEmail || false;
if (!Meteor.user() || !Meteor.userId()) {
return false;
}
if (!verifyEmail) {
return true;
}
if (Meteor.user().emails[0].verified) {
return true;
}
return false;
}
});
Template.lesionTrackerLayout.onCreated(function() {
// showViewer to go to viewer from audit
this.showWorklistMenu = new ReactiveVar(true);
// Get url and check worklist
var currentPath = Router.current().route.path(this);
if (currentPath === '/' || currentPath === '/worklist') {
this.showWorklistMenu.set(false);
}
// Show countdown dialog
var handle;
$(document).on('TriggerOpenTimeoutCountdownDialog', function(e, leftTime) {
@ -68,3 +31,54 @@ Template.lesionTrackerLayout.onCreated(function() {
}
});
});
Template.lesionTrackerLayout.onRendered(function() {
var oldUserId = undefined;
var userName;
var lastLoginModalInterval;
Tracker.autorun(function() {
// Hook login/logout
var newUserId = Meteor.userId();
if (oldUserId === null && newUserId) {
Session.set('showLastLoginModal', true);
userName = Meteor.user().profile.fullName;
// Log
HipaaLogger.logEvent({
eventType: 'init',
userId: Meteor.userId(),
userName: userName
});
} else if (newUserId === null && oldUserId) {
// Set showLastLoginModal as null
Session.set('showLastLoginModal', null);
// Destroy interval for last login modal
Meteor.clearInterval(lastLoginModalInterval);
console.log('The user logged out');
// Log
// TODO: eventype is not defined for logout in hipaa-audit-log
/*HipaaLogger.logEvent({
eventType: 'logout',
userId: oldUserId,
userName: userName
});*/
// Remove the user from Reviewers
Meteor.call('removeUserFromReviewers', oldUserId);
}
oldUserId = Meteor.userId();
// Trigger last login date popup
if (Session.get('showLastLoginModal')) {
Modal.show('lastLoginModal');
lastLoginModalInterval = Meteor.setInterval( function() {
Modal.hide('lastLoginModal');
Session.set("showLastLoginModal", null);
}, 3000);
return true;
}
});
});

View File

@ -37,7 +37,20 @@ function removeTimepointAssociations() {
Meteor.call('removeAssociatedStudy', study._id, function(error) {
if (error) {
log.warn(error);
return;
}
// Log
var hipaaEvent = {
eventType: 'delete',
userId: Meteor.userId(),
userName: Meteor.user().profile.fullName,
collectionName: "Studies",
recordId: study.studyInstanceUid,
patientId: study.patientId,
patientName: study.patientName
};
HipaaLogger.logEvent(hipaaEvent);
});
// Find the Timepoint that was previously referenced
@ -64,13 +77,38 @@ function removeTimepointAssociations() {
studyInstanceUids: timepoint.studyInstanceUids
}
});
// Log
var hipaaEvent = {
eventType: 'modify',
userId: Meteor.userId(),
userName: Meteor.user().profile.fullName,
collectionName: "Timepoints",
recordId: study.timepointId,
patientId: study.patientId,
patientName: study.patientName
};
HipaaLogger.logEvent(hipaaEvent);
} else {
// If no more Studies are associated with this Timepoint, we should remove it
// from the Timepoints Collection via a server call
Meteor.call('removeTimepoint', timepoint._id, function(error) {
if (error) {
log.warn(error);
return;
}
// Log
var hipaaEvent = {
eventType: 'delete',
userId: Meteor.userId(),
userName: Meteor.user().profile.fullName,
collectionName: "Timepoints",
recordId: study.timepointId,
patientId: study.patientId,
patientName: study.patientName
};
HipaaLogger.logEvent(hipaaEvent);
});
}
});
@ -81,10 +119,10 @@ function removeTimepointAssociations() {
*/
function exportSelectedStudies() {
var selectedStudies = WorklistSelectedStudies.find({}, {
sort: {
studyDate: 1
}
}).fetch();
sort: {
studyDate: 1
}
}).fetch();
if (!selectedStudies) {
return;
@ -98,10 +136,10 @@ function exportSelectedStudies() {
*/
function viewStudies() {
var selectedStudies = WorklistSelectedStudies.find({}, {
sort: {
studyDate: 1
}
}).fetch();
sort: {
studyDate: 1
}
}).fetch();
if (!selectedStudies) {
return;

View File

@ -156,6 +156,8 @@ Package.onUse(function(api) {
api.addFiles('client/components/confirmRemoveTimepointAssociation/confirmRemoveTimepointAssociation.html', 'client');
api.addFiles('client/components/confirmRemoveTimepointAssociation/confirmRemoveTimepointAssociation.js', 'client');
api.addFiles('client/components/lastLoginModal/lastLoginModal.html', 'client');
api.addFiles('client/components/lastLoginModal/lastLoginModal.js', 'client');
// Server functions
api.addFiles('server/collections.js', 'server');

View File

@ -45,6 +45,18 @@ Meteor.methods({
} else {
Reviewers.insert({timepointId: timepoint.timepointId, reviewers: [{userId: user._id, userName: user.profile.fullName}]});
}
// Log
var hipaaEvent = {
eventType: 'modify',
userId: Meteor.userId(),
userName: Meteor.user().profile.fullName,
collectionName: "Measurements",
recordId: study.studyInstanceUid,
patientId: study.patientId,
patientName: study.patientName
};
HipaaLogger.logEvent(hipaaEvent);
},
removeReviewer: function (timepointId) {
@ -70,6 +82,10 @@ Meteor.methods({
Reviewers.find().map(function (timepoint) {
Reviewers.update({_id: timepoint._id}, {"$pull": {"reviewers": {"userId": userId}}});
});
},
getPriorLoginDate: function() {
return Meteor.users.findOne({_id: Meteor.userId()}, {fields: {priorLoginDate: 1}});
}
});