Skip to content

Commit

Permalink
feat(attritionTableHistogramModal): Ran linter, reverted unintentiona…
Browse files Browse the repository at this point in the history
…lly changed file
  • Loading branch information
jarvisraymond-uchicago committed Sep 24, 2024
1 parent 9a29a6a commit 96f2b00
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import './AttritionTable.css';

const { Panel } = Collapse;

const AttritionTable = ({ selectedCohort, outcome, covariates, tableType }) => {
const AttritionTable = ({
selectedCohort, outcome, covariates, tableType,
}) => {
const [modalInfo, setModalInfo] = useState({
title: 'Historgram',
isModalOpen: false,
Expand Down Expand Up @@ -120,28 +122,28 @@ const AttritionTable = ({ selectedCohort, outcome, covariates, tableType }) => {
/>
</React.Fragment>
)}
{selectedCohort?.cohort_definition_id &&
outcome &&
covariatesProcessed.length > 0
{selectedCohort?.cohort_definition_id
&& outcome
&& covariatesProcessed.length > 0
? covariatesProcessed.map((item) => (
<React.Fragment key={item}>
{/* This is for all the covariate rows in the table */}
<AttritionTableRow
key={item}
outcome={outcome}
// use the last item
rowObject={item[item.length - 1]}
selectedCohort={selectedCohort}
rowType='Covariate'
currentCovariateAndCovariatesFromPrecedingRows={[
...item,
applyAutoGenFilters(),
]}
modalInfo={modalInfo}
setModalInfo={setModalInfo}
/>
</React.Fragment>
))
<React.Fragment key={item}>
{/* This is for all the covariate rows in the table */}
<AttritionTableRow
key={item}
outcome={outcome}
// use the last item
rowObject={item[item.length - 1]}
selectedCohort={selectedCohort}
rowType='Covariate'
currentCovariateAndCovariatesFromPrecedingRows={[
...item,
applyAutoGenFilters(),
]}
modalInfo={modalInfo}
setModalInfo={setModalInfo}
/>
</React.Fragment>
))
: null}
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ const AttritionTableRow = ({
],
// if there are not two cohorts selected, then quantitative
// Otherwise if there are two cohorts selected, case control
() =>
fetchConceptStatsByHareSubset(
cohortDefinitionId,
currentCovariateAndCovariatesFromPrecedingRows,
outcome,
sourceId
),
queryConfig
() => fetchConceptStatsByHareSubset(
cohortDefinitionId,
currentCovariateAndCovariatesFromPrecedingRows,
outcome,
sourceId,
),
queryConfig,
);

const breakdown = data?.concept_breakdown;
Expand All @@ -51,13 +50,13 @@ const AttritionTableRow = ({
if (breakdown?.length) {
const filteredBreakdown = breakdown.filter(
// eslint-disable-next-line camelcase
({ concept_value }) => concept_value !== 'OTH'
({ concept_value }) => concept_value !== 'OTH',
);
setBreakdownSize(
filteredBreakdown.reduce(
(acc, curr) => acc + curr.persons_in_cohort_with_value,
0
)
0,
),
);
setBreakdownColumns(filteredBreakdown);
} else {
Expand All @@ -75,7 +74,7 @@ const AttritionTableRow = ({
const getSizeByColumn = (hare) => {
const hareIndex = breakdownColumns.findIndex(
// eslint-disable-next-line camelcase
({ concept_value }) => concept_value === hare
({ concept_value }) => concept_value === hare,
);
return hareIndex > -1
? breakdownColumns[hareIndex].persons_in_cohort_with_value
Expand All @@ -97,8 +96,8 @@ const AttritionTableRow = ({
}
throw new Error(
`Invalid Row Type: ${rowType} and rowObject.variable_type ${JSON.stringify(
rowObject
)} combination`
rowObject,
)} combination`,
);
}
return null;
Expand All @@ -119,7 +118,7 @@ const AttritionTableRow = ({
return selectedCohort.cohort_name;
}
throw new Error(
`Invalid Row Type: ${rowType}. Expected one of ['Outcome', 'Covariate', 'Cohort']`
`Invalid Row Type: ${rowType}. Expected one of ['Outcome', 'Covariate', 'Cohort']`,
);
};

Expand Down
3 changes: 1 addition & 2 deletions src/Login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class Login extends React.Component {
};
}


// componentDidMount() {
// window.addEventListener('resize', this.updateDimensions);
// }
Expand Down Expand Up @@ -115,7 +114,7 @@ class Login extends React.Component {
</div>
</React.Fragment>
);
console.log('providers',this.props.providers);

if (this.props.providers.length > 0) {
const loginOptions = {}; // one for each login provider
this.props.providers.forEach((provider, i) => {
Expand Down

0 comments on commit 96f2b00

Please sign in to comment.