diff --git a/app/Services/Pacs/Sync/StudiesSync.php b/app/Services/Pacs/Sync/StudiesSync.php index 8d12fa0..4b26c4d 100644 --- a/app/Services/Pacs/Sync/StudiesSync.php +++ b/app/Services/Pacs/Sync/StudiesSync.php @@ -132,6 +132,12 @@ public function getStudyDescription(mixed $orthanc_src): ?string public function transformData(mixed $orthanc_src): array { + $stable_study = (bool) data_get($orthanc_src, 'IsStable', false); + if (! $stable_study) { + // do not process unstable studies. wait for next sync when the study becomes stable + return []; + } + $orthanc_uuid = strtolower($orthanc_src['ID']); $dicom_tags = $this->getStudyDicomTags($orthanc_uuid); $routing = DicomStudyRouter::matchStudy($dicom_tags); @@ -171,12 +177,9 @@ public function transformData(mixed $orthanc_src): array 'study_description' => $descr, ]; - if ((bool) data_get($orthanc_src, 'IsStable', false)) { - $study['study_status'] = StudyLevelStatus::Unassigned->value; - } else { - $study['study_status'] = StudyLevelStatus::Pending->value; - } - + $study['study_status'] = $stable_study + ? StudyLevelStatus::Unassigned->value + : StudyLevelStatus::Pending->value; $study['patient_birthdate'] = null; $dob = data_get($orthanc_src, 'PatientMainDicomTags.PatientBirthDate'); if (filled($dob)) {