diff --git a/src/layout/MainLayout/Sidebar/index.js b/src/layout/MainLayout/Sidebar/index.js
index 3c36225d..19d83a55 100644
--- a/src/layout/MainLayout/Sidebar/index.js
+++ b/src/layout/MainLayout/Sidebar/index.js
@@ -65,7 +65,7 @@ const Sidebar = ({ drawerOpen, drawerToggle, window }) => {
-
+ {sidebarContext || <>>}
>
);
diff --git a/src/views/clinicalGenomic/search/SearchHandler.js b/src/views/clinicalGenomic/search/SearchHandler.js
index acb1a43c..5a9c0b31 100644
--- a/src/views/clinicalGenomic/search/SearchHandler.js
+++ b/src/views/clinicalGenomic/search/SearchHandler.js
@@ -76,9 +76,6 @@ function SearchHandler() {
useEffect(() => {
// First, we abort any currently-running search promises
// controller.abort();
- console.log('Query re-initiated');
- console.log(reader.query);
-
const CollateSummary = (data, statName) => {
const summaryStat = {};
data.forEach((site) => {
@@ -146,7 +143,7 @@ function SearchHandler() {
const clinicalData = {};
data.forEach((site) => {
discoveryCounts.patients_per_cohort[site.location.name] = site.results?.summary?.patients_per_cohort;
- clinicalData[site.location.name] = site?.results?.results;
+ clinicalData[site.location.name] = site?.results;
});
const genomicData = data
diff --git a/src/views/clinicalGenomic/widgets/clinicalData.js b/src/views/clinicalGenomic/widgets/clinicalData.js
index 977d6152..7147c3a6 100644
--- a/src/views/clinicalGenomic/widgets/clinicalData.js
+++ b/src/views/clinicalGenomic/widgets/clinicalData.js
@@ -12,6 +12,10 @@ import { useSearchQueryWriterContext, useSearchResultsReaderContext } from '../S
function ClinicalView() {
const theme = useTheme();
+ const [paginationModel, setPaginationModel] = React.useState({
+ pageSize: 25,
+ page: 0
+ });
// Mobile
const [desktopResolution, setdesktopResolution] = React.useState(window.innerWidth > 1200);
@@ -24,6 +28,7 @@ function ClinicalView() {
if (searchResults) {
rows =
Object.values(searchResults)
+ ?.map((results) => results.results)
?.flat(1)
?.map((patient, index) => {
// Make sure each row has an ID and a deceased status
@@ -52,6 +57,22 @@ function ClinicalView() {
{ field: 'date_of_death', headerName: 'Date of Death', minWidth: 220, sortable: false }
];
+ const HandlePageChange = (newPage) => {
+ if (newPage !== paginationModel.page) {
+ writerContext((old) => ({ ...old, query: { ...old.query, page: newPage } }));
+ }
+ setPaginationModel({
+ pageSize: 10,
+ page: newPage
+ });
+ };
+
+ const totalRows = searchResults
+ ? Object.values(searchResults)
+ ?.map((site) => site.count)
+ .reduce((partial, a) => partial + a, 0)
+ : 0;
+
return (
@@ -62,8 +83,12 @@ function ClinicalView() {
rows={rows}
columns={columns}
pageSize={10}
+ rowCount={totalRows}
rowsPerPageOptions={[10]}
onRowClick={(rowData) => handleRowClick(rowData.row)}
+ paginationModel={paginationModel}
+ onPageChange={HandlePageChange}
+ paginationMode="server"
hideFooterSelectedRowCount
/>
diff --git a/src/views/clinicalGenomic/widgets/patientCounts.js b/src/views/clinicalGenomic/widgets/patientCounts.js
index 4af074a8..5b383387 100644
--- a/src/views/clinicalGenomic/widgets/patientCounts.js
+++ b/src/views/clinicalGenomic/widgets/patientCounts.js
@@ -33,7 +33,14 @@ function PatientCounts() {
// Has this node been excluded from the results?
if (!(filters && filters?.node?.includes(entry.location.name))) {
const match = searchResults[entry.location.name];
- // Iterate through each donor in this site
+ Object.keys(match.summary.patients_per_cohort).forEach((cohort) => {
+ if (cohort in counts) {
+ counts[cohort] += match.summary.patients_per_cohort[cohort];
+ } else {
+ counts[cohort] = match.summary.patients_per_cohort[cohort];
+ }
+ });
+ /* // Iterate through each donor in this site
match.forEach((donor) => {
if (filters && filters?.program_id?.includes(donor.program_id)) {
// Exclude based on cohort
@@ -45,7 +52,7 @@ function PatientCounts() {
} else {
counts[donor.program_id] = 1;
}
- });
+ }); */
}
}
diff --git a/src/views/clinicalGenomic/widgets/sidebar.js b/src/views/clinicalGenomic/widgets/sidebar.js
index 6ac5a076..2def7be0 100644
--- a/src/views/clinicalGenomic/widgets/sidebar.js
+++ b/src/views/clinicalGenomic/widgets/sidebar.js
@@ -336,7 +336,7 @@ function Sidebar() {
// Parse out what we need:
const sites = readerContext?.programs?.map((loc) => loc.location.name) || [];
- const cohorts = readerContext?.programs?.map((loc) => loc.results.results.map((cohort) => cohort.program_id)).flat(1) || [];
+ const cohorts = readerContext?.programs?.map((loc) => loc?.results?.items.map((cohort) => cohort.program_id)).flat(1) || [];
const treatmentTypes = ExtractSidebarElements('treatment_types');
const tumourPrimarySites = ExtractSidebarElements('tumour_primary_sites');
const chemotherapyDrugNames = ExtractSidebarElements('chemotherapy_drug_names');