Skip to content

Commit

Permalink
Merge pull request #438 from bcgsc/release/v6.28.0
Browse files Browse the repository at this point in the history
Release/v6.28.0
  • Loading branch information
bnguyen-bcgsc authored Mar 13, 2024
2 parents b81af1b + 3e02934 commit d686662
Show file tree
Hide file tree
Showing 15 changed files with 187 additions and 50 deletions.
3 changes: 3 additions & 0 deletions app/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ type TmburType = {
comments: string;
genomeSnvTmb: number;
genomeIndelTmb: number;
adjustedTmb: number | null;
adjustedTmbComment: string | null;
tmbHidden: boolean;
kbCategory: string | null;
kbMatches: KbMatchType[];
msiScore: number;
Expand Down
6 changes: 3 additions & 3 deletions app/components/DataTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ const DataTable = ({
colApi.setColumnsVisible(hiddenColumns, false);
}

if (rowData.length >= MAX_VISIBLE_ROWS && !isPrint && !isFullLength) {
if (rowData.length >= MAX_VISIBLE_ROWS && !isPrint && isFullLength) {
gridDiv.current.style.height = MAX_TABLE_HEIGHT;
gridApi?.setDomLayout('normal');
}
Expand Down Expand Up @@ -560,11 +560,11 @@ const DataTable = ({
paginationAutoPageSize={isFullLength}
paginationPageSize={MAX_VISIBLE_ROWS}
autoSizePadding={1}
deltaRowDataMode={canReorder}
immutableData={canReorder}
getRowNodeId={(data) => data.ident}
onRowDragEnd={canReorder ? onRowDragEnd : null}
editType="fullRow"
enableCellTextSelection
enableCellTextSelection={!showReorder}
onFilterChanged={handleFilterAndSortChanged}
onSortChanged={handleFilterAndSortChanged}
noRowsOverlayComponent="NoRowsOverlay"
Expand Down
1 change: 1 addition & 0 deletions app/components/PrintTable/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.table {
border-collapse: collapse;
margin: 8px;
font-family: Arial, Helvetica, sans-serif;

&--full-width {
width: 100%;
Expand Down
8 changes: 5 additions & 3 deletions app/components/SignatureCard/SignatureCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useMemo } from 'react';
import { action } from '@storybook/addon-actions';
import { Story } from '@storybook/react/types-6-0';
import { StoryFn } from '@storybook/react';

import ReportContext from '@/context/ReportContext';
import SignatureCard, { SignatureCardProps } from '.';
Expand All @@ -24,7 +24,7 @@ const Template = (args) => {
);
};

export const Unsigned: Story<SignatureCardProps> = Template.bind({});
export const Unsigned: StoryFn<SignatureCardProps> = Template.bind({});

Unsigned.args = {
title: 'Author',
Expand All @@ -36,7 +36,7 @@ Unsigned.args = {

const signedAt = '2021-12-02T22:05:15.326Z';

export const Signed: Story<SignatureCardProps> = Template.bind({});
export const Signed: StoryFn<SignatureCardProps> = Template.bind({});

Signed.args = {
title: 'Author',
Expand All @@ -59,6 +59,8 @@ Signed.args = {
reviewerSignature: null,
reviewerSignedAt: null,
updatedAt: signedAt,
creatorSignature: null,
creatorSignedAt: signedAt,
},
type: 'author',
isPrint: false,
Expand Down
5 changes: 5 additions & 0 deletions app/components/TumourSummaryEdit/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
&__text-field {
margin: 12px 0;
}

&__check-box {
color: gray;
padding-top: 2px;
}
}
72 changes: 70 additions & 2 deletions app/components/TumourSummaryEdit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
Button,
Chip,
Autocomplete,
FormControlLabel,
Checkbox,
} from '@mui/material';
import { Visibility, VisibilityOff } from '@mui/icons-material';
import { pink } from '@mui/material/colors';
import cloneDeep from 'lodash/cloneDeep';
import api, { ApiCallSet } from '@/services/api';
import ConfirmContext from '@/context/ConfirmContext';
Expand Down Expand Up @@ -103,6 +107,9 @@ const TumourSummaryEdit = ({
setNewTmburMutData({
genomeSnvTmb: tmburMutBur.genomeSnvTmb,
genomeIndelTmb: tmburMutBur.genomeIndelTmb,
adjustedTmb: tmburMutBur.adjustedTmb,
adjustedTmbComment: tmburMutBur.adjustedTmbComment,
tmbHidden: tmburMutBur.tmbHidden,
});
}
}, [tmburMutBur]);
Expand Down Expand Up @@ -133,8 +140,29 @@ const TumourSummaryEdit = ({
setTmburMutDirty(true);
}, []);

const handleAdjustedTmbCommentChange = useCallback(({ target: { value, name } }) => {
setNewTmburMutData((tmb) => ({
...tmb,
[name]: value,
}));
setTmburMutDirty(true);
}, []);

const handleAdjustedTmbVisibleChange = useCallback(({ target: { checked, name } }) => {
setNewTmburMutData((tmb) => ({
...tmb,
[name]: checked,
}));
setTmburMutDirty(true);
}, []);

const handleClose = useCallback(async (isSaved) => {
let callSet = null;
if (!!newTmburMutData.adjustedTmb && !newTmburMutData.adjustedTmbComment) {
snackbar.warning('Please add a comment on the adjusted TMB');
isSaved = false;
onClose(false);
}
if (isSaved) {
setIsApiCalling(true);
const apiCalls = [];
Expand Down Expand Up @@ -236,7 +264,6 @@ const TumourSummaryEdit = ({
);
} catch (callSetError) {
snackbar.error(`Error updating Tumour Summary: ${callSetError?.message}`);
console.error(callSetError);
} finally {
setIsApiCalling(false);
}
Expand Down Expand Up @@ -463,8 +490,49 @@ const TumourSummaryEdit = ({
fullWidth
type="number"
/>
<TextField
className="tumour-dialog__text-field"
label="Adjusted TMB"
value={newTmburMutData?.adjustedTmb ?? null}
name="adjustedTmb"
onChange={handleTmburChange}
variant="outlined"
fullWidth
type="number"
/>
<TextField
className="tumour-dialog__text-field"
label="Adjusted TMB Comment"
value={newTmburMutData?.adjustedTmbComment ?? ''}
name="adjustedTmbComment"
disabled={!newTmburMutData?.adjustedTmb && !newTmburMutData?.adjustedTmbComment}
required={!!newTmburMutData?.adjustedTmb}
onChange={handleAdjustedTmbCommentChange}
variant="outlined"
fullWidth
type="text"
/>
<FormControlLabel
className="tumour-dialog__check-box"
control={(
<Checkbox
icon={<Visibility />}
checkedIcon={<VisibilityOff />}
checked={newTmburMutData?.tmbHidden}
name="tmbHidden"
onChange={handleAdjustedTmbVisibleChange}
sx={{
color: 'default',
'&.Mui-checked': {
color: pink[800],
},
}}
/>
)}
label="Show/Hide TMB Score"
/>
</>
), [newTmburMutData?.genomeSnvTmb, newTmburMutData?.genomeIndelTmb, handleTmburChange]);
), [newTmburMutData?.genomeSnvTmb, newTmburMutData?.genomeIndelTmb, newTmburMutData?.adjustedTmb, newTmburMutData?.adjustedTmbComment, newTmburMutData?.tmbHidden, handleTmburChange, handleAdjustedTmbCommentChange, handleAdjustedTmbVisibleChange]);

return (
<Dialog open={isOpen}>
Expand Down
25 changes: 20 additions & 5 deletions app/views/PrintView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,29 @@ const Print = ({
const showPrint = async () => {
const paged = new Previewer();
await paged.preview(document.getElementById('root'), ['index.css'], document.body);
const templateName = report.template.name === 'probe' ? 'targeted_gene' : report.template.name;
const currentDate = new Date();
const year = currentDate.getFullYear();
const month = (currentDate.getMonth() + 1).toString().padStart(2, '0');
const day = currentDate.getDate().toString().padStart(2, '0');
const hours = currentDate.getHours().toString().padStart(2, '0');
const minutes = currentDate.getMinutes().toString().padStart(2, '0');
const seconds = currentDate.getSeconds().toString().padStart(2, '0');
const { timeZone } = new Intl.DateTimeFormat().resolvedOptions();
let serverName;
switch (process.env.NODE_ENV) {
case 'development':
serverName = '_iprdev';
break;
case 'staging':
serverName = '_iprstaging';
break;
default:
serverName = '';
break;
}
const formattedDate = `${year}-${month}-${day}_${hours}h${minutes}m${seconds}s`;

const formattedDate = `${year}-${month}-${day}-${hours}:${minutes}:${seconds}-${timeZone.replace(/\//g, '_')}`;

document.title = `${report.patientId}_${report.template.name}_${formattedDate}`;
document.title = `${report.patientId}${serverName}_${templateName}_report_${formattedDate}`;
window.print();
setIsPrintDialogShown(true);
};
Expand Down Expand Up @@ -228,7 +239,11 @@ const Print = ({
return null;
}, [report, theme, template, printVersion]);

const reportContextValue = useMemo(() => ({ report, setReport }), [report, setReport]);
const reportContextValue = useMemo(() => ({
canEdit: false,
report,
setReport,
}), [report, setReport]);

return (
<ReportContext.Provider value={reportContextValue}>
Expand Down
1 change: 1 addition & 0 deletions app/views/ReportView/components/AnalystComments/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

&--print {
padding: 0;
font-family: Arial, Helvetica, sans-serif;

&__user-text {
padding: 8px 32px;
Expand Down
1 change: 1 addition & 0 deletions app/views/ReportView/components/Appendices/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.appendices {
margin: 20px auto;
padding: 0 20px;
font-family: Arial, Helvetica, sans-serif;

&__config {
padding: 16px;
Expand Down
25 changes: 16 additions & 9 deletions app/views/ReportView/components/GenomicSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import sortBy from 'lodash/sortBy';

import api, { ApiCallSet } from '@/services/api';
import { formatDate } from '@/utils/date';
import useReport from '@/hooks/useReport';
import ConfirmContext from '@/context/ConfirmContext';
import ReadOnlyTextField from '@/components/ReadOnlyTextField';
import DemoDescription from '@/components/DemoDescription';
Expand All @@ -27,8 +26,8 @@ import TumourSummaryEdit from '@/components/TumourSummaryEdit';
import {
TumourSummaryType, MicrobialType, ImmuneType, MutationBurdenType, TmburType, MsiType,
} from '@/common';
import { SummaryProps } from '@/commonComponents';
import SummaryPrintTable from '@/components/SummaryPrintTable';
import useReport from '@/hooks/useReport';

import VariantChips from './components/VariantChips';
import VariantCounts from './components/VariantCounts';
Expand Down Expand Up @@ -72,7 +71,11 @@ const customTypeSort = (variant) => {
return 3;
};

type GenomicSummaryProps = Omit<SummaryProps, 'templateName'> & WithLoadingInjectedProps;
type GenomicSummaryProps = {
loadedDispatch?: ({ type }: { type: string }) => void;
isPrint: boolean;
printVersion?: 'stable' | 'beta' | null;
} & WithLoadingInjectedProps;

const GenomicSummary = ({
isPrint = false,
Expand Down Expand Up @@ -318,7 +321,7 @@ const GenomicSummary = ({
},
{
term: 'Mutation Burden',
value: primaryBurden && primaryBurden.totalMutationsPerMb !== null ? `${primaryBurden.totalMutationsPerMb} mut/Mb` : null,
value: primaryBurden && primaryBurden.totalMutationsPerMb !== null && (!tmburMutBur?.adjustedTmb || tmburMutBur.tmbHidden === true) ? `${primaryBurden.totalMutationsPerMb} Mut/Mb` : null,
},
{
term: `SV Burden (${primaryComparator ? primaryComparator.name : 'primary'})`,
Expand All @@ -343,10 +346,16 @@ const GenomicSummary = ({
: null,
},
{
term: 'Genome TMB (mut/mb)', // float
term:
tmburMutBur?.adjustedTmb ? 'Adjusted TMB (Mut/Mb)' : 'Genome TMB (Mut/Mb)', // float
// Forced to do this due to javascript floating point issues
value:
tmburMutBur ? (tmburMutBur.genomeSnvTmb + tmburMutBur.genomeIndelTmb).toFixed(2) : null,
tmburMutBur && !tmburMutBur.tmbHidden ? tmburMutBur.adjustedTmb?.toFixed(2) ?? (tmburMutBur.genomeSnvTmb + tmburMutBur.genomeIndelTmb).toFixed(2) : null,
},
{
term: 'Adjusted TMB Comment',
value:
tmburMutBur?.adjustedTmbComment && !tmburMutBur.tmbHidden ? tmburMutBur.adjustedTmbComment : null,
},
]);
}
Expand All @@ -368,7 +377,6 @@ const GenomicSummary = ({
snackbar.success('Entry deleted');
}
} catch (err) {
console.error(err);
snackbar.error('Entry NOT deleted due to an error');
}
}, [report, isSigned, showConfirmDialog]);
Expand All @@ -384,7 +392,6 @@ const GenomicSummary = ({
setVariants((prevVal) => ([...prevVal, categorizedVariantEntry]));
snackbar.success('Entry added');
} catch (err) {
console.error(err);
snackbar.error('Entry NOT added due to an error');
}
}, [report]);
Expand Down Expand Up @@ -610,7 +617,7 @@ const GenomicSummary = ({
{dataSection}
</div>
);
}, [canEdit, classNamePrefix, handleTumourSummaryEditClose, microbial, primaryBurden, tmburMutBur, report, showTumourSummaryEdit, tumourSummary, printVersion]);
}, [canEdit, classNamePrefix, handleTumourSummaryEditClose, microbial, tCellCd8, primaryBurden, tmburMutBur, report, showTumourSummaryEdit, tumourSummary, printVersion]);

const alterationsSection = useMemo(() => {
let titleSection = (
Expand Down
Loading

0 comments on commit d686662

Please sign in to comment.