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-496 #1327

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

POC-496 #1327

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
4 changes: 3 additions & 1 deletion etl-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ import { DefaulterListService } from './service/defaulter-list-service';
import { ClinicFlowService } from './service/clinic-flow-service';
import { getPatientCovidVaccinationStatus } from './service/covid-19/covid-19-vaccination-summary';
import { Covid19MonthlyReport } from './service/covid-19/covid-19-monthly-report';
import { MlWeeklyPredictionsService } from './service/ml-weekly-predictions.service';
import { getPatientPredictedScore } from './service/predictions/ml-prediction-service';
const {
default: MlWeeklyPredictionsService
} = require('./service/ml-weekly-predictions.service');
Angie-540 marked this conversation as resolved.
Show resolved Hide resolved

module.exports = (function () {
var routes = [
Expand Down
27 changes: 25 additions & 2 deletions programs/patient-data-resolver.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ const etlHivSummary = require('../dao/patient/etl-patient-hiv-summary-dao');
const encounterService = require('../service/openmrs-rest/encounter');
const dcPatientvisitEvaluator = require('../service/dc-patient-visit-evaluator');
const covidAssessmentService = require('../service/covid-assessment-service');
const weeklyPredictionsService = require('../service/ml-weekly-predictions.service');
Angie-540 marked this conversation as resolved.
Show resolved Hide resolved
var _ = require('underscore');
const {
default: MlWeeklyPredictionsService
} = require('../service/ml-weekly-predictions.service');
Angie-540 marked this conversation as resolved.
Show resolved Hide resolved

const availableKeys = {
patient: getPatient,
Expand All @@ -18,7 +22,8 @@ const availableKeys = {
patientEncounters: getPatientEncounters,
isPatientTransferredOut: checkTransferOut,
dcQualifedVisits: getQualifiedDcVisits,
latestCovidAssessment: getLatestCovidAssessment
latestCovidAssessment: getLatestCovidAssessment,
weeklyPredictedPatients: getWeeklyPredictedPatients
};

const def = {
Expand All @@ -31,7 +36,8 @@ const def = {
getPatientEncounters: getPatientEncounters,
checkTransferOut: checkTransferOut,
dcQualifedVisits: getQualifiedDcVisits,
getLatestCovidAssessment: getLatestCovidAssessment
getLatestCovidAssessment: getLatestCovidAssessment,
getWeeklyPredictedPatients: getWeeklyPredictedPatients
};

module.exports = def;
Expand Down Expand Up @@ -198,3 +204,20 @@ function getLatestCovidAssessment(patientUuid) {
});
});
}

function getWeeklyPredictedPatients(patientUuid) {
return new Promise((resolve, reject) => {
let ml = new MlWeeklyPredictionsService();
ml.getPatientsWithPredictions(patientUuid)
.then((result) => {
if (result.length > 0) {
resolve(result);
} else {
resolve([]);
}
})
.catch((error) => {
reject(error);
});
});
}
72 changes: 45 additions & 27 deletions programs/patient-program-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"enrollment",
"patientEncounters",
"isPatientTransferredOut",
"latestCovidAssessment"
"latestCovidAssessment",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -816,7 +817,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "programLocation === intendedVisitLocationUuid && MlLocations",
"allowedIf": "programLocation === intendedVisitLocationUuid && inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -1268,7 +1269,8 @@
"patientEnrollment",
"patientEncounters",
"isPatientTransferredOut",
"latestCovidAssessment"
"latestCovidAssessment",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"enrollIf": "gender === 'F'",
Expand Down Expand Up @@ -2010,7 +2012,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "programLocation === intendedVisitLocationUuid && MlLocations",
"allowedIf": "programLocation === intendedVisitLocationUuid && inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -2211,7 +2213,8 @@
"enrollment",
"hivLastTenClinicalEncounters",
"patientEncounters",
"latestCovidAssessment"
"latestCovidAssessment",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -2400,7 +2403,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "programLocation === intendedVisitLocationUuid && MlLocations",
"allowedIf": "programLocation === intendedVisitLocationUuid && inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -2436,14 +2439,17 @@
}
]
},

