Skip to content

Commit

Permalink
[Tools] CouchDB tools fix and PHP warning removal (aces#9427)
Browse files Browse the repository at this point in the history
- Updated CouchDB import tools to remove some PHP warnings
- Updated CouchDB instrument import tool to actually work after flag
  • Loading branch information
skarya22 authored Oct 29, 2024
1 parent 1ea7737 commit 43108f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions tools/CouchDB_Import_Instruments.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ function generateDocumentSQL(string $tablename) : string
$from = "FROM flag f
JOIN session s ON(s.ID=f.SessionID)
JOIN candidate c ON(c.CandID=s.CandID)
LEFT JOIN flag ddef ON(ddef.CommentID=CONCAT('DDE_', f.CommentID))";
LEFT JOIN flag ddef ON(ddef.CommentID=CONCAT('DDE_', f.CommentID))
LEFT JOIN test_names tn ON(f.TestID = tn.ID)";

$where = "WHERE f.CommentID NOT LIKE 'DDE%'
AND f.Test_name=:inst AND s.Active='Y' AND c.Active='Y'";
AND tn.Test_name=:inst AND s.Active='Y' AND c.Active='Y'";

if ($tablename === "") {
// the data is in the flag table, add the data column to the query
Expand Down Expand Up @@ -212,7 +213,7 @@ function updateCandidateDocs($Instruments)
if ($JSONData) {
//Transform JSON object into an array and add treat it the
//same as SQL
$instrumentData = json_decode($row['Data'], true) ?? [];
$instrumentData = json_decode($row['Data'] ?? '', true) ?? [];
unset($row['Data']);
$docdata = $row + $instrumentData;
} else {
Expand Down
4 changes: 2 additions & 2 deletions tools/importers/CouchDB_MRI_Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ function _addMRIHeaderInfo($FileObj, $scan_type)
2
);
$header['SliceThickness_'.$type] = number_format(
$FileObj->getParameter('slice_thickness'),
$FileObj->getParameter('slice_thickness') ?? 0,
2
);
$header['Time_'.$type] = number_format(
$FileObj->getParameter('time'),
$FileObj->getParameter('time') ?? 0,
2
);
$header['Comment_'.$type] = $FileObj->getParameter('Comment');
Expand Down

0 comments on commit 43108f9

Please sign in to comment.