Skip to content

Commit

Permalink
Merge pull request #721 from Pixilib/GaelO2-dev
Browse files Browse the repository at this point in the history
Gael o2 dev
  • Loading branch information
salimkanoun authored Apr 17, 2024
2 parents e7dc0d6 + 3b21f4a commit 27802af
Show file tree
Hide file tree
Showing 37 changed files with 1,249 additions and 2,274 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/clean-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 'clean-packages'
on:
push:
branches:
- Gaelo2
- '*'

jobs:
build:
Expand All @@ -20,7 +20,7 @@ jobs:
username: 'salimkanoun'
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/delete-package-versions@v4
- uses: actions/delete-package-versions@v5
with:
package-name: 'gaelo'
package-type: 'container'
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ RUN apt-get update -qy && \
sqlite3 \
supervisor \
zip \
libc-client-dev \
libkrb5-dev \
libpng-dev \
libmemcached-dev \
mariadb-client \
Expand All @@ -30,6 +32,10 @@ RUN apt-get update -qy && \

RUN pecl install pcov redis memcached
RUN docker-php-ext-install gd zip pdo pdo_mysql pdo_pgsql mbstring bcmath ctype fileinfo xml bz2 pcntl curl ftp

RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
docker-php-ext-install imap

RUN docker-php-ext-configure opcache --enable-opcache \
&& docker-php-ext-install opcache

Expand Down
3 changes: 3 additions & 0 deletions GaelO2/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ AZURE_CONTAINER_NAME=''
AZURE_BLOB_PREFIX=''
AZURE_FILE_CACHE_CONTAINER_NAME=''
FILE_CACHE_DRIVER='file'
MONITORING_IMAP_CONNECTION_STRING=''
MONITORING_IMAP_USERNAME=''
MONITORING_IMAP_PASSWORD=''

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand Down
4 changes: 1 addition & 3 deletions GaelO2/app/Console/Commands/DeleteVisitsOlderThan.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function handle(

$this->gaelODeleteRessourcesRepository->deleteReviews($visitIds, $studyName);
$this->gaelODeleteRessourcesRepository->deleteReviewStatus($visitIds, $studyName);
$this->gaelODeleteRessourcesRepository->deleteTrackerOfVisits($visitIds, $studyEntity->name);
$this->gaelODeleteRessourcesRepository->deleteTrackerOfVisits($visitIds, $studyName);

$dicomSeries = $this->getDicomSeriesOfVisits($visitIds);
$orthancIdArray = array_map(function ($seriesId) {
Expand All @@ -119,10 +119,8 @@ public function handle(
}
}


$this->info('The command was successful !');


return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\GaelO\Services\FormService;

use App\GaelO\Constants\Constants;
use App\GaelO\Constants\Enums\ReviewStatusEnum;
use App\GaelO\Exceptions\GaelOBadRequestException;
use App\GaelO\Exceptions\GaelOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function runInference(): MaskProcessingService
$this->orthancService->sendDicomToProcessing($this->ptOrthancSeriesId, $this->gaelOProcessingService);
$this->addCreatedRessource('dicoms', $this->ptOrthancSeriesId);
$this->orthancService->sendDicomToProcessing($this->ctOrthancSeriesId, $this->gaelOProcessingService);
$this->addCreatedRessource('dicoms', $this->ptOrthancSeriesId);
$this->addCreatedRessource('dicoms', $this->ctOrthancSeriesId);

$idPT = $this->gaelOProcessingService->createSeriesFromOrthanc($this->ptOrthancSeriesId, true, true);
$this->addCreatedRessource('series', $idPT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ public function getPatientId()
return $this->visitContext['patient_id'];
}


public function getPatientCode()
{
return $this->visitContext['patient']['code'];
}

public function getVisitName(): string
{
return $this->visitContext['visit_type']['name'];
}

/**
* Must return the review status for each action on review (send, delete, unlock),
* needs to handle backward and forward
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
class ExpectedPatient
{
public string $code;
public int $centerCode;
public ?int $centerCode;
public ?string $inclusionStatus;

public function __construct(string $code, int $centerCode = null, ?string $inclusionStatus = null)
public function __construct(string $code, ?int $centerCode = null, ?string $inclusionStatus = null)
{
$this->code = $code;
$this->centerCode = $centerCode;
Expand Down
10 changes: 8 additions & 2 deletions GaelO2/app/GaelO/Services/MailServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public function sendUnlockedFormMessage(int $visitId, bool $investigatorForm, in
$mailListBuilder = new MailListBuilder($this->userRepositoryInterface);

$parameters = [
'name' => $this->getUserName($requestingUserId),
'supervisorName' => $this->getUserName($requestingUserId),
'study' => $studyName,
'patientId' => $patientId,
'patientCode' => $patientCode,
Expand Down Expand Up @@ -624,7 +624,7 @@ public function sendRadiomicsReport(string $studyName, string $patientCode, stri
}


public function sendJobFailure(string $jobType, array $details, string $errorMessage)
public function sendJobFailure(string $jobType, array $details, string $errorMessage, ?string $studyName = null, ?int $toUserId = null)
{
$parameters = [
'jobType' => $jobType,
Expand All @@ -634,6 +634,12 @@ public function sendJobFailure(string $jobType, array $details, string $errorMes

$mailListBuilder = new MailListBuilder($this->userRepositoryInterface, $this->studyRepositoryInterface);
$mailListBuilder->withAdminsEmails();
if ($studyName) {
$mailListBuilder->withUsersEmailsByRolesInStudy($studyName, Constants::ROLE_SUPERVISOR);
}
if ($toUserId) {
$mailListBuilder->withUserEmail($toUserId);
}
$this->mailInterface->setTo($mailListBuilder->get());
$this->mailInterface->setParameters($parameters);
$this->mailInterface->setBody(MailConstants::EMAIL_JOB_FAILURE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function execute(GetStudyReviewProgressionRequest $getStudyReviewProgress
$visits = $this->visitRepositoryInterface->getVisitsInStudy($originalStudyName, true, false, false, $studyName);

//Get validated review for study
$validatedReview = $this->reviewRepositoryInterface->getStudyReviewsGroupedByUserIds($originalStudyName);
$validatedReview = $this->reviewRepositoryInterface->getStudyReviewsGroupedByUserIds($studyName);

$answer = [];

Expand All @@ -74,18 +74,19 @@ public function execute(GetStudyReviewProgressionRequest $getStudyReviewProgress
//Listing users having done a review of this visit
if (key_exists($visitId, $validatedReview)) {
$userIdHavingReviewed = array_keys($validatedReview[$visitId]);
} else {
$userIdHavingReviewed = [];
}
else $userIdHavingReviewed = [];

//Listing users not having done review of this visit
$userIdNotHavingReviewed = array_diff(array_keys($reviewersById), $userIdHavingReviewed);

$userDetailsHavingReviewed = [];
//Get reviewer details having reviewed from db answer (user may have been removed so won't be in the list of current reviewer in the study)
foreach($userIdHavingReviewed as $reviewerId){
foreach ($userIdHavingReviewed as $reviewerId) {
$userDetailsHavingReviewed[] = $validatedReview[(string) $visitId][(string) $reviewerId][0]['user'];
}

$answer[] = [
'visitId' => $visitId,
'patientId' => $visit['patient_id'],
Expand Down
2 changes: 1 addition & 1 deletion GaelO2/app/GaelO/views/mails/mail_unlocked_form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
Your {{$formType}} form sent for study : {{$study}}<br>
Patient Code : {{$patientCode}}<br>
Visit : {{$visitType}}<br>
Has been Unlocked.<br>
Has been unlocked by {{$supervisorName}}.<br>
You can now resend a new version of this form.<br>
@endsection
15 changes: 9 additions & 6 deletions GaelO2/app/Models/Center.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ class Center extends Model
protected $primaryKey = 'code';
public $incrementing = false;

protected $casts = [
'code' => 'integer',
'name' => 'string',
'country_code' => 'string'
];

protected function casts(): array
{
return [
'code' => 'integer',
'name' => 'string',
'country_code' => 'string'
];
}

public function country()
{
return $this->belongsTo(Country::class, 'country_code', 'code');
Expand Down
11 changes: 7 additions & 4 deletions GaelO2/app/Models/CenterUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ class CenterUser extends Model
{
use HasFactory;

protected $casts = [
'user_id' => 'integer',
'center_code' => 'integer'
];
protected function casts(): array
{
return [
'user_id' => 'integer',
'center_code' => 'integer'
];
}

/**
* The table associated with the model.
Expand Down
14 changes: 8 additions & 6 deletions GaelO2/app/Models/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ class Country extends Model
protected $primaryKey = 'code';
public $incrementing = false;

protected $casts = [
'code' => 'string',
'country_us' => 'string',
'country_fr' => 'string'
];

protected function casts(): array
{
return [
'code' => 'string',
'country_us' => 'string',
'country_fr' => 'string'
];
}
}
45 changes: 24 additions & 21 deletions GaelO2/app/Models/DicomSeries.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,30 @@ class DicomSeries extends Model
protected $keyType = 'string';
public $incrementing = false;

protected $casts = [
'series_uid' => 'string',
'study_instance_uid' => 'string',
'orthanc_id' => 'string',
'acquisition_date' => 'date:Y-m-d',
'acquisition_time' => 'datetime:H:i:s',
'modality' => 'string',
'series_description' => 'string',
'injected_dose' => 'integer',
'radiopharmaceutical' => 'string',
'half_life' => 'integer',
'injected_time' => 'datetime:H:i:s',
'injected_datetime' => 'datetime',
'patient_weight' => 'integer',
'number_of_instances' => 'integer',
'series_number' => 'string',
'disk_size' => 'integer',
'uncompressed_disk_size' => 'integer',
'manufacturer' => 'string',
'model_name' => 'string'
];
protected function casts(): array
{
return [
'series_uid' => 'string',
'study_instance_uid' => 'string',
'orthanc_id' => 'string',
'acquisition_date' => 'date:Y-m-d',
'acquisition_time' => 'datetime:H:i:s',
'modality' => 'string',
'series_description' => 'string',
'injected_dose' => 'integer',
'radiopharmaceutical' => 'string',
'half_life' => 'integer',
'injected_time' => 'datetime:H:i:s',
'injected_datetime' => 'datetime',
'patient_weight' => 'integer',
'number_of_instances' => 'integer',
'series_number' => 'string',
'disk_size' => 'integer',
'uncompressed_disk_size' => 'integer',
'manufacturer' => 'string',
'model_name' => 'string'
];
}

public function dicomStudy()
{
Expand Down
39 changes: 21 additions & 18 deletions GaelO2/app/Models/DicomStudy.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,27 @@ class DicomStudy extends Model
protected $keyType = 'string';
public $incrementing = false;

protected $casts = [
'study_uid' => 'string',
'orthanc_id' => 'string',
'visit_id' => 'integer',
'user_id' => 'integer',
'upload_date' => 'datetime',
'acquisition_date' => 'date:Y-m-d',
'acquisition_time' => 'datetime:H:i:s',
'anon_from_orthanc_id' => 'string',
'study_description' => 'string',
'patient_orthanc_id' => 'string',
'patient_name' => 'string',
'patient_id' => 'string',
'number_of_series' => 'integer',
'number_of_instances' => 'integer',
'disk_size' => 'integer',
'uncompressed_disk_size' => 'integer'
];
protected function casts(): array
{
return [
'study_uid' => 'string',
'orthanc_id' => 'string',
'visit_id' => 'integer',
'user_id' => 'integer',
'upload_date' => 'datetime',
'acquisition_date' => 'date:Y-m-d',
'acquisition_time' => 'datetime:H:i:s',
'anon_from_orthanc_id' => 'string',
'study_description' => 'string',
'patient_orthanc_id' => 'string',
'patient_name' => 'string',
'patient_id' => 'string',
'number_of_series' => 'integer',
'number_of_instances' => 'integer',
'disk_size' => 'integer',
'uncompressed_disk_size' => 'integer'
];
}

public function dicomSeries()
{
Expand Down
27 changes: 15 additions & 12 deletions GaelO2/app/Models/Documentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ class Documentation extends Model
{
use SoftDeletes, HasFactory;

protected $casts = [
'id' => 'integer',
'name' => 'string',
'document_date' => 'datetime',
'study_name' => 'string',
'version' => 'string',
'investigator' => 'boolean',
'controller' => 'boolean',
'monitor' => 'boolean',
'reviewer' => 'boolean',
'path' => 'string'
];
protected function casts(): array
{
return [
'id' => 'integer',
'name' => 'string',
'document_date' => 'datetime',
'study_name' => 'string',
'version' => 'string',
'investigator' => 'boolean',
'controller' => 'boolean',
'monitor' => 'boolean',
'reviewer' => 'boolean',
'path' => 'string'
];
}

public function study()
{
Expand Down
Loading

0 comments on commit 27802af

Please sign in to comment.