Skip to content

Commit

Permalink
POC-438: Add alert/reminder to indicate patient risk score (#1301)
Browse files Browse the repository at this point in the history
Co-authored-by: Drizzentic <[email protected]>
  • Loading branch information
corneliouzbett and drizzentic authored Aug 2, 2023
1 parent 2527f8c commit 8ce914e
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
27 changes: 27 additions & 0 deletions app/reporting-framework/json-reports/clinical-reminder-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@
"joinCondition": "t3.person_uuid = t1.uuid"
}
},
{
"table": "predictions.ml_weekly_predictions",
"alias": "mwl",
"join": {
"type": "left",
"joinCondition": "mwl.person_id = t1.person_id"
}
},
{
"table": "amrs.relationship",
"alias": "t6",
Expand Down Expand Up @@ -260,6 +268,21 @@
"alias": "vl_error_date",
"column": "t2.test_datetime"
},
{
"type": "simple_column",
"alias": "predicted_risk",
"column": "mwl.predicted_risk"
},
{
"type": "simple_column",
"alias": "predicted_prob_disengage",
"column": "mwl.predicted_prob_disengage"
},
{
"type": "simple_column",
"alias": "prediction_generated_date",
"column": "mwl.prediction_generated_date"
},
{
"type": "simple_column",
"alias": "test_date",
Expand Down Expand Up @@ -463,6 +486,10 @@
{
"column": "t1.encounter_datetime",
"order": "desc"
},
{
"column": "mwl.prediction_generated_date",
"order": "desc"
}
]
},
Expand Down
46 changes: 46 additions & 0 deletions service/patient-reminder.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,46 @@ function getFPExpiryDate(data) {
}
}

function generateAppointmentNoShowUpRiskReminder(data) {
let reminders = [];
const predicted_score = (data.predicted_prob_disengage * 100).toFixed(2);
if (data.predicted_risk) {
if (data.predicted_risk === 'Medium Risk') {
reminders.push({
message:
'Appointment no-show risk is ' +
predicted_score +
'% (generated on ' +
Moment(data.prediction_generated_date).format('DD-MM-YYYY') +
'). Please call to confirm upcoming appointment.',
title: 'Appointment no show risk reminder',
type: 'warning',
display: {
banner: true,
toast: true
}
});
}
if (data.predicted_risk === 'High Risk') {
reminders.push({
message:
'Appointment no-show risk is ' +
predicted_score +
'% generated on ' +
Moment(data.prediction_generated_date).format('DD-MM-YYYY') +
'. Please call to confirm upcoming appointment.',
title: 'Appointment no show risk reminder',
type: 'danger',
display: {
banner: true,
toast: true
}
});
}
}
return reminders;
}

async function generateReminders(etlResults, eidResults) {
// console.log('REMINDERS generateReminders');
let reminders = [];
Expand Down Expand Up @@ -940,6 +980,9 @@ async function generateReminders(etlResults, eidResults) {
let fp_discontinuation_reminder = generateDiscontinueContraceptionReminder(
data
);
let appointmentNoShowUpRiskReminder = generateAppointmentNoShowUpRiskReminder(
data
);

let currentReminder = [];
if (pending_vl_lab_result.length > 0) {
Expand Down Expand Up @@ -968,6 +1011,9 @@ async function generateReminders(etlResults, eidResults) {

reminders = reminders.concat(currentReminder);

// Add appointment no show up risk reminder
reminders = reminders.concat(appointmentNoShowUpRiskReminder);

patientReminder.reminders = reminders;
return patientReminder;
}
Expand Down

0 comments on commit 8ce914e

Please sign in to comment.