From c934ed43ccd9478c9e37680483e984680b96f329 Mon Sep 17 00:00:00 2001 From: haihan-lin Date: Wed, 11 Aug 2021 16:03:59 -0600 Subject: [PATCH 1/9] fix a bug on axis placement --- frontend/src/Components/Charts/ChartAccessories/HeatMapAxis.tsx | 2 +- frontend/src/Components/Charts/HeatMap/WrapperHeatMap.tsx | 1 + frontend/src/Presets/StyledComponents.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/Components/Charts/ChartAccessories/HeatMapAxis.tsx b/frontend/src/Components/Charts/ChartAccessories/HeatMapAxis.tsx index 002a350c..37cf0057 100644 --- a/frontend/src/Components/Charts/ChartAccessories/HeatMapAxis.tsx +++ b/frontend/src/Components/Charts/ChartAccessories/HeatMapAxis.tsx @@ -59,7 +59,7 @@ const HeatMapAxis: FC = ({ svg, currentOffset, extraPairTotalWidth, xVals .select(".y-axis") .attr( "transform", - `translate(${extraPairTotalWidth} ,${dimensionHeight - currentOffset.bottom})` + `translate(0 ,${dimensionHeight - currentOffset.bottom})` ) .call(valueLabel as any) .call(g => g.select(".domain").remove()) diff --git a/frontend/src/Components/Charts/HeatMap/WrapperHeatMap.tsx b/frontend/src/Components/Charts/HeatMap/WrapperHeatMap.tsx index 1787c402..ec8d891e 100644 --- a/frontend/src/Components/Charts/HeatMap/WrapperHeatMap.tsx +++ b/frontend/src/Components/Charts/HeatMap/WrapperHeatMap.tsx @@ -66,6 +66,7 @@ const WrapperHeatMap: FC = ({ annotationText, outcomeComparison, layoutH, newExtraPairData.forEach((d) => { totalWidth += (ExtraPairWidth[d.type]) }) + console.log(totalWidth, ExtraPairWidth, newExtraPairData) setExtraPairTotalWidth(totalWidth) stateUpdateWrapperUseJSON(extraPairData, newExtraPairData, setExtraPairData); // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/frontend/src/Presets/StyledComponents.ts b/frontend/src/Presets/StyledComponents.ts index 257a3d0f..2c45b9bf 100644 --- a/frontend/src/Presets/StyledComponents.ts +++ b/frontend/src/Presets/StyledComponents.ts @@ -78,7 +78,7 @@ export const useStyles = makeStyles((theme: Theme) => img: { margin: 'auto!important', display: 'block!important', - maxWidth: '100%', + maxWidth: '100%!important', height: "40px!important" }, centerAlignment: { From 1451c7630742db65d46e6e3a71dce44ca5e78aca Mon Sep 17 00:00:00 2001 From: haihan-lin Date: Wed, 11 Aug 2021 16:28:10 -0600 Subject: [PATCH 2/9] add color rects for comparison --- .../ChartAccessories/CaseCountHeader.tsx | 34 ++++++++++++++----- .../Charts/CostBarChart/StackedBarChart.tsx | 4 +++ .../src/Components/Charts/HeatMap/HeatMap.tsx | 4 +++ .../Charts/HeatMap/WrapperHeatMap.tsx | 1 - 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/frontend/src/Components/Charts/ChartAccessories/CaseCountHeader.tsx b/frontend/src/Components/Charts/ChartAccessories/CaseCountHeader.tsx index 5678f846..68306bd5 100644 --- a/frontend/src/Components/Charts/ChartAccessories/CaseCountHeader.tsx +++ b/frontend/src/Components/Charts/ChartAccessories/CaseCountHeader.tsx @@ -3,7 +3,7 @@ import { observer } from "mobx-react" import { FC, useCallback, useContext } from "react" import { CaseScaleGenerator } from "../../../HelperFunctions/Scales" import Store from "../../../Interfaces/Store" -import { CaseRectWidth } from "../../../Presets/Constants" +import { CaseRectWidth, DifferentialSquareWidth, postop_color, preop_color } from "../../../Presets/Constants" type Props = { caseCount: number; @@ -11,33 +11,49 @@ type Props = { yPos: number; caseMax: number; height: number; + showComparisonRect: boolean; + isFalseComparison: boolean; } -const CaseCountHeader: FC = ({ caseCount, yPos, zeroCaseNum, caseMax, height }: Props) => { +const CaseCountHeader: FC = ({ showComparisonRect, isFalseComparison, caseCount, yPos, zeroCaseNum, caseMax, height }: Props) => { const store = useContext(Store) const { showZero } = store.state; const caseScale = useCallback(() => { return CaseScaleGenerator(caseMax) }, [caseMax]) - + // < rect + // fill = { preop_color } + // x = {- 15 + // } + // y = { aggregationScale()(dataPoint.aggregateAttribute)} + // width = { differentialSquareWidth } + // opacity = { 0.65} + // height = { aggregationScale().bandwidth() * 0.47 } + // /> return ( + strokeWidth={2} /> + {showComparisonRect ? + : <>} 0.4 ? "white" : "black"} - x={-20} + x={-20 - (showComparisonRect ? 5 : 0)} y={yPos + 0.5 * height} alignmentBaseline={"central"} textAnchor={"middle"} - fontSize="12px" - > + fontSize="12px"> {showZero ? caseCount : (caseCount - zeroCaseNum)} ) diff --git a/frontend/src/Components/Charts/CostBarChart/StackedBarChart.tsx b/frontend/src/Components/Charts/CostBarChart/StackedBarChart.tsx index f08e7511..db418229 100644 --- a/frontend/src/Components/Charts/CostBarChart/StackedBarChart.tsx +++ b/frontend/src/Components/Charts/CostBarChart/StackedBarChart.tsx @@ -101,6 +101,8 @@ const StackedBarChart: FC = ({ outcomeComparison, caseCount, secondaryCas zeroCaseNum={0} yPos={(aggregationScale()(dp.aggregateAttribute) || 0) + (secondaryData ? (aggregationScale().bandwidth() * 0.5) : 0)} caseMax={caseMax} + showComparisonRect={secondaryData ? true : false} + isFalseComparison={true} caseCount={dp.caseCount} /> ) @@ -119,6 +121,8 @@ const StackedBarChart: FC = ({ outcomeComparison, caseCount, secondaryCas showPotential={showPotential} /> = ({ outcomeComparison, interventionDate, secondaryExtr yPos={(aggregationScale()(dataPoint.aggregateAttribute) || 0) + (secondaryData ? (aggregationScale().bandwidth() * 0.5) : 0)} height={(secondaryData ? 0.5 : 1) * aggregationScale().bandwidth()} zeroCaseNum={dataPoint.zeroCaseNum} + showComparisonRect={secondaryData ? true : false} + isFalseComparison={true} caseMax={caseMax} /> ) @@ -127,6 +129,8 @@ const HeatMap: FC = ({ outcomeComparison, interventionDate, secondaryExtr /> = ({ annotationText, outcomeComparison, layoutH, newExtraPairData.forEach((d) => { totalWidth += (ExtraPairWidth[d.type]) }) - console.log(totalWidth, ExtraPairWidth, newExtraPairData) setExtraPairTotalWidth(totalWidth) stateUpdateWrapperUseJSON(extraPairData, newExtraPairData, setExtraPairData); // eslint-disable-next-line react-hooks/exhaustive-deps From 3e2e5bcc85035eab3c29562d25a5285e190283fe Mon Sep 17 00:00:00 2001 From: haihan-lin Date: Wed, 11 Aug 2021 16:30:43 -0600 Subject: [PATCH 3/9] allow 1000+ brush --- frontend/src/Components/Charts/ScatterPlot/ScatterPlot.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/Components/Charts/ScatterPlot/ScatterPlot.tsx b/frontend/src/Components/Charts/ScatterPlot/ScatterPlot.tsx index 07640bea..c66053ab 100644 --- a/frontend/src/Components/Charts/ScatterPlot/ScatterPlot.tsx +++ b/frontend/src/Components/Charts/ScatterPlot/ScatterPlot.tsx @@ -85,7 +85,7 @@ const ScatterPlot: FC = ({ xAggregationOption, xMax, xMin, yMax, yMin, yV }) // !!!!!!!this is the code of checking brushed patient - if (caseList.length > 1000 || caseList.length === 0) { + if (caseList.length === 0) { updateBrushLoc(null) brushDef.move(svgSelection.select(".brush-layer"), null) store.selectionStore.updateBrush([]) From 3a90cb9da793eb247f4e7570f1704db79be01083 Mon Sep 17 00:00:00 2001 From: haihan-lin Date: Wed, 11 Aug 2021 16:34:24 -0600 Subject: [PATCH 4/9] maybe the brush clear is working. but i'm not completely sure if the logic passes --- .../src/Components/Charts/ScatterPlot/ScatterPlot.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/Components/Charts/ScatterPlot/ScatterPlot.tsx b/frontend/src/Components/Charts/ScatterPlot/ScatterPlot.tsx index c66053ab..ff2a1733 100644 --- a/frontend/src/Components/Charts/ScatterPlot/ScatterPlot.tsx +++ b/frontend/src/Components/Charts/ScatterPlot/ScatterPlot.tsx @@ -104,14 +104,20 @@ const ScatterPlot: FC = ({ xAggregationOption, xMax, xMin, yMax, yMin, yV //Clear the brush useEffect(() => { - brushDef.move(svgSelection.select(".brush-layer"), null) + clearBrush() // eslint-disable-next-line react-hooks/exhaustive-deps }, [data]) + const clearBrush = () => { + brushDef.move(svgSelection.select(".brush-layer"), null) + } useEffect(() => { let newbrushedCaseList = currentBrushedPatientGroup.map(d => d.CASE_ID) stateUpdateWrapperUseJSON(brushedCaseList, newbrushedCaseList, updatebrushedCaseList) + if (currentBrushedPatientGroup.length === 0) { + clearBrush() + } // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentBrushedPatientGroup]) From a5bcb5a89cd33e929ee4bc72d4afd415be61ef53 Mon Sep 17 00:00:00 2001 From: haihan-lin Date: Wed, 11 Aug 2021 16:36:53 -0600 Subject: [PATCH 5/9] add option to remove selection on left tool box --- .../src/Components/Utilities/LeftToolBox/CurrentSelected.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/Components/Utilities/LeftToolBox/CurrentSelected.tsx b/frontend/src/Components/Utilities/LeftToolBox/CurrentSelected.tsx index bf551c50..99078651 100644 --- a/frontend/src/Components/Utilities/LeftToolBox/CurrentSelected.tsx +++ b/frontend/src/Components/Utilities/LeftToolBox/CurrentSelected.tsx @@ -25,6 +25,11 @@ const CurrentSelected: FC = () => { + + { store.selectionStore.updateBrush([]) }}> + + + : <>} From ab1a8d726896f51a2357aa2fda311811892e6d67 Mon Sep 17 00:00:00 2001 From: haihan-lin Date: Wed, 11 Aug 2021 17:06:49 -0600 Subject: [PATCH 6/9] add an ! mark on case cound --- frontend/src/App.tsx | 4 ++- .../Utilities/LeftToolBox/CurrentView.tsx | 30 +++++++++++++------ .../LeftToolBox/SurgerySearchBar.tsx | 6 +++- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index cadffe45..642ed09d 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -59,7 +59,9 @@ const App: FC = () => { //Data Updates useDeepCompareEffect(() => { - console.log(store.state) + if (process.env.REACT_APP_REQUIRE_LOGIN === "true") { + whoamiAPICall(store) + } let patientIDSet: Set | undefined; if (currentSelectPatientGroup.length > 0) { patientIDSet = new Set() diff --git a/frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx b/frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx index 414d6c20..2471f56a 100644 --- a/frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx +++ b/frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx @@ -1,4 +1,4 @@ -import { select, timeFormat } from "d3" +import { select, style, timeFormat } from "d3" import { observer } from "mobx-react" import { useContext } from "react" import { FC } from "react" @@ -9,9 +9,10 @@ import { StyledDate, Title, useStyles } from "../../../Presets/StyledComponents" import Container from "@material-ui/core/Container"; import CloseIcon from '@material-ui/icons/Close'; import List from "@material-ui/core/List"; -import { Box, Chip, ListItem, ListItemSecondaryAction, ListItemText, MenuItem, Select, Switch, Grid, IconButton } from "@material-ui/core"; +import { Box, Chip, ListItem, ListItemSecondaryAction, ListItemText, MenuItem, Select, Switch, Grid, IconButton, Tooltip } from "@material-ui/core"; import { DropdownGenerator } from "../../../HelperFunctions/DropdownGenerator" import { SelectSet } from "../../../Interfaces/Types/SelectionTypes" +import ErrorIcon from '@material-ui/icons/Error'; type Props = { totalCaseNum: number } @@ -40,12 +41,11 @@ const CurrentView: FC = ({ totalCaseNum }: Props) => { stringArray.forEach((word, index) => { if ((AcronymDictionary as any)[word]) { output.push(( -
- {word} - - {`${(AcronymDictionary as any)[word]}`} - -
)) + {(AcronymDictionary as any)[word]}}> +
+ {word} +
+
)) } else { output.push(({`${index !== 0 ? " " : ""}${word}${index !== stringArray.length - 1 ? " " : ""}`})) } @@ -107,13 +107,25 @@ const CurrentView: FC = ({ totalCaseNum }: Props) => { - + Aggregated Cases + + } secondary={`${store.chartStore.totalAggregatedCaseCount}/${totalCaseNum}`} /> + + + Case count can be reduced by both filter and empty data.}> + + + + + + diff --git a/frontend/src/Components/Utilities/LeftToolBox/SurgerySearchBar.tsx b/frontend/src/Components/Utilities/LeftToolBox/SurgerySearchBar.tsx index 35ff1c38..0ed5e3a9 100644 --- a/frontend/src/Components/Utilities/LeftToolBox/SurgerySearchBar.tsx +++ b/frontend/src/Components/Utilities/LeftToolBox/SurgerySearchBar.tsx @@ -12,10 +12,12 @@ type Props = { surgeryList: any[] } const SurgerySearchBar: FC = ({ surgeryList }: Props) => { const store = useContext(Store) const styles = useStyles() + const [input, setInput] = useState(""); const searchHandler = (input: any) => { if (input) { if (!store.state.proceduresSelection.includes(input.value)) { store.selectionStore.updateProcedureSelection(input.value, false); + setInput("") } } } @@ -25,9 +27,11 @@ const SurgerySearchBar: FC = ({ surgeryList }: Props) => { { searchHandler(v) }} + value={input} + getOptionLabel={(option) => option.value} renderInput={(params) => - } + } /> From 38e857ba9bf8384bfef66d0578d24337f23bab43 Mon Sep 17 00:00:00 2001 From: haihan-lin Date: Thu, 12 Aug 2021 11:12:18 -0600 Subject: [PATCH 7/9] remove comment --- .../Charts/ChartAccessories/CaseCountHeader.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/frontend/src/Components/Charts/ChartAccessories/CaseCountHeader.tsx b/frontend/src/Components/Charts/ChartAccessories/CaseCountHeader.tsx index 68306bd5..2868255a 100644 --- a/frontend/src/Components/Charts/ChartAccessories/CaseCountHeader.tsx +++ b/frontend/src/Components/Charts/ChartAccessories/CaseCountHeader.tsx @@ -22,15 +22,7 @@ const CaseCountHeader: FC = ({ showComparisonRect, isFalseComparison, cas const caseScale = useCallback(() => { return CaseScaleGenerator(caseMax) }, [caseMax]) - // < rect - // fill = { preop_color } - // x = {- 15 - // } - // y = { aggregationScale()(dataPoint.aggregateAttribute)} - // width = { differentialSquareWidth } - // opacity = { 0.65} - // height = { aggregationScale().bandwidth() * 0.47 } - // /> + return ( Date: Thu, 12 Aug 2021 11:12:51 -0600 Subject: [PATCH 8/9] Update frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx Co-authored-by: Jack Wilburn --- frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx b/frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx index 2471f56a..684a6788 100644 --- a/frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx +++ b/frontend/src/Components/Utilities/LeftToolBox/CurrentView.tsx @@ -119,7 +119,7 @@ const CurrentView: FC = ({ totalCaseNum }: Props) => { - Case count can be reduced by both filter and empty data.}> + Case count can be reduced by both filter and missing data.}> From 0d6677adb7c9b3ee100ff2cc96c5fa569ebd699f Mon Sep 17 00:00:00 2001 From: haihan-lin Date: Thu, 12 Aug 2021 11:14:57 -0600 Subject: [PATCH 9/9] the whoami call change was made in a different function, my mistake. I moved it to cacheHemoData() --- frontend/src/App.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 642ed09d..d0851aef 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -59,9 +59,6 @@ const App: FC = () => { //Data Updates useDeepCompareEffect(() => { - if (process.env.REACT_APP_REQUIRE_LOGIN === "true") { - whoamiAPICall(store) - } let patientIDSet: Set | undefined; if (currentSelectPatientGroup.length > 0) { patientIDSet = new Set() @@ -74,7 +71,9 @@ const App: FC = () => { }, [surgeryUrgencySelection, outcomeFilter, hemoData, currentOutputFilterSet, currentSelectPatientGroup]) async function cacheHemoData() { - // whoamiAPICall(store) + if (process.env.REACT_APP_REQUIRE_LOGIN === "true") { + whoamiAPICall(store) + } fetch(`${process.env.REACT_APP_QUERY_URL}hemoglobin`) .then((res) => res.json()) .then(async (dataHemo) => {