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

Prod #816

Merged
merged 28 commits into from
Apr 24, 2024
Merged

Prod #816

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e9f15f9
Merge pull request #808 from palladiumkenya/feat/new-reporting-layer
cbrianbet Oct 19, 2023
a6ca6cf
Merge pull request #810 from palladiumkenya/feat/new-reporting-layer
cbrianbet Oct 19, 2023
1e50797
Merge pull request #812 from palladiumkenya/feat/new-reporting-layer
cbrianbet Nov 14, 2023
7b6af7b
U=U dashboards added
cbrianbet Dec 6, 2023
0dfc32a
Connected apis to charts
cbrianbet Dec 7, 2023
57e312c
Connected apis to charts
cbrianbet Dec 7, 2023
b5199c1
change spelling errors
cbrianbet Dec 14, 2023
c015101
sorting edge cases
cbrianbet Dec 19, 2023
deb3a4a
Update dsdAppointmentDurationByAge.js
cbrianbet Dec 19, 2023
5a88ffe
Update RROverview.js
cbrianbet Dec 20, 2023
179a103
Added indicator notes to AE
cbrianbet Jan 8, 2024
902a014
Updated % chart for otz agegroup
cbrianbet Jan 15, 2024
65822ec
Update otzEnrollmentAmongAlHivByAge.js
cbrianbet Jan 15, 2024
cab4a1d
Update Resources.js
cbrianbet Feb 8, 2024
5068360
Added , separator in u to u charts
cbrianbet Feb 8, 2024
d27a9ff
Fixed treatment outcome selectors
cbrianbet Feb 19, 2024
7568787
Fixed RR chart not showing
cbrianbet Feb 19, 2024
4679dac
Update ViralLoadU_U.js
cbrianbet Mar 11, 2024
c50b989
2dp add to art verification calculations
cbrianbet Mar 11, 2024
0e36ada
Update CurrentOnArtOverview.js
cbrianbet Mar 11, 2024
e539100
Added proportions pie charts
cbrianbet Mar 11, 2024
a4045b1
Fixed denomenator for proportion chart
cbrianbet Mar 11, 2024
d90fcc6
Update HomeVLCascade.js
cbrianbet Mar 18, 2024
dc92767
Added extra filters to u=u dashboards
cbrianbet Mar 21, 2024
f030ca7
Fixed nupi charts
cbrianbet Apr 16, 2024
bd25091
updated rr export files
cbrianbet Apr 17, 2024
d67531b
Reporting month fixed to constant variable
cbrianbet Apr 17, 2024
e4754fd
Update overallReportingRatesByFacilityReported.js
cbrianbet Apr 17, 2024
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: 2 additions & 2 deletions src/actions/CT/NewOnArt/currentNewOnArtOverviewActions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import moment from 'moment';
import * as actionTypes from '../../types';
import { getAll } from '../../../views/Shared/Api';
import { CACHING, PAGES } from '../../../constants';
import { CACHING, ETL_DAY, PAGES } from '../../../constants';

export const loadCurrentNewOnArtOverview = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
Expand All @@ -22,7 +22,7 @@ export const loadCurrentNewOnArtOverview = () => async (dispatch, getState) => {

export const fetchCurrentNewOnArtOverview = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.CT_CURRENT_NEW_ON_ART_OVERVIEW_REQUEST });
const previousMonth = moment().subtract(2, 'month').add(16, 'days');
const previousMonth = moment().subtract(2, 'month').add(ETL_DAY, 'days');
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
Expand Down
4 changes: 2 additions & 2 deletions src/actions/CT/NewOnArt/newOnArtByAgeSexActions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import moment from 'moment';
import * as actionTypes from '../../types';
import { getAll } from '../../../views/Shared/Api';
import { CACHING, PAGES } from '../../../constants';
import { CACHING, ETL_DAY, PAGES } from '../../../constants';

