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

HIV-913: Added age validation to Cervical Cancer Screening Reminders #1140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 5 additions & 4 deletions service/cervical-cancer-screening-service.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const db = require('../etl-db');

const defs = {
getPatientLatestCericalScreeningResult,
getPatientLatestCervicalScreeningResult,
getPatientCervicalCancerScreeningSummary
};

function getPatientLatestCericalScreeningResult(personId) {
function getPatientLatestCervicalScreeningResult(personId) {
return new Promise((resolve, reject) => {
const sql = `SELECT
person_id,
Expand All @@ -16,10 +16,11 @@ function getPatientLatestCericalScreeningResult(personId) {
WHEN TIMESTAMPDIFF(YEAR,test_datetime,now()) >= 1 THEN 1
ELSE NULL
END AS 'qualifies_for_via_or_via_vili_retest'
FROM
etl.flat_labs_and_imaging
FROM etl.flat_labs_and_imaging
inner join amrs.person using(person_id)
WHERE
via_or_via_vili IS NOT NULL AND person_id = ${personId}
AND extract(year from (from_days(datediff(now(),birthdate)))) <= 50
ORDER BY test_datetime DESC LIMIT 1;`;

const queryParts = {
Expand Down
6 changes: 3 additions & 3 deletions service/patient-reminder.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ async function generateReminders(etlResults, eidResults) {
let unenrol_ovc_reminder = await ovcUnenrollmentReminder(data);
let contact_tracing_reminder = await getFamilyTestingReminder(etlResults);

let cervical_screening_reminder = await getCerivalScreeningReminder(
let cervical_screening_reminder = await getCervicalScreeningReminder(
person_id
);
let due_for_contraception_refill = generateContraceptionRefillReminder(data);
Expand Down Expand Up @@ -800,10 +800,10 @@ function getPatientPrograms(uuid, params) {
});
}

function getCerivalScreeningReminder(personId) {
function getCervicalScreeningReminder(personId) {
return new Promise((resolve, reject) => {
cervicalCancerScreeningService
.getPatientLatestCericalScreeningResult(personId)
.getPatientLatestCervicalScreeningResult(personId)
.then((result) => {
console.log(result);
let reminder = [];
Expand Down