Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 156 additions & 17 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ejs",
"version": "1.6",
"version": "1.7",
"private": true,
"dependencies": {
"@dnd-kit/core": "^6.3.1-next-202411517925",
Expand Down Expand Up @@ -108,4 +108,4 @@
"image-size": "1.2.1",
"brace-expansion": "2.0.1"
}
}
}
5 changes: 4 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class App extends Component {
constructor(props) {
super(props);
this.eventSource = null;
this.seriesCallSent = false;
this.state = {
openMng: false,
keycloak: null,
Expand Down Expand Up @@ -639,6 +640,7 @@ class App extends Component {

async componentDidMount() {
localStorage.setItem("treeData", JSON.stringify({}));
sessionStorage.removeItem("searchState");
Promise.all([
fetch(`${process.env.PUBLIC_URL}/config.json`),
fetch(`${process.env.PUBLIC_URL}/keycloak.json`),
Expand Down Expand Up @@ -900,9 +902,10 @@ class App extends Component {
seriesData[projectID][patientID] &&
seriesData[projectID][patientID][studyUID] &&
seriesData[projectID][patientID][studyUID].list;
if (!dataExists) {
if (!dataExists && !this.seriesCallSent) {
({ data: series } = await getSeries(projectID, patientID, studyUID, false, "App.js, getSeriesData"));
if (series && series.length === 0 && mode === "teaching") ({ data: series } = await getSeries(projectID, patientID, studyUID, true, "App.js, getSeriesData"));
this.seriesCallSent = true;
this.props.dispatch(setSeriesData(projectID, patientID, studyUID, series, true));
this.setState({ teachingLoading: false });
return series;
Expand Down
4 changes: 2 additions & 2 deletions src/components/aimEditor/aimEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ class AimEditor extends Component {
};

handleUserKeyPress = (e) => {
// save shortcut ctrl + y
if (e.keyCode == 89 && e.ctrlKey) {
// save shortcut ctrl + y or enter
if ((e.keyCode === 89 && e.ctrlKey) || e.keyCode === 13) {
this.save();
}
};
Expand Down
4 changes: 3 additions & 1 deletion src/components/annotationSearch/AnnotationTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ function Table({
function AnnotationTable(props) {
maxPort = parseInt(sessionStorage.getItem("maxPort"));
mode = sessionStorage.getItem("mode");
let seriesCallSent = false;
const [pageCount, setPageCount] = useState(0);
const [data, setData] = useState([]);
const [showSelectSeriesModal, setShowSelectSeriesModal] = useState(false);
Expand Down Expand Up @@ -390,14 +391,15 @@ function AnnotationTable(props) {
seriesData[projectID][patientID] &&
seriesData[projectID][patientID][studyUID] &&
seriesData[projectID][patientID][studyUID].list;
if (!dataExists) {
if (!dataExists && !seriesCallSent) {
const { data: series } = await getSeries(
projectID,
patientID,
studyUID,
force,
"getSeriesData, AnnotationTable"
);
seriesCallSent = true;
props.dispatch(setSeriesData(projectID, patientID, studyUID, series));
props.dispatch(loadCompleted());
return series;
Expand Down
3 changes: 2 additions & 1 deletion src/components/annotationSearch/ModalityFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ const ModalityFilter = (props) => {
{modalities.map((modality, i) => {
return (
<div id='noClose' key={i} className="mb-3 col-md-4">
<input id='noClose' className="form-check-input" type="checkbox" value={compModality[modality] ? compModality[modality] : modality} checked={selecteds.includes(compModality[modality] ? compModality[modality] : modality)} onChange={handleChange} />
{/* <input id='noClose' className="form-check-input" type="checkbox" value={compModality[modality] ? compModality[modality] : modality} checked={selecteds.includes(compModality[modality] ? compModality[modality] : modality)} onChange={handleChange} /> */}
<input id='noClose' className="form-check-input" type="checkbox" value={modality} checked={selecteds.includes(modality)} onChange={handleChange} />
<label id='noClose' className="form-check-label title-case" style={{ paddingLeft: '0.3em' }} htmlFor="noCLose">
{modality}
</label>
Expand Down
70 changes: 69 additions & 1 deletion src/components/annotationSearch/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ const AnnotationSearch = (props) => {
const [encArgs, setEncArgs] = useState("");
const [decrArgs, setDecrArgs] = useState("");
const [allSelected, setAllSelected] = useState({});
const [hydrated, setHydrated] = useState(false);

const populateSearchResult = (res, pagination, afterDelete) => {
const result = Array.isArray(res) ? res[0] : res;
Expand Down Expand Up @@ -290,6 +291,62 @@ const AnnotationSearch = (props) => {
setDecrArgs(packedData);
};

useEffect(() => {
const raw = sessionStorage.getItem("searchState");
if (raw) {
try {
const s = JSON.parse(raw);

setTfOnly(!!s.tfOnly);
setMyCases(!!s.myCases);
setSelectedSubs(s.selectedSubs || []);
setSelectedMods(s.selectedMods || []);
setSelectedAnatomies(s.selectedAnatomies || []);
setSelectedDiagnosis(s.selectedDiagnosis || []);
setQuery(s.query || "");
setSelectedProject(s.selectedProject || "");
setFilters(s.filters || {});
setSort(s.sort || []);
} catch (e) {
console.error("Failed to parse searchState", e);
}
}

setHydrated(true);
}, []);

useEffect(() => {
if (!hydrated) return;

const searchState = {
tfOnly,
myCases,
selectedSubs,
selectedMods,
selectedAnatomies,
selectedDiagnosis,
query,
selectedProject,
filters,
sort,
};

sessionStorage.setItem("searchState", JSON.stringify(searchState));
}, [
hydrated,
tfOnly,
myCases,
selectedSubs,
selectedMods,
selectedAnatomies,
selectedDiagnosis,
query,
selectedProject,
filters,
sort,
]);


useEffect(() => {
window.addEventListener("openTeachingFilesModal", handleTeachingFilesModal);
return () => {
Expand Down Expand Up @@ -343,7 +400,16 @@ const AnnotationSearch = (props) => {
500
);

const checkPHIStatus = (column) => {
if (column === "patientName" || column === "subjectID") {
toast.info("PHI is currently hidden!", { position: "top-right" });
return true;
}
return false;
}

const handleSort = (column) => {
if (checkPHIStatus(column)) return;
if (!sort.length || (sort[0] !== column && sort[0] !== "-" + column))
setSort([column]);
else if (sort[0] === column) {
Expand All @@ -352,6 +418,8 @@ const AnnotationSearch = (props) => {
};

const handleFilter = (column, target) => {
console.log("column ", column)
if (checkPHIStatus(column)) return;
const { value } = target;
const newFilters = { ...filters };
if (value.length) newFilters[column] = value;
Expand Down Expand Up @@ -1462,7 +1530,7 @@ const AnnotationSearch = (props) => {
{selectedSubs.length +
selectedMods.length +
selectedAnatomies.length +
selectedDiagnosis >
selectedDiagnosis.length >
1 && (
<button
type="button"
Expand Down
4 changes: 3 additions & 1 deletion src/components/annotationsList/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ export const storeAimSelectionAll = (checked, map, tbPageIndex, clearAll) => {
return { type: STORE_AIM_SELECTION_ALL, payload: { checked, map, tbPageIndex, clearAll } };
}

export const setSeriesData = (projectID, patientID, studyUID, seriesData, filled, mfMerged) => {
export const setSeriesData = (projectID, patientID, studyUID, seriesData, filled, mfMerged, str) => {
console.log(mfMerged, str)
console.log(seriesData)
const data = seriesData.map(el => {
el.filled = filled;
return el;
Expand Down
4 changes: 3 additions & 1 deletion src/components/annotationsList/selectSerieModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class selectSerieModal extends React.Component {
this.maxPort = parseInt(sessionStorage.getItem("maxPort"));
this.mode = sessionStorage.getItem("mode");
this.wadoUrl = sessionStorage.getItem("wadoUrl");
this.seriesCallSent = false;
}

//get the serie list
Expand Down Expand Up @@ -114,14 +115,15 @@ class selectSerieModal extends React.Component {
seriesData[projectID][patientID] &&
seriesData[projectID][patientID][studyUID] &&
seriesData[projectID][patientID][studyUID].list;
if (!dataExists) {
if (!dataExists && !this.seriesCallSent) {
const { data: series } = await getSeries(
projectID,
patientID,
studyUID,
false,
'select series, data collecting !dataExists'
);
this.seriesCallSent = true;
this.props.dispatch(
setSeriesData(projectID, patientID, studyUID, series, true)
);
Expand Down
86 changes: 61 additions & 25 deletions src/components/display/SeriesDropDown.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import React, { useState, useEffect, useRef } from "react";
import { connect } from "react-redux";
import { toast } from "react-toastify";
import PropagateLoader from "react-spinners/PropagateLoader";
Expand All @@ -23,8 +23,15 @@ const SeriesDropDown = (props) => {
const [seriesList, setSeriesList] = useState([]);
const [loading, setLoading] = useState(false);
let mfIndex = {};
// let seriesCallSent = false;
// let additionalInfoCallSent = false;
const seriesCallSentRef = useRef(new Set());
const additionalInfoCallSentRef = useRef(new Set());
maxPort = parseInt(sessionStorage.getItem("maxPort"));

const makeKey = (projectID, patientID, studyUID) =>
`${projectID}|${patientID}|${studyUID}`;

const checkMultiframe = () => {
const { openSeries, activePort, openSeriesAddition } = props;
// if the currrent series is multiframe
Expand Down Expand Up @@ -80,6 +87,7 @@ const SeriesDropDown = (props) => {
}

useEffect(() => {
if (!props.serie) return;
let studyUID;
let projectID;
let patientID;
Expand All @@ -91,7 +99,7 @@ const SeriesDropDown = (props) => {
projectID = props.serie.projectID;
patientID = props.serie.patientID;
}

const key = makeKey(projectID, patientID, studyUID);
const {list, studyExist} = findSeriesListFmStore();
const isString = (currentValue) => currentValue.seriesDescription === '' || typeof currentValue.seriesDescription === 'string';
const isFilled= (currentValue) => currentValue.filled || currentValue.multiFrameImage;
Expand All @@ -110,34 +118,62 @@ const SeriesDropDown = (props) => {
break;
}
}

if (checkMultiframe() && studyExist && checkAllSameSeries(data[projectID][patientID][studyUID].list) && !data[projectID][patientID][studyUID].mfMerged) {
if (!studyInGrid) {
getSeries(projectID, patientID, studyUID, false, 'seriesdropdown, checkMultiframe').then(res => {
const newList = mergeLists(data[projectID][patientID][studyUID], res.data);
props.dispatch(setSeriesData(projectID, patientID, studyUID, newList, true, true));
setLoading(false);
}).catch((err) => console.error(err));
}
} if (studyExist && hasDescription) {
let series = data[projectID][patientID][studyUID].list;
series = series?.filter(isSupportedModality);
setSeriesList(series);
} else {
setLoading(true);
const shouldFill = props.index === 0 || !hasDescription ? true : !otherSeriesOpened(props.openSeries, props.index);
if (studyExist && shouldFill && studyUID && projectID && patientID && !studyInGrid) {
props.dispatch(getSeriesAdditional({studyUID, projectID, patientID}))
} else {
if (!studyInGrid) {
getSeries(projectID, patientID, studyUID, false, 'series dropdown, 2').then(res => {
props.dispatch(setSeriesData(projectID, patientID, studyUID, res.data, true));
try {
if (checkMultiframe() && studyExist && checkAllSameSeries(data[projectID][patientID][studyUID].list) && !data[projectID][patientID][studyUID].mfMerged) {
if (!studyInGrid && !seriesCallSentRef.current.has(key)) {
getSeries(projectID, patientID, studyUID, false, 'seriesdropdown, checkMultiframe').then(res => {
const newList = mergeLists(data[projectID][patientID][studyUID], res.data);
props.dispatch(setSeriesData(projectID, patientID, studyUID, newList, true, true));
setLoading(false);
seriesCallSentRef.current.add(key);
}).catch((err) => console.error(err));
}
} if (studyExist && hasDescription) {
let series = data[projectID][patientID][studyUID].list;
series = series?.filter(isSupportedModality);
setSeriesList(series);
} else {
const shouldFill = props.index === 0 || !hasDescription ? true : !otherSeriesOpened(props.openSeries, props.index);
if (studyExist && shouldFill && studyUID && projectID && patientID && !studyInGrid && !additionalInfoCallSentRef.current.has(key)) {
setLoading(true);
props.dispatch(getSeriesAdditional({studyUID, projectID, patientID}));
additionalInfoCallSentRef.current.add(key);
setLoading(false);
} else {
if (!studyInGrid && !seriesCallSentRef.current.has(key)) {
setLoading(true);
getSeries(projectID, patientID, studyUID, false, 'series dropdown, 2').then(res => {
props.dispatch(setSeriesData(projectID, patientID, studyUID, res.data, true, 'here'));
setLoading(false);
seriesCallSentRef.current.add(key);
}).catch((err) => console.error(err));
}
}
}
} catch (err) {
seriesCallSentRef.current.delete(key);
additionalInfoCallSentRef.current.delete(key);
console.error(e);
}
}, [props.seriesData]);
}, [props.seriesData, props.serie, props.index, props.activePort]);

useEffect(() => {
if (!props.serie) return;
let studyUID;
let projectID;
let patientID;
if (props.serie) {
studyUID = props.serie.studyUID;
projectID = props.serie.projectID;
patientID = props.serie.patientID;
let series = props.seriesData?.[projectID]?.[patientID]?.[studyUID]?.list;
series = series?.filter(isSupportedModality);
setSeriesList(series);
}
}, [props.seriesData]
);



const checkIfSerieOpen = (key) => {
let isOpen = false;
Expand Down
Loading