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: 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/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
7 changes: 5 additions & 2 deletions src/components/display/SeriesDropDown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const SeriesDropDown = (props) => {
const [seriesList, setSeriesList] = useState([]);
const [loading, setLoading] = useState(false);
let mfIndex = {};
let seriesCallSent = false;
maxPort = parseInt(sessionStorage.getItem("maxPort"));

const checkMultiframe = () => {
Expand Down Expand Up @@ -112,11 +113,12 @@ const SeriesDropDown = (props) => {
}

if (checkMultiframe() && studyExist && checkAllSameSeries(data[projectID][patientID][studyUID].list) && !data[projectID][patientID][studyUID].mfMerged) {
if (!studyInGrid) {
if (!studyInGrid && !seriesCallSent) {
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);
seriesCallSent = true;
}).catch((err) => console.error(err));
}
} if (studyExist && hasDescription) {
Expand All @@ -129,10 +131,11 @@ const SeriesDropDown = (props) => {
if (studyExist && shouldFill && studyUID && projectID && patientID && !studyInGrid) {
props.dispatch(getSeriesAdditional({studyUID, projectID, patientID}))
} else {
if (!studyInGrid) {
if (!studyInGrid && !seriesCallSent) {
getSeries(projectID, patientID, studyUID, false, 'series dropdown, 2').then(res => {
props.dispatch(setSeriesData(projectID, patientID, studyUID, res.data, true));
setLoading(false);
seriesCallSent = true;
}).catch((err) => console.error(err));
}
}
Expand Down
36 changes: 26 additions & 10 deletions src/components/flexView/StudyTable.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from "react";
import ReactTable from "react-table-v6";
import { toast } from "react-toastify";
import { FaSortDown, FaSortUp } from "react-icons/fa";
import { AiOutlineSortAscending, AiOutlineSortDescending } from 'react-icons/ai';
import { generalizeDate, pseudo } from "../../Utils/aid.js";
Expand Down Expand Up @@ -48,6 +49,7 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {

const filterExam = (filter, row) => {
try {
// if (checkPHIStatus(filter.id)) return;
const keyLowercase = filter.value.toLowerCase();
const str = Array.isArray(row[filter.id]) ? row[filter.id].join() : row[filter.id];
return str.toLowerCase().includes(keyLowercase);
Expand All @@ -58,6 +60,7 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {

const filterStringIncludes = (filter, row) => {
try {
// if (checkPHIStatus(filter.id)) return;
const keyLowercase = filter.value.toLowerCase();
const textLowercase = row[filter.id].toLowerCase();
return textLowercase.includes(keyLowercase);
Expand All @@ -68,6 +71,7 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {

const filterStartsWith = (filter, row) => {
try {
// if (checkPHIStatus(filter.id)) return;
const keyLowercase = filter.value.toLowerCase();
let data = row[filter.id];
data = typeof data === 'number' ? '' + data : data;
Expand All @@ -79,6 +83,7 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {

const filterMatch = (filter, row) => {
try {
// if (checkPHIStatus(filter.id)) return;
const keyLowercase = filter.value.toLowerCase();
return row[filter.id].toLowerCase() === keyLowercase;
} catch (err) {
Expand All @@ -95,6 +100,17 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {
}
}

const checkPHIStatus = (column) => {
const phiCol = ["patientName-id", "patientID-id", "studyUID-id", "studyAccessionNumber-id", "studyID-id"];
const isPHI = phiCol.includes(column);
console.log(" ---> isPHI", isPHI);
if (isPHI && !showingPHI) {
toast.info("PHI is currently hidden!", { position: "top-right" });
return true;
}
return false;
}

const returnHeader = (header, id) => {
const headerParts = [];
headerParts.push(<span>{header}</span>)
Expand Down Expand Up @@ -136,10 +152,10 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {
accessor: "patientName",
id: "patientName-id",
resizable: true,
sortable: true,
sortable: showingPHI ? true : false,
show: true,
style: { color: 'white' },
filterMethod: (filter, row) => filterStringIncludes(filter, row),
filterMethod: (filter, row) => showingPHI ? filterStringIncludes(filter, row) : () => {return},
getProps: (state, rowInfo) => ({
style: {
backgroundColor: sortedCol === "patientName-id" ? "#3a3f44" : null
Expand All @@ -155,9 +171,9 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {
accessor: "patientID",
id: "patientID-id",
resizable: true,
sortable: true,
sortable: showingPHI ? true : false,
show: true,
filterMethod: (filter, row) => filterStartsWith(filter, row),
filterMethod: (filter, row) => showingPHI ? filterStartsWith(filter, row) : () => {return},
getProps: (state, rowInfo) => ({
style: {
backgroundColor: sortedCol === "patientID-id" ? "#3a3f44" : null
Expand Down Expand Up @@ -265,9 +281,9 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {
accessor: "studyUID",
id: "studyUID-id",
resizable: true,
sortable: true,
sortable: showingPHI ? true : false,
show: true,
filterMethod: (filter, row) => filterStringIncludes(filter, row),
filterMethod: (filter, row) => showingPHI ? filterStringIncludes(filter, row) : () => {return},
getProps: (state, rowInfo) => ({
style: {
backgroundColor: sortedCol === "studyUID-id" ? "#3a3f44" : null
Expand Down Expand Up @@ -401,15 +417,15 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {
accessor: "studyAccessionNumber",
id: "studyAccessionNumber-id",
resizable: true,
sortable: true,
sortable: showingPHI ? true : false,
show: true,
getProps: (state, rowInfo) => ({
style: {
backgroundColor:
sortedCol === "studyAccessionNumber-id" ? "#3a3f44" : null
}
}),
filterMethod: (filter, row) => filterStartsWith(filter, row),
filterMethod: (filter, row) => showingPHI ? filterStartsWith(filter, row) : () => {return},
Cell: row => {
return <div>{pseudo(row.original.studyAccessionNumber, "Acc #-")}</div>;
}
Expand All @@ -420,14 +436,14 @@ const StudyTable = ({ data, order, displaySeries, showingPHI }) => {
accessor: "studyID",
id: "studyID-id",
resizable: true,
sortable: true,
sortable: showingPHI ? true : false,
show: true,
getProps: (state, rowInfo) => ({
style: {
backgroundColor: sortedCol === "studyID-id" ? "#3a3f44" : null
}
}),
filterMethod: (filter, row) => filterStringIncludes(filter, row),
filterMethod: (filter, row) => showingPHI ? filterStringIncludes(filter, row) : () => {return},
Cell: row => {
return <div>{pseudo(row.original.studyID, "ID #-")}</div>;
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/flexView/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ import "react-table-v6/react-table.css";
const TreeTable = treeTableHOC(ReactTable);
let mode;
let maxPort;
let seriesCallSent;

class FlexView extends React.Component {
mode = sessionStorage.getItem("mode");
maxPort = sessionStorage.getItem("maxPort");
seriesCallSent = false;
state = {
columns: [],
order:
Expand Down Expand Up @@ -108,10 +110,11 @@ class FlexView extends React.Component {
: null;

try {
if (!dataExists) {
if (!dataExists && !seriesCallSent) {
this.setState({ loading: true });
({ data: series } = await getSeries(projectID, patientID, studyUID));
this.setState({ loading: false });
seriesCallSent = true;
this.props.dispatch(
setSeriesData(projectID, patientID, studyUID, series, true)
);
Expand Down
Loading