From f06f3ce741788d07a0a4614981234732e7fbf8eb Mon Sep 17 00:00:00 2001 From: OrdiNeu Date: Fri, 21 Jul 2023 17:37:03 -0400 Subject: [PATCH] Fnguyen/post stable fixes (#87) * Fix the province summation not counting multiple locations in the same province * Rename + move the cohorts count * Be able to view patients even from other sites --- src/views/clinicalGenomic/widgets/patientCountSingle.js | 6 +++--- src/views/clinicalGenomic/widgets/patientCounts.js | 6 +++--- src/views/clinicalGenomic/widgets/patientView.js | 2 +- src/views/summary/summary.js | 5 ++++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/views/clinicalGenomic/widgets/patientCountSingle.js b/src/views/clinicalGenomic/widgets/patientCountSingle.js index 910d4151..5cf46a5d 100644 --- a/src/views/clinicalGenomic/widgets/patientCountSingle.js +++ b/src/views/clinicalGenomic/widgets/patientCountSingle.js @@ -57,19 +57,19 @@ function PatientCountSingle(props) { - {totalPatients} + {numCohorts} - {patientsInSearch} + {totalPatients} - {numCohorts} + {patientsInSearch} diff --git a/src/views/clinicalGenomic/widgets/patientCounts.js b/src/views/clinicalGenomic/widgets/patientCounts.js index 50791868..e344578b 100644 --- a/src/views/clinicalGenomic/widgets/patientCounts.js +++ b/src/views/clinicalGenomic/widgets/patientCounts.js @@ -76,17 +76,17 @@ function PatientCounts(props) { - Total Patients + Total Cohorts - Patients In Search + Total Patients - Cohorts + Patients In Search diff --git a/src/views/clinicalGenomic/widgets/patientView.js b/src/views/clinicalGenomic/widgets/patientView.js index f52281a8..6cdb7d91 100644 --- a/src/views/clinicalGenomic/widgets/patientView.js +++ b/src/views/clinicalGenomic/widgets/patientView.js @@ -98,7 +98,7 @@ const JSONTree = (props) => { function PatientView(props) { const resultsContext = useSearchResultsReaderContext(); - const patient = resultsContext.donor?.[0]?.results?.results?.[0]; + const patient = resultsContext.donor?.map((loc) => loc?.results?.results?.[0])?.filter((donor) => donor)?.[0]; const [expanded, setExpanded] = useState(['.']); // When searching: search, then prune the results diff --git a/src/views/summary/summary.js b/src/views/summary/summary.js index 54e80024..ea60bb7d 100644 --- a/src/views/summary/summary.js +++ b/src/views/summary/summary.js @@ -69,7 +69,10 @@ function Summary() { case '/individual_count': setIndividualCount((oldIndividualCount) => aggregateObj(stat.results, oldIndividualCount)); if (stat.location) { - candigDataSouceCollection[stat.location['province-code']] = stat.results.individual_count; + if (!(stat.location['province-code'] in candigDataSouceCollection)) { + candigDataSouceCollection[stat.location['province-code']] = 0; + } + candigDataSouceCollection[stat.location['province-code']] += stat.results.individual_count; if (count === data.length) { setCanDigDataSource(candigDataSouceCollection);