-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Replace the tabbed interface for data uploads with a stepper. - Add utilities to group subjects by protocol. - Add stratification to the stepper. - Stratify by dose protocols for the time being. - Display each protocol group as a MUI data grid. - Display protocol groups as tabs in the trial design view. - Add the dosing compartment qname to the protocol model. - Add a 'cohort' field to the CSV.
- Loading branch information
1 parent
8b918f2
commit 502b27c
Showing
20 changed files
with
621 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,21 @@ | ||
import { DynamicTabs, TabPanel } from "../../components/DynamicTabs"; | ||
import LoadDataTab from "./LoadDataTab"; | ||
import { SubPageName } from "../main/mainSlice"; | ||
import { FC, useState } from "react"; | ||
import { Button } from "@mui/material"; | ||
import LoadDataStepper from "./LoadDataStepper"; | ||
|
||
const Data: React.FC = () => { | ||
const tabKeys = [ | ||
SubPageName.LOAD_DATA, | ||
SubPageName.STRATIFICATION, | ||
SubPageName.VISUALISATION | ||
]; | ||
return ( | ||
<DynamicTabs tabNames={tabKeys}> | ||
<TabPanel> | ||
<LoadDataTab /> | ||
</TabPanel> | ||
<TabPanel> | ||
<LoadDataTab /> | ||
</TabPanel> | ||
<TabPanel> | ||
<LoadDataTab /> | ||
</TabPanel> | ||
</DynamicTabs> | ||
); | ||
const Data:FC = () => { | ||
const [isLoading, setIsLoading] = useState(false); | ||
function handleNewUpload() { | ||
setIsLoading(true); | ||
} | ||
function onUploadComplete() { | ||
setIsLoading(false); | ||
} | ||
|
||
return isLoading ? | ||
<LoadDataStepper onFinish={onUploadComplete} /> : | ||
<Button variant="outlined" onClick={handleNewUpload}> | ||
Upload new dataset | ||
</Button>; | ||
} | ||
|
||
export default Data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { FC } from 'react'; | ||
import { DataGrid } from '@mui/x-data-grid'; | ||
import { IProtocol } from './protocolUtils'; | ||
import { StepperState } from './LoadDataStepper'; | ||
|
||
interface IProtocolDataGrid { | ||
protocol: IProtocol | ||
state: StepperState | ||
} | ||
|
||
const ProtocolDataGrid: FC<IProtocolDataGrid> = ({ protocol, state }) => { | ||
const idField = state.fields.find((field, index) => state.normalisedFields[index] === 'ID'); | ||
const amountField = state.fields.find((field, index) => state.normalisedFields[index] === 'Amount'); | ||
const { subjects } = protocol; | ||
const protocolRows = state.data.filter(row => { | ||
const subjectId = idField && row[idField]; | ||
const amount = amountField && +row[amountField]; | ||
return subjects.includes(subjectId || '') && amount; | ||
}).map(row => { | ||
const subjectId = (idField && +row[idField]) || 0; | ||
return { id: +subjectId, ...row }; | ||
}); | ||
const protocolColumns = state.fields.map((field) => ({ field, headerName: field })); | ||
return ( | ||
<DataGrid | ||
rows={protocolRows} | ||
columns={protocolColumns} | ||
checkboxSelection | ||
/> | ||
); | ||
} | ||
|
||
export default ProtocolDataGrid; |
Oops, something went wrong.