export const loadNewOnArtByAgeSex = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
Expand All @@ -21,7 +21,7 @@ export const loadNewOnArtByAgeSex = () => async (dispatch, getState) => {

export const fetchNewOnArtByAgeSex = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.CT_NEW_ON_ART_BY_AGE_SEX_REQUEST });
const previousMonth = moment().subtract(2, 'month').add(16, 'days');
const previousMonth = moment().subtract(2, 'month').add(ETL_DAY, 'days');
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
Expand Down
42 changes: 42 additions & 0 deletions src/actions/CT/ViralLoad/viralLoadCategorizationUToUActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import moment from 'moment';
import * as actionTypes from '../../types';
import { getAll } from '../../../views/Shared/Api';
import { CACHING } from '../../../constants';

export const loadViralLoadCategorizationUToU = (tab) => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().viralLoadCategorizationUToU.lastFetch),
'minutes'
);
if (getState().ui.ctTab !== 'vl' &&
tab !== 'vl') {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchViralLoadCategorizationUToU());
}
};

export const fetchViralLoadCategorizationUToU = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
pbfw: getState().filters.pbfws,
gender: getState().filters.genders,
datimAgeGroup: getState().filters.datimAgeGroups,
};
const response = await getAll(
'care-treatment/vlCategorizationUToU',
params
);
dispatch({
type: actionTypes.CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_FETCH,
payload: { filtered: getState().filters.filtered, list: response },
});
};
37 changes: 37 additions & 0 deletions src/actions/CT/ViralLoad/viralLoadUptakeUToUActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import moment from 'moment';
import * as actionTypes from '../../types';
import { getAll } from '../../../views/Shared/Api';
import { CACHING } from '../../../constants';

export const loadViralLoadUptakeUToU = (tab) => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().viralLoadUptakeUToU.lastFetch),
'minutes'
);
if (getState().ui.ctTab !== 'vl' &&
tab !== 'vl') {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchViralLoadUptakeUToU());
}
};

