Skip to content

Commit

Permalink
Merge pull request #822 from palladiumkenya/feat/new-reporting-layer
Browse files Browse the repository at this point in the history
new prod updates
  • Loading branch information
cbrianbet authored Sep 16, 2024
2 parents 55db17e + bac497a commit cc53af3
Show file tree
Hide file tree
Showing 56 changed files with 4,860 additions and 484 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"@mui/icons-material": "^5.11.11",
"@mui/material": "^5.11.14",
"@reduxjs/toolkit": "^1.8.5",
"@superset-ui/embedded-sdk": "^0.1.0-alpha.8",
"@superset-ui/switchboard": "^1.5.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
Expand All @@ -23,7 +25,7 @@
"highcharts": "^8.2.2",
"highcharts-react-official": "^3.0.0",
"lodash": "^4.17.20",
"moment": "^2.27.0",
"moment": "^2.29.0",
"mui-datatables": "^4.3.0",
"oidc-client": "^1.10.1",
"powerbi-client": "^2.22.2",
Expand Down Expand Up @@ -87,7 +89,8 @@
]
},
"devDependencies": {
"prettier": "^2.2.1"
"prettier": "^2.2.1",
"react-syntax-highlighter": "^15.5.0"
},
"homepage": "."
}
32 changes: 32 additions & 0 deletions src/actions/RR/hisFacilityArtHtsMnchActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityArtHtsMnchAction = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityArtHtsMnch.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityTxcurr());
}
}

export const fetchHisFacilityTxcurr = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_ART_HTS_MNCH_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
};
const response = await getAll('common/facilityArtHtsMnch', params);
dispatch({ type: actionTypes.HIS_FACILITY_ART_HTS_MNCH_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
34 changes: 34 additions & 0 deletions src/actions/RR/hisFacilityByInfrastructureActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityByInfrastructureActions = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityByInfrastructure.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityByInfrastructure());
}
}

export const fetchHisFacilityByInfrastructure = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_BY_INFRASTRUCTURE_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '',
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '',
};
const response = await getAll('common/facilityByInfrastructure', params);
dispatch({ type: actionTypes.HIS_FACILITY_BY_INFRASTRUCTURE_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
34 changes: 34 additions & 0 deletions src/actions/RR/hisFacilityByInfrastructureCountyActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityByInfrastructureCountyActions = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityByInfrastructureCounty.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityByInfrastructure());
}
}

export const fetchHisFacilityByInfrastructure = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_BY_INFRASTRUCTURE_COUNTY_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '',
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '',
};
const response = await getAll('common/facilityByInfrastructureCounty', params);
dispatch({ type: actionTypes.HIS_FACILITY_BY_INFRASTRUCTURE_COUNTY_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
34 changes: 34 additions & 0 deletions src/actions/RR/hisFacilityLevelByCountyActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityLevelByCountyAction = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityStatusByCounty.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityLevelByCounty());
}
}

export const fetchHisFacilityLevelByCounty = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_LEVEL_BY_COUNTY_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '',
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '',
};
const response = await getAll('common/facilityLevelByOwnershipCounty', params);
dispatch({ type: actionTypes.HIS_FACILITY_LEVEL_BY_COUNTY_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
34 changes: 34 additions & 0 deletions src/actions/RR/hisFacilityLevelByPartnerActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityLevelByPartnerAction = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityStatusByPartner.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityLevelByPartner());
}
}

export const fetchHisFacilityLevelByPartner = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_LEVEL_BY_PARTNER_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '',
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '',
};
const response = await getAll('common/facilityLevelByOwnershipPartner', params);
dispatch({ type: actionTypes.HIS_FACILITY_LEVEL_BY_PARTNER_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
34 changes: 34 additions & 0 deletions src/actions/RR/hisFacilityLinelistActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityLinelistAction = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityLinelist.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityLinelist());
}
}

export const fetchHisFacilityLinelist = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_LINELIST_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '',
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '',
};
const response = await getAll('common/facilityLinelist', params);
dispatch({ type: actionTypes.HIS_FACILITY_LINELIST_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
34 changes: 34 additions & 0 deletions src/actions/RR/hisFacilityStatusActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityStatusAction = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityStatus.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityStatus());
}
}

export const fetchHisFacilityStatus = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '',
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '',
};
const response = await getAll('common/facilityStatus', params);
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
32 changes: 32 additions & 0 deletions src/actions/RR/hisFacilityStatusByCountyActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityStatusByCountyAction = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityStatusByPartner.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityStatusByPartner());
}
}

export const fetchHisFacilityStatusByPartner = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_BY_COUNTY_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
};
const response = await getAll('common/facilityStatusByCounty', params);
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_BY_COUNTY_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
34 changes: 34 additions & 0 deletions src/actions/RR/hisFacilityStatusByPartnerActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityStatusByPartnerAction = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityStatusByPartner.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityStatusByPartner());
}
}

export const fetchHisFacilityStatusByPartner = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_BY_PARTNER_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '',
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '',
};
const response = await getAll('common/facilityStatusByPartner', params);
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_BY_PARTNER_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
32 changes: 32 additions & 0 deletions src/actions/RR/hisFacilityTxcurrActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import moment from 'moment';
import { CACHING, PAGES } from '../../constants';
import * as actionTypes from '../types';
import { getAll } from '../../views/Shared/Api';

export const loadHisFacilityTxcurrAction = () => async (dispatch, getState) => {
const diffInMinutes = moment().diff(
moment(getState().hisFacilityTxcurr.lastFetch),
'minutes'
);
if (getState().ui.currentPage !== PAGES.rr) {
return;
}
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) {
return;
} else {
await dispatch(fetchHisFacilityTxcurr());
}
}

export const fetchHisFacilityTxcurr = () => async (dispatch, getState) => {
dispatch({ type: actionTypes.HIS_FACILITY_TXCURR_REQUEST });
const params = {
county: getState().filters.counties,
subCounty: getState().filters.subCounties,
facility: getState().filters.facilities,
partner: getState().filters.partners,
agency: getState().filters.agencies,
};
const response = await getAll('common/facilityTxcurr', params);
dispatch({ type: actionTypes.HIS_FACILITY_TXCURR_FETCH, payload: { filtered: getState().filters.filtered, list: response }});
};
Loading

0 comments on commit cc53af3

Please sign in to comment.