Skip to content

Commit

Permalink
otz charts corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrianbet committed Aug 9, 2024
1 parent f5fe467 commit d80abfc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
32 changes: 21 additions & 11 deletions src/selectors/CT/OTZ/otzOutcomesAmongAlhivWithBaselineVL.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,31 @@ export const getOtzOutcomesAmongAlHivWithBaselineVL = createSelector(
(listUnfiltered, listFiltered, filtered) => {
const list = filtered ? listFiltered : listUnfiltered;

const ArrayVal = list.map(val => ({
AlHivEnrolledInOTZ: val.AlHivEnrolledInOTZ,
AlHivEnrolledInOTZPerc: 100,
return list.map(val => ({
AlHivEnrolledInOTZ: val.AlHivEnrolledInOTZ,
AlHivEnrolledInOTZPerc: 100,

AlHivWithBaselineVl: val.AlHivWithBaselineVl,
AlHivWithBaselineVlPerc: Math.round(((val.AlHivWithBaselineVl/val.AlHivEnrolledInOTZ)*100)),
AlHiv: val.AlHiv,
AlHivPerc: 100,

AlHivWithVlGreaterThan1000: val.AlHivWithVlGreaterThan1000,
AlHivWithVlGreaterThan1000Perc: Math.round(((val.AlHivWithVlGreaterThan1000/val.AlHivEnrolledInOTZ)*100)),
AlHivWithBaselineVl: val.AlHivWithBaselineVl,
AlHivWithBaselineVlPerc: Math.round(((val.AlHivWithBaselineVl/val.AlHiv)*100)),

AlHivWithVlLessThan1000: val.AlHivWithVlLessThan1000,
AlHivWithVlLessThan1000Perc: Math.round(((val.AlHivWithVlLessThan1000/val.AlHivEnrolledInOTZ)*100)),
}));
AlHivWithVlGreaterThan1000: val.AlHivWithVlGreaterThan1000,
AlHivWithVlGreaterThan1000Perc: Math.round(((val.AlHivWithVlGreaterThan1000/val.AlHiv)*100)),

return ArrayVal;
AlHivWithVlLessThan1000: val.AlHivWithVlLessThan1000,
AlHivWithVlLessThan1000Perc: Math.round(((val.AlHivWithVlLessThan1000/val.AlHiv)*100)),

AlHivWithBaselineVlEnrolled: val.AlHivWithBaselineVlEnrolled,
AlHivWithBaselineVlEnrolledPerc: Math.round(((val.AlHivWithBaselineVlEnrolled/val.AlHivEnrolledInOTZ)*100)),

AlHivWithVlGreaterThan1000Enrolled: val.AlHivWithVlGreaterThan1000Enrolled,
AlHivWithVlGreaterThan1000EnrolledPerc: Math.round(((val.AlHivWithVlGreaterThan1000Enrolled/val.AlHivEnrolledInOTZ)*100)),

AlHivWithVlLessThan1000Enrolled: val.AlHivWithVlLessThan1000Enrolled,
AlHivWithVlLessThan1000EnrolledPerc: Math.round(((val.AlHivWithVlLessThan1000Enrolled/val.AlHivEnrolledInOTZ)*100)),
}));
}
);

Expand Down
26 changes: 7 additions & 19 deletions src/views/CT/OTZ/OtzOutcomesAmongAlhivWithBaselineVl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import HighchartsReact from 'highcharts-react-official';
import Highcharts from 'highcharts';
import { useSelector } from 'react-redux';
import * as otzOutcomesAmongAlhivWithBaselineVL from '../../../selectors/CT/OTZ/otzOutcomesAmongAlhivWithBaselineVL';
import * as otzTotalAdolescentsSelector from '../../../selectors/CT/OTZ/otzTotalAdolescents';

const OtzOutcomesAmongAlhivWithBaselineVl = () => {
const [otzOutcomesAmongAlHivWithBaselineVL, setOtzOutcomesAmongAlHivWithBaselineVL] = useState({});
const otzOutcomesWithBaselineVl = useSelector(otzOutcomesAmongAlhivWithBaselineVL.getOtzOutcomesAmongAlHivWithBaselineVL);
const adolescents = useSelector(otzTotalAdolescentsSelector.getOtzTotalAdolescents);

const loadOtzOutcomesAmongAlhivWithBaselineVl = useCallback(async () => {
setOtzOutcomesAmongAlHivWithBaselineVL({
Expand All @@ -21,7 +19,6 @@ const OtzOutcomesAmongAlhivWithBaselineVl = () => {
},
xAxis: {
categories: [
'ADOLECENTS IN CARE',
'ENROLLED IN ANY OTZ PROGRAM',
'BASELINE VL AVAILABLE',
'VIRALLY SUPPRESSED',
Expand All @@ -48,7 +45,7 @@ const OtzOutcomesAmongAlhivWithBaselineVl = () => {
formatter: function () {
if (this.point.text)
return '' + this.point.y + '(' + this.point.text + '%)'
else return '' + this.point.y;
else return '' + this.point.y;
},
},
tooltip: { valueSuffix: '({point.text:.0f})' },
Expand All @@ -58,15 +55,6 @@ const OtzOutcomesAmongAlhivWithBaselineVl = () => {
{
name: 'OTZ OUTCOMES AMONG ALHIV WITH BASELINE VL',
data: [
// TODO: adolocents in care bar here
{
name: 'Adolecentes in care',
color: '#14084D',
y:
adolescents.totalAdolescents > 0
? adolescents.totalAdolescents
: 0,
},
{
name: 'Enrolled in OTZ',
color: '#1AB394',
Expand All @@ -87,12 +75,12 @@ const OtzOutcomesAmongAlhivWithBaselineVl = () => {
y:
otzOutcomesWithBaselineVl.length > 0
? otzOutcomesWithBaselineVl[0]
.AlHivWithBaselineVl
.AlHivWithBaselineVlEnrolled
: 0,
text:
otzOutcomesWithBaselineVl.length > 0
? otzOutcomesWithBaselineVl[0]
.AlHivWithBaselineVlPerc
.AlHivWithBaselineVlEnrolledPerc
: 0,
},
{
Expand All @@ -101,12 +89,12 @@ const OtzOutcomesAmongAlhivWithBaselineVl = () => {
y:
otzOutcomesWithBaselineVl.length > 0
? otzOutcomesWithBaselineVl[0]
.AlHivWithVlLessThan1000
.AlHivWithVlLessThan1000Enrolled
: 0,
text:
otzOutcomesWithBaselineVl.length > 0
? otzOutcomesWithBaselineVl[0]
.AlHivWithVlLessThan1000Perc
.AlHivWithVlLessThan1000EnrolledPerc
: 0,
},
// TODO: LOW LEVEL VIREMIA bar here
Expand All @@ -116,12 +104,12 @@ const OtzOutcomesAmongAlhivWithBaselineVl = () => {
y:
otzOutcomesWithBaselineVl.length > 0
? otzOutcomesWithBaselineVl[0]
.AlHivWithVlGreaterThan1000
.AlHivWithVlGreaterThan1000Enrolled
: 0,
text:
otzOutcomesWithBaselineVl.length > 0
? otzOutcomesWithBaselineVl[0]
.AlHivWithVlGreaterThan1000Perc
.AlHivWithVlGreaterThan1000EnrolledPerc
: 0,
},
],
Expand Down

0 comments on commit d80abfc

Please sign in to comment.