Skip to content

Commit

Permalink
Updated hts last day of the month day
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrianbet committed Dec 16, 2024
1 parent 6195b0c commit 216a7ac
Show file tree
Hide file tree
Showing 20 changed files with 70 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export const fetchLinkageNumberNotLinkedByFacility = () => async (dispatch, getS
: '',
fromDate: getState().filters.fromDate
? moment(getState().filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment().subtract(2, 'month').add(17, 'days').format('YYYYMM'),
: moment().subtract(2, 'month').add(10, 'days').format('YYYYMM'),
toDate: getState().filters.toDate
? moment(getState().filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment().subtract(2, 'month').add(17, 'days').format('YYYYMM'),
: moment().subtract(2, 'month').add(10, 'days').format('YYYYMM'),
};
const response = await getAll('hts/linkageNumberNotLinkedByFacility', params);
dispatch({ type: actionTypes.HTS_LINKAGE_NUMBER_NOT_LINKED_BY_FACILITY_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
Expand Down
2 changes: 1 addition & 1 deletion src/actions/HTS/Linkage/linkagePositiveTrendsActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const fetchLinkagePositiveTrends = () => async (dispatch, getState) => {
: '',
fromDate: getState().filters.fromDate
? moment(getState().filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment().subtract(12, 'month').add(17, 'days').format('YYYYMM'),
: moment().subtract(12, 'month').add(10, 'days').format('YYYYMM'),
toDate: getState().filters.toDate
? moment(getState().filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment().format('YYYYMM'),
Expand Down
2 changes: 1 addition & 1 deletion src/selectors/CT/CurrentOnArt/currentOnArt.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export const getCurrentOnArt = createSelector(

return list.TXCURR;
}
);
);
12 changes: 9 additions & 3 deletions src/views/HTS/Linkage/LinkageByAgeSex.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const LinkageByAgeSex = () => {
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down Expand Up @@ -65,8 +65,14 @@ const LinkageByAgeSex = () => {
}
}
for(let i = 0; i < result.length; i++) {
let ageGroup = result[i].AgeGroup
if([" Under 1", "01 to 04"].includes(result[i].AgeGroup)){
ageGroup = "Under 5"
}else if(["05 to 09"].includes(result[i].AgeGroup)){
ageGroup = "5 to 9"
}
let sexIndex = sexCategories.indexOf(result[i].Gender.toUpperCase());
let ageIndex = ageCategories.indexOf(result[i].AgeGroup);
let ageIndex = ageCategories.indexOf(ageGroup);
if(sexIndex === -1 || ageIndex === -1) { // unsupported
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/HTS/Linkage/LinkageByCounty.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ const LinkageByCounty = () => {
fromDate: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment().subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down
4 changes: 2 additions & 2 deletions src/views/HTS/Linkage/LinkageByPartner.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const LinkageByPartner = () => {
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down
8 changes: 4 additions & 4 deletions src/views/HTS/Linkage/LinkageByStrategyEntryPoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ const LinkageByStrategyEntryPoint = () => {
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down Expand Up @@ -78,13 +78,13 @@ const LinkageByStrategyEntryPoint = () => {
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down
4 changes: 2 additions & 2 deletions src/views/HTS/Linkage/LinkageNumberPositive.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ const LinkageNumberPositive = () => {
: new Date().getFullYear(),
fromDate: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment().subtract(14, 'month').format('YYYYMM'),
: moment().subtract(10, 'month').format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
// params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down
6 changes: 3 additions & 3 deletions src/views/HTS/Linkage/LinkageOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ const LinkageOverview = () => {
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
const result = await getAll('hts/linkageBySex', params);
Expand All @@ -60,7 +60,7 @@ const LinkageOverview = () => {
femaleLinked: 0,
femaleLinkedPercent: 0,
}

for(let i = 0; i < result.length; i++) {
data.totalPositive = data.totalPositive + parseInt(result[i].positive);
data.totalLinked = data.totalLinked + parseInt(result[i].linked);
Expand Down
4 changes: 2 additions & 2 deletions src/views/HTS/PNS/PNSPositivityTrends.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const PNSPositivityTrends = () => {
if((year.toString() === fullYear.toString()) && (result_month <= lastYearMonth && result_year.toString() === lastFullYear.toString())) {
continue;
}
let positiveR = parseInt(result[i].positive, 10) + parseInt(result2[i] ? result2[i].positive:0, 10);
let positiveRT = parseInt(result3[i].positive ? result3[i].positive:0, 10);
let positiveR = parseInt(result[i].positive, 10) + parseInt(result2[i] ? result2[i]?.positive:0, 10);
let positiveRT = parseInt(result3[i]?.positive ? result3[i]?.positive:0, 10);
tested.push(positiveRT);
months.push(monthNames[result[i].month] + ' ' + result_year.toString());
linked.push(positiveR);
Expand Down
1 change: 0 additions & 1 deletion src/views/HTS/Uptake/Uptake.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import UptakeOverview from './UptakeOverview';
import UptakeByAgeSex from './UptakeByAgeSex';
import UptakeByCounty from './UptakeByCounty';
import UptakeByPartner from './UptakeByPartner';
import UptakeByPopulationType from './UptakeByPopulationType';
import UptakeMonthsSinceLastTest from './UptakeMonthsSinceLastTest';
import UptakeTBScreeningAndTBOutcome from './UptakeTBScreeningAndTBOutcome';
import UptakeTestingStrategy from './UptakeTestingStrategy';
Expand Down
8 changes: 4 additions & 4 deletions src/views/HTS/Uptake/UptakeByAgeSex.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ const UptakeByAgeSex = () => {
project: filters.projects,
year: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYY')
: moment().subtract(2, 'month').add(17, 'days').format('YYYY'),
: moment().subtract(2, 'month').add(10, 'days').format('YYYY'),
month: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('MM')
: moment().subtract(2, 'month').add(17, 'days').format('MM'),
: moment().subtract(2, 'month').add(10, 'days').format('MM'),
fromDate: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
// params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down
8 changes: 4 additions & 4 deletions src/views/HTS/Uptake/UptakeByCounty.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ const UptakeByCounty = () => {
project: filters.projects,
year: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYY')
: moment().subtract(2, 'month').add(17, 'days').format('YYYY'),
: moment().subtract(2, 'month').add(10, 'days').format('YYYY'),
month: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('MM')
: moment().subtract(2, 'month').add(17, 'days').format('MM'),
: moment().subtract(2, 'month').add(10, 'days').format('MM'),
fromDate: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
// params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down
8 changes: 4 additions & 4 deletions src/views/HTS/Uptake/UptakeByPartner.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ const UptakeByPartner = () => {
project: filters.projects,
year: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYY')
: moment().subtract(2, 'month').add(17, 'days').format('YYYY'),
: moment().subtract(2, 'month').add(10, 'days').format('YYYY'),
month: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('MM')
: moment().subtract(2, 'month').add(17, 'days').format('MM'),
: moment().subtract(2, 'month').add(10, 'days').format('MM'),
fromDate: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
// params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down
8 changes: 4 additions & 4 deletions src/views/HTS/Uptake/UptakeMonthsSinceLastTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ const UptakeMonthsSinceLastTest = () => {
project: filters.projects,
year: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYY')
: moment().subtract(2, 'month').add(17, 'days').format('YYYY'),
: moment().subtract(2, 'month').add(10, 'days').format('YYYY'),
month: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('MM')
: moment().subtract(2, 'month').add(17, 'days').format('MM'),
: moment().subtract(2, 'month').add(10, 'days').format('MM'),
fromDate: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
// params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down
4 changes: 2 additions & 2 deletions src/views/HTS/Uptake/UptakeNumberTestedAndPositivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const UptakeNumberTestedAndPositivity = () => {
fromDate: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment().subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment().subtract(2, 'month').add(17, 'days').format('YYYYMM'),
: moment().subtract(2, 'month').add(10, 'days').format('YYYYMM'),
};
// params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
const result = await getAll('hts/numberTestedAndPositivity', params);
Expand Down
8 changes: 4 additions & 4 deletions src/views/HTS/Uptake/UptakeOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ const UptakeOverview = () => {
project: filters.projects,
year: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYY')
: moment().subtract(2, 'month').add(17, 'days').format('YYYY'),
: moment().subtract(2, 'month').add(10, 'days').format('YYYY'),
month: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('MM')
: moment().subtract(2, 'month').add(17, 'days').format('MM'),
: moment().subtract(2, 'month').add(10, 'days').format('MM'),
fromDate: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
const result = await getAll('hts/uptakeBySex', params);
Expand Down
8 changes: 4 additions & 4 deletions src/views/HTS/Uptake/UptakeTBScreeningAndTBOutcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ const UptakeTBScreeningAndTBOutcome = () => {
project: filters.projects,
year: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYY')
: moment().subtract(2, 'month').add(17, 'days').format('YYYY'),
: moment().subtract(2, 'month').add(10, 'days').format('YYYY'),
month: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('MM')
: moment().subtract(2, 'month').add(17, 'days').format('MM'),
: moment().subtract(2, 'month').add(10, 'days').format('MM'),
fromDate: filters.fromDate
? moment(filters.fromDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
toDate: filters.toDate
? moment(filters.toDate, 'MMM YYYY').format('YYYYMM')
: moment()
.subtract(2, 'month')
.add(17, 'days')
.add(10, 'days')
.format('YYYYMM'),
};
// params.month = filters.fromDate ? moment(filters.fromDate, "MMM YYYY").format("MM") : '';
Expand Down
Loading

0 comments on commit 216a7ac

Please sign in to comment.