Skip to content

Commit

Permalink
POC-130: End point to expose Patients with validation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Eriq-Kibet committed Feb 8, 2023
1 parent 94051ba commit bd1c883
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/routes/client-validation-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const routes = [
handler: function (request, reply) {
let service = new ClientValidationIssues();
service
.generateAggregates()
.generateVerificationClients(request.query)
.then((res) => reply(res))
.catch((err) => {
console.log('ERROR l13', err);
Expand Down
7 changes: 4 additions & 3 deletions service/client-validation-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ var db = require('../etl-db');
const Promise = require('bluebird');

export class ClientValidationIssues {
generateAggregates() {
generateVerificationClients(params) {
const that = this;
return new Promise(function (resolve, reject) {
const sql = that.aggregateQuery();
const sql = that.verificationClientsQuery(params.locationUuid);
const queryParts = {
sql: sql
};
Expand All @@ -15,7 +15,7 @@ export class ClientValidationIssues {
});
}

aggregateQuery() {
verificationClientsQuery(location) {
return `SELECT
County,
l.name AS 'Health Facility',
Expand Down Expand Up @@ -66,6 +66,7 @@ FROM
inner join etl.nupi_verification nv on nv.clientNumber=id.identifier
WHERE
fh.location_id != 195
AND fh.location_id = '${location}'
AND fh.next_clinical_datetime_hiv IS NULL
AND fh.is_clinical_encounter = 1
AND (TIMESTAMPDIFF(DAY, fh.rtc_date, CURDATE()) < 30)
Expand Down

0 comments on commit bd1c883

Please sign in to comment.