"c19aec66-1a40-4588-9b03-b6be55a8dd1d": {
"name": "PrEP PROGRAM",
"dataDependencies": [
"patient",
"enrollment",
"hivLastTenClinicalEncounters",
"patientEncounters",
"latestCovidAssessment"
"latestCovidAssessment",
"weeklyPredictedPatients",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -2628,7 +2634,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "MlLocations",
"allowedIf": "inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -2662,7 +2668,8 @@
"patient",
"enrollment",
"hivLastTenClinicalEncounters",
"latestCovidAssessment"
"latestCovidAssessment",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -2845,7 +2852,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "MlLocations",
"allowedIf": "inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -2939,7 +2946,8 @@
"patientEncounters",
"isPatientTransferredOut",
"dcQualifedVisits",
"latestCovidAssessment"
"latestCovidAssessment",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -3241,7 +3249,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "programLocation === intendedVisitLocationUuid && MlLocations",
"allowedIf": "programLocation === intendedVisitLocationUuid && inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -4169,7 +4177,8 @@
"dataDependencies": [
"patient",
"enrollment",
"hivLastTenClinicalEncounters"
"hivLastTenClinicalEncounters",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -4273,7 +4282,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "programLocation === intendedVisitLocationUuid && MlLocations",
"allowedIf": "programLocation === intendedVisitLocationUuid && inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -4306,7 +4315,8 @@
"dataDependencies": [
"patient",
"enrollment",
"hivLastTenClinicalEncounters"
"hivLastTenClinicalEncounters",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -4412,7 +4422,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "MlLocations",
"allowedIf": "inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -4547,7 +4557,8 @@
"patientEnrollment",
"isPatientTransferredOut",
"patientEncounters",
"latestCovidAssessment"
"latestCovidAssessment",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -4793,7 +4804,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "MlLocations",
"allowedIf": "inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -4834,7 +4845,8 @@
"dataDependencies": [
"patient",
"enrollment",
"hivLastTenClinicalEncounters"
"hivLastTenClinicalEncounters",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"stateChangeEncounterTypes": {
Expand Down Expand Up @@ -4900,7 +4912,8 @@
"dataDependencies": [
"patient",
"enrollment",
"hivLastTenClinicalEncounters"
"hivLastTenClinicalEncounters",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -5046,7 +5059,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "MlLocations",
"allowedIf": "inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -5115,7 +5128,8 @@
"dataDependencies": [
"patient",
"enrollment",
"hivLastTenClinicalEncounters"
"hivLastTenClinicalEncounters",
"weeklyPredictedPatients"
],
"incompatibleWith": [],
"visitTypes": [
Expand Down Expand Up @@ -5150,7 +5164,7 @@
{
"uuid": "6bdec0cd-d3fb-41da-9ef3-20076f349dc1",
"name": "Pre Appointment Follow Up Visit",
"allowedIf": "programLocation === intendedVisitLocationUuid && MlLocations",
"allowedIf": "programLocation === intendedVisitLocationUuid && inPrediction",
"encounterTypes": [
{
"uuid": "d5e2d3b3-2061-4721-86f1-5852cde6475a",
Expand Down Expand Up @@ -5509,7 +5523,8 @@
"patient",
"enrollment",
"patientEncounters",
"isPatientTransferredOut"
"isPatientTransferredOut",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"requiredProgramQuestions": [
Expand Down Expand Up @@ -5575,7 +5590,8 @@
"patient",
"enrollment",
"patientEncounters",
"patientEnrollment"
"patientEnrollment",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"enrollIf": "gender === 'F'"
Expand Down Expand Up @@ -5645,7 +5661,8 @@
"patient",
"enrollment",
"patientEncounters",
"patientEnrollment"
"patientEnrollment",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"enrollIf": "gender === 'F'"
Expand Down Expand Up @@ -5723,7 +5740,8 @@
"patient",
"enrollment",
"patientEncounters",
"patientEnrollment"
"patientEnrollment",
"weeklyPredictedPatients"
],
"enrollmentOptions": {
"enrollIf": "gender === 'F'"
Expand Down
10 changes: 9 additions & 1 deletion programs/scope-builder.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ function buildScope(dataDictionary) {
qualifiesMedicationRefillVisit: false,
lastCovidScreeningDate: '',
retroSpective: false,
screenedForCovidToday: false
screenedForCovidToday: false,
inPrediction: false
};

let isStandardDcVisit = false;

if (
dataDictionary.weeklyPredictedPatients &&
dataDictionary.weeklyPredictedPatients.length > 0
) {
scope.inPrediction = true;
}
// Restrict to Pilot locations
scope.MlLocations = [
'08feb8ae-1352-11df-a1f1-0026b9348838',
Expand Down
Loading