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"
}
}
}
12 changes: 8 additions & 4 deletions 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 = null;
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 @@ -825,7 +827,7 @@ class App extends Component {
if (TF.total_rows) {
this.displaySeries(packedData);
} else {
const seriesArray = await this.getSeriesData(packedData);
const seriesArray = await this.getSeriesData(packedData, 'handle args');
window.dispatchEvent(
new CustomEvent("openTeachingFilesModal", {
detail: { seriesArray, args, packedData },
Expand Down Expand Up @@ -888,7 +890,8 @@ class App extends Component {
return true;
};

getSeriesData = async (studyData) => {
getSeriesData = async (studyData, src) => {
console.log(' ---> getSeriesData', src);
const { projectID, studyUID } = studyData;
const { seriesData } = this.props;
let { patientID, subjectID } = studyData;
Expand All @@ -900,9 +903,10 @@ class App extends Component {
seriesData[projectID][patientID] &&
seriesData[projectID][patientID][studyUID] &&
seriesData[projectID][patientID][studyUID].list;
if (!dataExists) {
if (!dataExists && this.seriesCallSent !== studyUID) {
({ 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 = studyUID;
this.props.dispatch(setSeriesData(projectID, patientID, studyUID, series, true));
this.setState({ teachingLoading: false });
return series;
Expand Down Expand Up @@ -1353,7 +1357,7 @@ class App extends Component {

displayNextStudy = async (study, worklist) => {
const { studyDescription } = study;
let series = await this.getSeriesData(study);
let series = await this.getSeriesData(study, 'display next study');
const maxPort = parseInt(sessionStorage.getItem("maxPort"));
if (series.length <= maxPort) {
// viewSelection(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 !== studyUID) {
const { data: series } = await getSeries(
projectID,
patientID,
studyUID,
force,
"getSeriesData, AnnotationTable"
);
seriesCallSent = studyUID;
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
73 changes: 71 additions & 2 deletions 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") && !props.showingPHI) {
toast.info("Sorting/filtering this column is disabled when PHI is 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 Expand Up @@ -1985,7 +2053,8 @@ const mapsStateToProps = (state) => {
openSeries: state.annotationsListReducer.openSeries,
searchTableIndex: state.annotationsListReducer.searchTableIndex,
refreshMap: state.annotationsListReducer.refreshMap,
multipageAimSelection: state.annotationsListReducer.multipageAimSelection
multipageAimSelection: state.annotationsListReducer.multipageAimSelection,
showingPHI: state.annotationsListReducer.showingPHI
};
};

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
12 changes: 10 additions & 2 deletions src/components/annotationsList/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ import {
import { teachingFileTempCode } from "../../constants";

let mode = sessionStorage.getItem('mode');
let isPHIVisible = localStorage.getItem('isPHIVisible');
isPHIVisible = isPHIVisible ? JSON.parse(isPHIVisible) : false;

const setPHIVisible = (state) => {
localStorage.setItem('isPHIVisible', String(state))
}

const initialState = {
openSeries: [],
Expand Down Expand Up @@ -105,7 +111,7 @@ const initialState = {
showLabels: false,
showAnnotations: mode === 'teaching' ? false : true,
lastLocation: '',
showingPHI: false,
showingPHI: isPHIVisible || false,
};


Expand Down Expand Up @@ -136,7 +142,9 @@ const asyncReducer = (state = initialState, action) => {
// updatedOpenSeries[state.activePort].imageIndex = action.imageIndex;
// return { ...state, openSeries: updatedOpenSeries };
case SHOW_PHI:
return { ...state, showingPHI: !state.showingPHI };
const nextPHIState = !state.showingPHI;
setPHIVisible(nextPHIState);
return { ...state, showingPHI: nextPHIState };
case SET_LAST_LOCATION:
return { ...state, lastLocation: action.lastLocation };
case TOGGLE_ALL_CALCULATIONS:
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 = null;
}

//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 !== studyUID) {
const { data: series } = await getSeries(
projectID,
patientID,
studyUID,
false,
'select series, data collecting !dataExists'
);
this.seriesCallSent = studyUID;
this.props.dispatch(
setSeriesData(projectID, patientID, studyUID, series, true)
);
Expand Down
Loading