Skip to content

Commit cd7b125

Browse files
authored
Merge pull request #548 from MEDomicsLab/learningFixes
Learning fixes v1.8.1
2 parents b5218b0 + 3f97cb3 commit cd7b125

5 files changed

Lines changed: 40 additions & 23 deletions

File tree

Binary file not shown.

‎pythonEnv/merged_requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ numpy==1.22.4
1919
numpyencoder==0.3.0
2020
pandas==1.4.4
2121
plotly==5.14.1
22-
pycaret==3.3.2
22+
pycaret==3.1.0
2323
pydicom==1.2.2
2424
pymongo==4.7.3
2525
pyunpack==0.3

‎pythonEnv/requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ psutil==5.9.4
202202
ptyprocess==0.7.0
203203
pure-eval==0.2.2
204204
pyarrow==10.0.1
205-
pycaret==3.3.2
205+
pycaret==3.1.0
206206
pycparser==2.21
207207
pydantic==2.4.2
208208
pydantic_core==2.10.1

‎renderer/components/learning/results/utilities/parameters.jsx‎

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,45 @@ import { Column } from "primereact/column"
1515
const Parameters = ({ params, tableProps, columnNames }) => {
1616
const [data, setData] = useState([])
1717
const [selectedRows, setSelectedRows] = useState([])
18+
19+
const isEmptyOrNull = (value) => {
20+
// Check specifically for null or undefined
21+
if (value == null) { // Using loose equality (==) checks for both null and undefined
22+
return true
23+
}
24+
25+
// Check if the value is an object (but not null, which typeof also calls "object")
26+
if (typeof value === 'object') {
27+
// A robust check for an empty object: ensure its constructor is Object and it has no own properties
28+
return Object.keys(value).length === 0 && value.constructor === Object
29+
}
30+
31+
// Other non-object, non-null values (like strings, numbers, booleans)
32+
// are not considered "empty objects" or "null" by this definition.
33+
return false
34+
}
35+
1836
useEffect(() => {
1937
if (params) {
2038
let dataList = []
2139
Object.keys(params).forEach((key) => {
22-
let value = params[key]
23-
// For array values
24-
if (Array.isArray(value)) {
25-
value = JSON.stringify(value)
40+
// skip null or undefined values
41+
if (isEmptyOrNull(params[key])) {
42+
dataList.push({
43+
param: key,
44+
Value: "null"
45+
})
46+
} else {
47+
let value = params[key]
48+
// For array values
49+
if (Array.isArray(value)) {
50+
value = JSON.stringify(value)
51+
}
52+
dataList.push({
53+
param: key,
54+
Value: value != null ? value : "null"
55+
})
2656
}
27-
dataList.push({
28-
param: key,
29-
Value: value != null ? value : "null"
30-
})
3157
})
3258
setData(dataList)
3359
}

‎renderer/components/mainPages/application.jsx‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,8 @@ const ApplicationPage = ({ pageId }) => {
358358
* @param {Array} columnsArray An array of the columns of the dataset
359359
*/
360360
const checkWarnings = (columnsArray) => {
361-
let datasetColsString = JSON.stringify(columnsArray)
362-
let modelColsString = JSON.stringify(modelFeatures)
363-
if (datasetColsString !== modelColsString && modelFeatures && columnsArray) {
361+
if (!modelFeatures.every((col) => columnsArray.includes(col)) && modelFeatures && columnsArray) {
362+
const missingCols = modelFeatures.filter(col => !columnsArray.includes(col))
364363
setDatasetHasWarning({
365364
state: true,
366365
tooltip: (
@@ -371,17 +370,9 @@ const ApplicationPage = ({ pageId }) => {
371370
<div style={{ maxHeight: "400px", overflowY: "auto", overflowX: "hidden" }}>
372371
<Row>
373372
<Col>
374-
<p>Needed columns:</p>
373+
<p>Missing columns:</p>
375374
<ul>
376-
{modelFeatures.sort().map((col) => {
377-
return <li key={col}>{col}</li>
378-
})}
379-
</ul>
380-
</Col>
381-
<Col>
382-
<p>Received columns:</p>
383-
<ul>
384-
{columnsArray.sort().map((col) => {
375+
{missingCols.map((col) => {
385376
return <li key={col}>{col}</li>
386377
})}
387378
</ul>

0 commit comments

Comments
 (0)