Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
salimkanoun committed Sep 13, 2024
1 parent 9dcb729 commit 9dc9f30
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/content/studies/StudyEditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type StudyEditFormProps = {
const StudyEditForm = ({ data, onSubmit, jobId, onJobCompleted }: StudyEditFormProps) => {
const [patientName, setPatientName] = useState<string | null>(data?.patientMainDicomTags?.patientName ?? null);
const [patientId, setPatientId] = useState<string | null>(data?.patientMainDicomTags?.patientId ?? null);
const [patientBirthDate, setPatientBirthDate] = useState<string | null>(data?.patientMainDicomTags?.patientBirthDate ?? null);
const [patientSex, setPatientSex] = useState<string | null>(data?.patientMainDicomTags?.patientSex ?? null);

const [accessionNumber, setAccessionNumber] = useState<string | null>(data?.mainDicomTags?.accessionNumber ?? null);
const [studyDate, setStudyDate] = useState<string | null>(data?.mainDicomTags?.studyDate ?? null);
Expand All @@ -28,10 +30,6 @@ const StudyEditForm = ({ data, onSubmit, jobId, onJobCompleted }: StudyEditFormP
const [fieldsToRemove, setFieldsToRemove] = useState<string[]>([]);
const [keepUIDs, setKeepUIDs] = useState(false)

useEffect(() => {
if (keepUIDs) setKeepSource(true)
}, [keepUIDs])

const handleFieldRemoval = (field: string, checked: boolean) => {
setFieldsToRemove((prev) =>
checked ? [...prev, field] : prev.filter((item) => item !== field)
Expand All @@ -43,6 +41,11 @@ const StudyEditForm = ({ data, onSubmit, jobId, onJobCompleted }: StudyEditFormP

if (patientId !== data?.patientMainDicomTags?.patientId) replace.patientId = patientId;
if (patientName !== data?.patientMainDicomTags?.patientName) replace.patientName = patientName;
if (replace.patientId || replace.patientName) {
replace.patientBirthDate = patientBirthDate;
replace.patientSex = patientSex;
}

if (accessionNumber !== data?.mainDicomTags?.accessionNumber) replace.accessionNumber = accessionNumber;
if (studyDate !== data?.mainDicomTags?.studyDate) replace.studyDate = studyDate;
if (studyDescription !== data?.mainDicomTags?.studyDescription) replace.studyDescription = studyDescription;
Expand Down Expand Up @@ -78,6 +81,18 @@ const StudyEditForm = ({ data, onSubmit, jobId, onJobCompleted }: StudyEditFormP
onChange={(e: ChangeEvent<HTMLInputElement>) => setPatientId(e.target.value)}
fieldName="patientID"
/>
<Input
label="Patient Birthdate"
value={patientBirthDate}
onChange={(e: ChangeEvent<HTMLInputElement>) => setPatientBirthDate(e.target.value)}
fieldName="patientBirthdate"
/>
<Input
label="Patient Sex"
value={patientSex}
onChange={(e: ChangeEvent<HTMLInputElement>) => setPatientSex(e.target.value)}
fieldName="patientSex"
/>
</div>
<div className="grid grid-cols-1 gap-10 lg:grid-cols-2">
<InputWithDelete
Expand Down
2 changes: 2 additions & 0 deletions src/services/orthanc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ export const modifyStudy = (
Replace: {
PatientID: study.replace.patientId,
PatientName: study.replace.patientName,
PatientSex : study.replace.patientSex,
PatientBirthDate : study.replace.patientBirthDate,
AccessionNumber: study.replace.accessionNumber,
StudyDate: study.replace.studyDate,
StudyDescription: study.replace.studyDescription,
Expand Down

0 comments on commit 9dc9f30

Please sign in to comment.