Skip to content

Commit b26b833

Browse files
authored
Merge pull request #554 from MEDomicsLab/UI_Fixes
UI Improvements
2 parents 4f00f02 + 54f67a7 commit b26b833

10 files changed

Lines changed: 281 additions & 35 deletions

File tree

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"name": "medomics-platform",
44
"description": "MEDomics platform",
5-
"version": "1.8.0",
5+
"version": "1.8.1",
66
"author": "MEDomicsLab Team",
77
"main": "app/background.js",
88
"repository": "https://github.com/MEDomicsLab/MEDomics",

‎renderer/components/exploratory/dtale.jsx‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Input from "../learning/input"
2121
*
2222
* @returns A card with the D-Tale module
2323
*/
24-
const DTaleProcess = ({ uniqueId, pageId, port, setError, onDelete }) => {
24+
const DTaleProcess = ({ processes, uniqueId, pageId, port, setError, onDelete }) => {
2525
const [mainDataset, setMainDataset] = useState()
2626
const [mainDatasetHasWarning, setMainDatasetHasWarning] = useState({ state: false, tooltip: "" })
2727
const [isCalculating, setIsCalculating] = useState(false)
@@ -125,13 +125,15 @@ const DTaleProcess = ({ uniqueId, pageId, port, setError, onDelete }) => {
125125
/>
126126
<Button onClick={generateReport} className="btn btn-primary" label="Generate report" icon="pi pi-chart-bar" iconPos="right" disabled={!mainDataset || mainDatasetHasWarning.state} />
127127
{serverPath && <Button onClick={() => handleOpenWebServer(serverPath, uniqueId)} className="btn btn-primary" label="Open D-Tale" icon="pi pi-table" iconPos="right" severity="success" />}
128-
<IoClose
129-
className="btn-close-output-card"
130-
onClick={() => {
131-
onDelete(uniqueId)
132-
shutdownDTale(serverPath)
133-
}}
134-
/>
128+
{processes.length > 1 && (
129+
<IoClose
130+
className="btn-close-output-card"
131+
onClick={() => {
132+
onDelete(uniqueId)
133+
shutdownDTale(serverPath)
134+
}}
135+
/>
136+
)}
135137
</div>
136138
</div>
137139
{isCalculating && (
@@ -216,7 +218,7 @@ const DTale = ({ pageId, port, setError }) => {
216218
>
217219
<Stack gap={2}>
218220
{processes.map((id) => (
219-
<DTaleProcess onDelete={onDelete} uniqueId={id} key={id} port={port} pageId={pageId} setError={setError} />
221+
<DTaleProcess processes={processes} onDelete={onDelete} uniqueId={id} key={id} port={port} pageId={pageId} setError={setError} />
220222
))}
221223
<Button className="add-compare" label="Add new D-Tale analysis" onClick={handleAddDTaleComp} />
222224
</Stack>

‎renderer/components/layout/flexlayout/mainContainerClass.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import ExtractionImagePage from "../../mainPages/extractionImage"
4040
import ExtractionMEDimagePage from "../../mainPages/extractionMEDimage"
4141
import ExtractionTextPage from "../../mainPages/extractionText"
4242
import ExtractionLandingPage from "../../mainPages/extractionLandingPage"
43+
import EvaluationLandingPage from "../../mainPages/evaluationLandingPage"
4344
import ExtractionTSPage from "../../mainPages/extractionTS"
4445
import HomePage from "../../mainPages/home"
4546
import HtmlViewer from "../../mainPages/htmlViewer"
@@ -1119,6 +1120,8 @@ class MainInnerContainer extends React.Component<any, { layoutFile: string | nul
11191120
}
11201121
} else if (component === "extractionLandingPage") {
11211122
return <ExtractionLandingPage/>
1123+
} else if (component === "evaluationLandingPage") {
1124+
return <EvaluationLandingPage/>
11221125
} else if (component === "extractionMEDimagePage") {
11231126
if (node.getExtraData().data == null) {
11241127
const config = node.getConfig()
@@ -1327,6 +1330,9 @@ class MainInnerContainer extends React.Component<any, { layoutFile: string | nul
13271330
if (component === "extractionLandingPage") {
13281331
return <span style={{ marginRight: 3 }}>❯❯❯❯</span>
13291332
}
1333+
if (component === "evaluationLandingPage") {
1334+
return <span style={{ marginRight: 3 }}>🧪</span>
1335+
}
13301336
if (component === "extractionTextPage") {
13311337
return <span style={{ marginRight: 3 }}>📄</span>
13321338
}
@@ -1506,6 +1512,11 @@ class MainInnerContainer extends React.Component<any, { layoutFile: string | nul
15061512
case "DELETE_DATA_OBJECT":
15071513
this.deleteDataObject(action.payload)
15081514
break
1515+
case "DELETE_TAB":
1516+
if (action.payload?.id && this.state.model?.getNodeById(action.payload.id)) {
1517+
this.state.model.doAction(Actions.deleteTab(action.payload.id))
1518+
}
1519+
break
15091520
default:
15101521
break
15111522
}

‎renderer/components/layout/iconSidebar.jsx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ const IconSidebar = ({ onSidebarItemSelect }) => {
188188
className="extractionNav btnSidebar align-center"
189189
data-pr-at="right center"
190190
data-pr-my="left center"
191-
data-pr-tooltip="extraction"
191+
data-pr-tooltip="Extraction"
192192
data-pr-disabled={extractionBtnstate}
193-
eventKey="extraction"
193+
eventKey="Extraction"
194194
data-tooltip-id="tooltip-extraction"
195-
onDoubleClick={(event) => handleDoubleClickLanding(event, "extraction")}
195+
onDoubleClick={(event) => handleDoubleClickLanding(event, "Extraction")}
196196
onClick={() => {
197197
//setExtractionBtnstate(!extractionBtnstate)
198198
}}
@@ -319,12 +319,12 @@ const IconSidebar = ({ onSidebarItemSelect }) => {
319319
data-pr-my="left center"
320320
data-pr-tooltip="Evaluation"
321321
data-pr-disabled={evaluationBtnstate}
322-
eventKey="evaluation"
322+
eventKey="Evaluation"
323323
data-tooltip-id="tooltip-evaluation"
324-
onDoubleClick={(event) => handleClick(event, "evaluation")}
324+
onDoubleClick={(event) => handleDoubleClickLanding(event, "Evaluation")}
325325
disabled={isDisabled}
326326
onClick={() => {
327-
setEvaluationBtnstate(!evaluationBtnstate)
327+
// setEvaluationBtnstate(!evaluationBtnstate)
328328
}}
329329
onBlur={(event) => {
330330
let clickedTarget = event.relatedTarget

‎renderer/components/layout/layoutContext.jsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ function LayoutModelProvider({ children, layoutModel, setLayoutModel }) {
106106
return openModelViewer(action)
107107
case "openPandasProfiling":
108108
return openInPandasProfiling(action)
109-
case "openextractionLandingPage":
109+
case "openExtractionLandingPage":
110110
return openGeneric(action, "Extraction Module", "extractionLandingPage")
111+
case "openEvaluationLandingPage":
112+
return openGeneric(action, "Evaluation Module", "evaluationLandingPage")
111113
/*********** OPEN *****************/
112114
case "openResultsModule":
113115
return openResults(action)
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
import { randomUUID } from "crypto"
2+
import Image from "next/image"
3+
import { InputText } from "primereact/inputtext"
4+
import { useContext, useEffect, useState } from "react"
5+
import { Button, Card, Stack } from "react-bootstrap"
6+
import { FaAlignJustify } from "react-icons/fa"
7+
import { MdDashboard } from "react-icons/md"
8+
import { TbZoom } from "react-icons/tb"
9+
import med3paLogo from "../../../resources/MED3paLogo.png"
10+
import myimage from "../../../resources/medomics_transparent_bg.png"
11+
import { LayoutModelContext } from "../layout/layoutContext"
12+
import { insertMEDDataObjectIfNotExists } from "../mongoDB/mongoDBUtils"
13+
import { DataContext } from "../workspace/dataContext"
14+
import { MEDDataObject } from "../workspace/NewMedDataObject"
15+
16+
17+
// Variable used to store some modularity information about the module
18+
const typeInfo = {
19+
title: "Evaluation",
20+
extension: "medeval",
21+
internalFolders: []
22+
}
23+
24+
export default function EvaluationLandingPage() {
25+
const [nameEval, setNameEval] = useState("")
26+
const [experimentList, setExperimentList] = useState([]) // List of .medeval files
27+
const [loading, setLoading] = useState(false)
28+
const [pendingOpenId, setPendingOpenId] = useState(null)
29+
const { dispatchLayout, setLayoutRequestQueue } = useContext(LayoutModelContext)
30+
const { globalData } = useContext(DataContext)
31+
32+
// We use the useEffect hook to update the experiment list state when the workspace changes
33+
useEffect(() => {
34+
let localExperimentList = []
35+
if (!globalData["EXPERIMENTS"]) return
36+
for (const experimentId of globalData["EXPERIMENTS"].childrenIDs) {
37+
if (globalData[experimentId]) {
38+
localExperimentList.push(globalData[experimentId].name)
39+
}
40+
}
41+
setExperimentList(localExperimentList)
42+
}, [globalData]) // We log the workspace when it changes
43+
44+
useEffect(() => {
45+
if (!pendingOpenId || !globalData[pendingOpenId]) return
46+
47+
const medObject = globalData[pendingOpenId]
48+
const openItem = {
49+
index: pendingOpenId,
50+
canMove: true,
51+
isFolder: false,
52+
children: medObject.childrenIDs || [],
53+
data: medObject.name,
54+
canRename: true,
55+
type: medObject.type || "medeval",
56+
inWorkspace: medObject.inWorkspace ?? false,
57+
path: medObject.path ?? null,
58+
isLocked: medObject.isLocked ?? null,
59+
usedIn: medObject.usedIn ?? null
60+
}
61+
dispatchLayout({ type: "openInEvaluationModule", payload: openItem })
62+
if (setLayoutRequestQueue) {
63+
setLayoutRequestQueue((prev) => [...prev, { type: "DELETE_TAB", payload: { id: "evaluationLandingPage" } }])
64+
} else {
65+
dispatchLayout({ type: "remove", payload: { name: "Evaluation Module" } })
66+
}
67+
setPendingOpenId(null)
68+
}, [dispatchLayout, globalData, pendingOpenId, setLayoutRequestQueue])
69+
70+
const createSceneContent = async (sceneName) => {
71+
setLoading(true)
72+
73+
// Create custom zip file
74+
const sceneId = randomUUID()
75+
const sceneFileName = `${sceneName}.medeval`
76+
let sceneObject = new MEDDataObject({
77+
id: sceneId,
78+
name: sceneFileName,
79+
type: "medeval",
80+
parentID: "EXPERIMENTS",
81+
childrenIDs: [],
82+
inWorkspace: false
83+
})
84+
let sceneObjectId = await insertMEDDataObjectIfNotExists(sceneObject)
85+
86+
// Create hidden metadata file
87+
const emptyScene = [{ useMedStandard: false }]
88+
const metadataId = randomUUID()
89+
let metadataObject = new MEDDataObject({
90+
id: metadataId,
91+
name: "metadata.json",
92+
type: "json",
93+
parentID: sceneObjectId,
94+
childrenIDs: [],
95+
inWorkspace: false
96+
})
97+
await insertMEDDataObjectIfNotExists(metadataObject, null, emptyScene)
98+
99+
// Create internal folders
100+
const childrenIds = [metadataId]
101+
for (const folder of typeInfo.internalFolders) {
102+
const folderId = randomUUID()
103+
let medObject = new MEDDataObject({
104+
id: folderId,
105+
name: folder,
106+
type: "directory",
107+
parentID: sceneObjectId,
108+
childrenIDs: [],
109+
inWorkspace: false
110+
})
111+
await insertMEDDataObjectIfNotExists(medObject)
112+
childrenIds.push(folderId)
113+
}
114+
115+
// Load everything in globalData
116+
MEDDataObject.updateWorkspaceDataObject()
117+
118+
setPendingOpenId(sceneObjectId || sceneId)
119+
120+
// Update loading state
121+
setLoading(false)
122+
}
123+
124+
function choosePage(event, name) {
125+
event.stopPropagation()
126+
console.log(`Double clicked ${name}`, event, `open${name}Module`)
127+
dispatchLayout({ type: `open${name}Module`, payload: { pageId: name } })
128+
}
129+
130+
const trimmedName = nameEval.trim()
131+
const isValidName = /^[A-Za-z0-9_-]+$/.test(trimmedName)
132+
const existingNames = new Set(experimentList)
133+
const hasConflict =
134+
trimmedName !== "" && (existingNames.has(trimmedName) || existingNames.has(`${trimmedName}.medeval`))
135+
const nameError = trimmedName === ""
136+
? ""
137+
: !isValidName
138+
? "Use only letters, numbers, hyphens, or underscores."
139+
: hasConflict
140+
? "This evaluation session already exists."
141+
: ""
142+
const isStartDisabled = loading || trimmedName === "" || !isValidName || hasConflict
143+
144+
return (
145+
<div className="h-100 w-100">
146+
<h1 className="text-center fw-bold text-secondary mt-5" style={{ fontSize: "3rem", letterSpacing: "1px" }}>
147+
Evaluation Module
148+
</h1>
149+
150+
<div className="mx-auto text-center my-4" >
151+
<Image className="text-center" src={myimage} alt="" style={{ height: "30px", width: "30px" }} />
152+
</div>
153+
154+
{/* Description of the Evaluation Module */}
155+
<div className="mx-auto text-center" style={{ maxWidth: "860px", marginBottom: "40px" }}>
156+
<h5 className="lh-lg" style={{ fontSize: "1.1rem" }}>
157+
The Evaluation Module is as a quality-check workspace that tests completed AI models on fresh data,
158+
uses interactive dashboards to explain how they make decisions, and flags unreliable predictions to
159+
ensure no patient group is left behind.
160+
</h5>
161+
</div>
162+
163+
<div style={{ display: "flex", flexDirection: "vertical", flexGrow: "10", width: "100%", margin: "auto" }}>
164+
{/* Main Title and Subtitle */}
165+
<div className="h-100 w-100 d-flex justify-content-center align-items-center">
166+
<Stack direction="horizontal" gap={4} className="w-100">
167+
{/* Explainer Dashboard Card */}
168+
<Card className="flex-fill shadow-sm border-primary h-100 w-50 hover-border-success" style={{ cursor: "pointer" }}>
169+
<Card.Header className="bg-danger text-white d-flex align-items-center">
170+
<TbZoom className="me-2" color="white"/>
171+
<h5 className="text-white mb-0">Explainer Dashboard</h5>
172+
</Card.Header>
173+
<Card.Body className="d-flex flex-column justify-content-center align-items-center p-4">
174+
<MdDashboard className="me-6" size={100} color="red"/>
175+
<Card.Text className="mt-3 text-center">
176+
Build interactive dashboards to analyze and explain the predictions of your models.
177+
</Card.Text>
178+
<div
179+
className="p-inputgroup w-full my-3"
180+
style={{ margin: "5px", fontSize: "1rem", marginTop: "20px", maxWidth: "300px" }}
181+
>
182+
<InputText placeholder="Session Name" value={nameEval} onChange={(e) => setNameEval(e.target.value)} />
183+
<span className="p-inputgroup-addon">.medeval</span>
184+
</div>
185+
<Button variant="danger" onClick={() => createSceneContent(trimmedName)} disabled={isStartDisabled}>
186+
Start Evaluation
187+
</Button>
188+
189+
{nameError && (
190+
<div className="text-danger small mt-1">{nameError}</div>
191+
)}
192+
</Card.Body>
193+
</Card>
194+
195+
{/* MED3pa Card */}
196+
<Card className="flex-fill shadow-sm border-success h-100 w-50" style={{ cursor: "pointer" }}>
197+
<Card.Header className="bg-success text-white d-flex align-items-center">
198+
<FaAlignJustify className="me-2" color="white"/>
199+
<h5 className="text-white mb-0">MED3pa</h5>
200+
</Card.Header>
201+
<Card.Body className="d-flex flex-column justify-content-center align-items-center p-4">
202+
<Image src={med3paLogo} alt="MED3pa" width={120} height={120} />
203+
<Card.Text className="mt-3 text-center">
204+
Evaluate models stability and performance and flag unreliable predictions to ensure no patient group is left behind.
205+
</Card.Text>
206+
<Button variant="success" onClick={(e) => choosePage(e, "MED3pa")}>
207+
Start Analysis
208+
</Button>
209+
</Card.Body>
210+
</Card>
211+
</Stack>
212+
</div>
213+
</div>
214+
</div>
215+
)
216+
}

‎renderer/components/mainPages/exploratory.jsx‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import React, { useContext } from "react"
2-
import ModulePage from "./moduleBasics/modulePage"
3-
import { WorkspaceContext } from "../workspace/workspaceContext"
4-
import { ErrorRequestContext } from "../generalPurpose/errorRequestContext"
1+
import { shell } from 'electron'
2+
import Image from "next/image"
3+
import { useContext } from "react"
4+
import myimage from "../../../resources/medomics_transparent_bg.png"
55
import DTale from "../exploratory/dtale"
66
import SweetViz from "../exploratory/sweetViz"
77
import YDataProfiling from "../exploratory/yDataProfiling"
8-
import { shell } from 'electron'
8+
import { ErrorRequestContext } from "../generalPurpose/errorRequestContext"
9+
import { WorkspaceContext } from "../workspace/workspaceContext"
10+
import ModulePage from "./moduleBasics/modulePage"
11+
912

1013
/**
1114
*
@@ -18,7 +21,13 @@ const ExploratoryPage = () => {
1821
return (
1922
<>
2023
<div className="exploratory">
21-
<h2>🔍 Exploratory Data Analysis (EDA)</h2>
24+
<h1 className="text-center fw-bold text-secondary mt-2" style={{ fontSize: "3rem", letterSpacing: "1px" }}>
25+
Exploratory Module
26+
</h1>
27+
<div className="mx-auto text-center" >
28+
<Image className="text-center" src={myimage} alt="" style={{ height: "30px", width: "30px" }} />
29+
</div>
30+
<h2>🔍 Exploratory Data Analysis (EDA)</h2>
2231
<p>
2332
Before training a machine learning model, it is essential to explore and understand the dataset.
2433
This page provides three powerful tools, each with a unique role in data exploration:

0 commit comments

Comments
 (0)