export const fetchViralLoadUptakeUToU = () => async (dispatch, getState) => {
console.log(getState().filters);
dispatch({ type: actionTypes.CT_VIRAL_LOAD_UPTAKE_U_TO_U_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
pbfw: getState().filters.pbfws,
gender: getState().filters.genders,
datimAgeGroup: getState().filters.datimAgeGroups,
};
const response = await getAll('care-treatment/vlUptakeUToU', params);
dispatch({ type: actionTypes.CT_VIRAL_LOAD_UPTAKE_U_TO_U_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import moment from 'moment';
import * as actionTypes from '../../types';
import { getAll } from '../../../views/Shared/Api';
import { CACHING, PAGES } from '../../../constants';
import { CACHING, ETL_DAY, PAGES } from '../../../constants';

export const loadCurrOnARTKHISByCounty = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
Expand Down Expand Up @@ -30,8 +30,8 @@ export const fetchCurrOnARTKHISByCounty = () => async (dispatch, getState) => {
project: getState().filters.projects,
gender: getState().filters.genders,
datimAgeGroup: getState().filters.datimAgeGroups,
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : moment().subtract(2, 'month').add(16, 'days').format("YYYY"),
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : moment().subtract(2, 'month').add(16, 'days').format("MM"),
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : moment().subtract(2, 'month').add(ETL_DAY, 'days').format("YYYY"),
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : moment().subtract(2, 'month').add(ETL_DAY, 'days').format("MM"),
};
const response = await getAll('operational-his/getTxCurrKHISCounty', params);
dispatch({ type: actionTypes.KHIS_CURR_ON_ART_BY_COUNTY_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import moment from 'moment';
import * as actionTypes from '../../types';
import { getAll } from '../../../views/Shared/Api';
import { CACHING, PAGES } from '../../../constants';
import { CACHING, ETL_DAY, PAGES } from '../../../constants';

export const loadNewOnARTPartnerFacilityDWH = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
Expand Down Expand Up @@ -30,8 +30,8 @@ export const fetchNewOnARTByFacilityDWH = () => async (dispatch, getState) => {
project: getState().filters.projects,
gender: getState().filters.genders,
datimAgeGroup: getState().filters.datimAgeGroups,
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : moment().subtract(2, 'month').add(16, 'days').format("YYYY"),
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : moment().subtract(2, 'month').add(16, 'days').format("MM"),
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : moment().subtract(2, 'month').add(ETL_DAY, 'days').format("YYYY"),
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : moment().subtract(2, 'month').add(ETL_DAY, 'days').format("MM"),
};
const response = await getAll('operational-his/getTxNewBySexDwh', params);
dispatch({ type: actionTypes.DWH_NEW_ON_ART_BY_PARTNER_FACILITY_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
Expand Down
5 changes: 2 additions & 3 deletions src/actions/RR/overallReportingRatesByFacilityNotReported.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';
import moment from 'moment';
import * as actionTypes from '../types';
import { CACHING, DWH_API_URL, PAGES } from '../../constants';
import { CACHING, DWH_API_URL, ETL_DAY, PAGES } from '../../constants';

export const loadOverallReportingRatesByFacilityNotReported = () => async (dispatch, getState) => {
const docket = getState().ui.rrTab;
Expand Down Expand Up @@ -33,11 +33,10 @@ export const fetchOverallReportingRatesByFacilityNotReported = () => async (disp
params.period = getState().filters.fromDate
? moment(getState().filters.fromDate, 'MMM YYYY')
.startOf('month')
.subtract(0, 'month')
.format('YYYY,M')
: moment()
.subtract(1, 'month')
.add(16, 'days')
.add(ETL_DAY, 'days')
.format('YYYY,M');
try {
const response = await axios.get(`${DWH_API_URL}manifests/overallReportingByFacility/${docket}`, { params: params });
Expand Down
6 changes: 3 additions & 3 deletions src/actions/RR/overallReportingRatesByFacilityReported.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';
import moment from 'moment';
import * as actionTypes from '../types';
import { CACHING, DWH_API_URL, PAGES } from '../../constants';
import { CACHING, DWH_API_URL, ETL_DAY, PAGES } from '../../constants';

export const loadOverallReportingRatesByFacilityReported = () => async (dispatch, getState) => {
const docket = getState().ui.rrTab;
Expand Down Expand Up @@ -29,9 +29,9 @@ export const fetchOverallReportingRatesByFacilityReported = () => async (dispatc
params.period = getState().filters.fromDate
? moment(getState().filters.fromDate, 'MMM YYYY')
.startOf('month')
.subtract(0, 'month')
.add(1, 'month')
.format('YYYY,M')
: moment().subtract(1, 'month').add(16, 'days').format('YYYY,M');
: moment().subtract(1, 'month').add(ETL_DAY, 'days').format('YYYY,M');
try {
const response = await axios.get(`${DWH_API_URL}manifests/overallReportingByFacility/${docket}`, { params: params });
dispatch({ type: actionTypes.RR_OVERALL_REPORTING_RATES_BY_FACILITY_REPORTED_FETCH, payload: { filtered: getState().filters.filtered, docket: docket, list: response.data }});
Expand Down
13 changes: 13 additions & 0 deletions src/actions/Shared/filterActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export const filterByAgency = agencies => ({
payload: { agencies }
});

export const filterByPBFW = (pbfws) => ({
type: actionTypes.FILTER_BY_PBFW,
payload: { pbfws },
});

export const filterByProject = projects => ({
type: actionTypes.FILTER_BY_PROJECT,
payload: { projects }
Expand Down Expand Up @@ -99,6 +104,14 @@ export const disableAgencyFilter = () => ({
type: actionTypes.DISABLE_AGENCY_FILTER
});

export const enablePBFWFilter = () => ({
type: actionTypes.ENABLE_PBFW_FILTER,
});

export const disablePBFWFilter = () => ({
type: actionTypes.DISABLE_PBFW_FILTER,
});

export const enableFacilityFilter = () => ({
type: actionTypes.ENABLE_FACILITY_FILTER
});
Expand Down
9 changes: 9 additions & 0 deletions src/actions/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const FILTER_BY_SUB_COUNTY = 'FILTER_BY_SUB_COUNTY'
export const FILTER_BY_FACILITY = 'FILTER_BY_FACILITY'
export const FILTER_BY_PARTNER = 'FILTER_BY_PARTNER'
export const FILTER_BY_AGENCY = 'FILTER_BY_AGENCY'
export const FILTER_BY_PBFW = 'FILTER_BY_PBFW';
export const FILTER_BY_PROJECT = 'FILTER_BY_PROJECT'
export const FILTER_BY_FROM_DATE = 'FILTER_BY_FROM_DATE'
export const FILTER_BY_TO_DATE = 'FILTER_BY_TO_DATE'
Expand Down Expand Up @@ -33,6 +34,7 @@ export const ENABLE_SUB_COUNTY_FILTER = 'ENABLE_SUB_COUNTY_FILTER'
export const ENABLE_FACILITY_FILTER = 'ENABLE_FACILITY_FILTER'
export const ENABLE_PARTNER_FILTER = 'ENABLE_PARTNER_FILTER'
export const ENABLE_AGENCY_FILTER = 'ENABLE_AGENCY_FILTER'
export const ENABLE_PBFW_FILTER = 'ENABLE_PBFW_FILTER';
export const ENABLE_PROJECT_FILTER = 'ENABLE_PROJECT_FILTER'
export const ENABLE_FROM_DATE_FILTER = 'ENABLE_FROM_DATE_FILTER'
export const ENABLE_TO_DATE_FILTER = 'ENABLE_TO_DATE_FILTER'
Expand All @@ -49,6 +51,7 @@ export const DISABLE_SUB_COUNTY_FILTER = 'DISABLE_SUB_COUNTY_FILTER'
export const DISABLE_FACILITY_FILTER = 'DISABLE_FACILITY_FILTER'
export const DISABLE_PARTNER_FILTER = 'DISABLE_PARTNER_FILTER'
export const DISABLE_AGENCY_FILTER = 'DISABLE_AGENCY_FILTER'
export const DISABLE_PBFW_FILTER = 'DISABLE_PBFW_FILTER';
export const DISABLE_PROJECT_FILTER = 'DISABLE_PROJECT_FILTER'
export const DISABLE_FROM_DATE_FILTER = 'DISABLE_FROM_DATE_FILTER'
export const DISABLE_TO_DATE_FILTER = 'DISABLE_TO_DATE_FILTER'
Expand Down Expand Up @@ -393,6 +396,12 @@ export const CT_VIRAL_LOAD_UPTAKE_BY_COUNTY_REQUEST_FAILED = 'CT_VIRAL_LOAD_UPTA
export const CT_VIRAL_LOAD_UPTAKE_BY_PARTNER_REQUEST = 'CT_VIRAL_LOAD_UPTAKE_BY_PARTNER_REQUEST'
export const CT_VIRAL_LOAD_UPTAKE_BY_PARTNER_FETCH = 'CT_VIRAL_LOAD_UPTAKE_BY_PARTNER_FETCH'
export const CT_VIRAL_LOAD_UPTAKE_BY_PARTNER_REQUEST_FAILED = 'CT_VIRAL_LOAD_UPTAKE_BY_PARTNER_REQUEST_FAILED'
export const CT_VIRAL_LOAD_UPTAKE_U_TO_U_REQUEST = 'CT_VIRAL_LOAD_UPTAKE_U_TO_U_REQUEST'
export const CT_VIRAL_LOAD_UPTAKE_U_TO_U_FETCH = 'CT_VIRAL_LOAD_UPTAKE_U_TO_U_FETCH'
export const CT_VIRAL_LOAD_UPTAKE_U_TO_U_FAILED = 'CT_VIRAL_LOAD_UPTAKE_U_TO_U_FAILED'
export const CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_REQUEST = 'CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_REQUEST'
export const CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_FETCH = 'CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_FETCH'
export const CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_FAILED = 'CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_FAILED'

export const CT_VIRAL_LOAD_OUTCOMES_BY_SEX_REQUEST = 'CT_VIRAL_LOAD_OUTCOMES_BY_SEX_REQUEST'
export const CT_VIRAL_LOAD_OUTCOMES_BY_SEX_FETCH = 'CT_VIRAL_LOAD_OUTCOMES_BY_SEX_FETCH'
Expand Down
2 changes: 2 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ export const GA_TRACKING_ID = 'UA-137589703-2';

export const DWH_API_URL = process.env.REACT_APP_ENDPOINT;
export const HRH_API_URL = 'https://hrh.datacompanion.org';

export const ETL_DAY = 10;
23 changes: 9 additions & 14 deletions src/containers/DefaultLayout/DefaultHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,34 +84,34 @@ const DefaultHeader = () => {
className="d-md-down-none navbar"
style={{ fontSize: '.88em', padding: '.1rem !important' }}
>
<NavItem >
<NavItem>
<NavLink to="/" className="nav-link active">
<strong>Home</strong>
</NavLink>
</NavItem>
<NavItem >
<NavItem>
<NavLink to="/reporting-rates" className="nav-link active">
<strong>Reporting Rates</strong>
</NavLink>
</NavItem>
{/* <NavItem className="px-3">
<NavLink to="/hrh" className="nav-link">HRH</NavLink>
</NavItem> */}
<NavItem >
<NavItem>
<NavLink to="/hiv-testing" className="nav-link active">
<strong>HIV Testing & Prevention</strong>
</NavLink>
</NavItem>
<NavItem >
<NavItem>
<NavLink to="/hiv-treatment" className="nav-link active">
<strong>HIV Treatment</strong>
</NavLink>
</NavItem>
{/* <NavItem>
<NavItem>
<NavLink to="/service-desk" className="nav-link active">
<strong>Service Desk</strong>
</NavLink>
</NavItem> */}
</NavItem>
{/* <NavItem >
<NavLink to="/pmtct-rri" className="nav-link active">
<strong>PMTCT RRI</strong>
Expand All @@ -127,14 +127,9 @@ const DefaultHeader = () => {
</NavItem> */}

<NavItem>
<a
href="https://kenyahmis.org/documentation/data-dictionaries/"
className="nav-link active"
target="_blank"
rel="noopener noreferrer"
>
<NavLink to="/resources" className="nav-link active">
<strong>Resources</strong>
</a>
</NavLink>
</NavItem>
{/* <NavItem >
<a
Expand All @@ -146,7 +141,7 @@ const DefaultHeader = () => {
<strong>GIS</strong>
</a>
</NavItem> */}
<NavItem >
<NavItem>
<NavLink
to="/"
className="nav-link active"
Expand Down
31 changes: 31 additions & 0 deletions src/reducers/CT/ViralLoad/viralLoadCategorizationUToU.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as actionTypes from "../../../actions/types";

const initialState = {
lastFetch: null,
loading: false,
listUnfiltered: [],
listFiltered: [],
};

export default (state = initialState, action) => {
let newState = { ...state };
switch (action.type) {
case actionTypes.CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_REQUEST:
newState.loading = true;
return newState;
case actionTypes.CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_FETCH:
if (action.payload.filtered === true) {
newState.listFiltered = action.payload.list;
} else {
newState.listUnfiltered = action.payload.list;
newState.lastFetch = Date.now();
}
newState.loading = false;
return newState;
case actionTypes.CT_VIRAL_LOAD_CATEGORIZATION_U_TO_U_FAILED:
newState.loading = false;
return newState;
default:
return state
}
}
Loading