Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC-438: Add alert/reminder to indicate patient risk score #1301

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading