Skip to content

Commit

Permalink
Merge branch 'GaelO2-dev' into exploring-import-error
Browse files Browse the repository at this point in the history
  • Loading branch information
salimkanoun committed Jun 11, 2023
2 parents 6ebdd8f + 3fb250c commit be1f5e5
Show file tree
Hide file tree
Showing 11 changed files with 3,052 additions and 29,859 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'sonarcloud'

on:
push:
branches:
- '*'

jobs:

tests:
name: 'Tests Gaelo'
runs-on: ubuntu-latest
steps:
- name: 'Build checkout'
uses: actions/checkout@v3

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6 changes: 0 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,3 @@ jobs:
- name: Fix code coverage paths
working-directory: ./GaelO2
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
34 changes: 7 additions & 27 deletions GaelO2/app/GaelO/UseCases/GetPossibleUpload/GetPossibleUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace App\GaelO\UseCases\GetPossibleUpload;

use App\GaelO\Constants\Constants;
use App\GaelO\Entities\PatientEntity;
use App\GaelO\Entities\VisitEntity;
use App\GaelO\Exceptions\AbstractGaelOException;
use App\GaelO\Exceptions\GaelOForbiddenException;
use App\GaelO\Interfaces\Repositories\UserRepositoryInterface;
Expand Down Expand Up @@ -36,20 +38,11 @@ public function execute(GetPossibleUploadRequest $getPossibleUploadRequest, GetP
$answerArray = [];

foreach ($visitsEntities as $visit) {
$item['patientId'] = $visit['patient_id'];
$item['patientCode'] = $visit['patient']['code'];
$item['patientFirstname'] = $visit['patient']['firstname'];
$item['patientLastname'] = $visit['patient']['lastname'];
$item['patientSex'] = $visit['patient']['gender'];
$item['patientDOB'] = $this->formatBirthDateUS($visit['patient']['birth_month'], $visit['patient']['birth_day'], $visit['patient']['birth_year']);
$item['visitDate'] = date('m-d-Y', strtotime($visit['visit_date']));
$item['visitModality'] = $visit['visit_type']['visit_group']['modality'];
$item['visitType'] = $visit['visit_type']['name'];
$item['visitTypeOrder'] = $visit['visit_type']['order'];
$item['visitTypeID'] = $visit['visit_type']['id'];
$item['visitID'] = $visit['id'];
$item['dicomConstraints'] = $visit['visit_type']['dicom_constraints'];
$answerArray[] = $item;
$visitEntity = VisitEntity::fillFromDBReponseArray($visit);
$visitEntity->setVisitContext($visit['visit_type']['visit_group'], $visit['visit_type']);
$patientEntity = PatientEntity::fillFromDBReponseArray($visit['patient']);
$visitEntity->setPatientEntity($patientEntity);
$answerArray[] = $visitEntity;
}

$getPossibleUploadResponse->body = $answerArray;
Expand All @@ -75,18 +68,5 @@ private function checkAuthorization(int $userId, string $studyName): void
}
}

private function formatBirthDateUS(?int $month, ?int $day, ?int $year): string
{
if (empty($month)) {
$month = 0;
}
if (empty($day)) {
$day = 0;
}
if (empty($year)) {
$year = 0;
}

return sprintf("%02d", $month) . '-' . sprintf("%02d", $day) . '-' . $year;
}
}
5 changes: 4 additions & 1 deletion GaelO2/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"php-http/discovery": true
}
},
"extra": {
"laravel": {
Expand Down
Loading

0 comments on commit be1f5e5

Please sign in to comment.