Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update API summary header and qc too grep more info #4077

Merged
14 changes: 7 additions & 7 deletions htdocs/api/v0.0.2/candidates/visits/images/qc/QC.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public function handleGET()
$factory = \NDB_Factory::singleton();
$DB = $factory->Database();
$QCStatus = $DB->pselectRow(
"SELECT QCStatus,
pf.Value as Selected FROM files f
LEFT JOIN files_qcstatus fqc ON (f.FileID=fqc.FileID)
LEFT JOIN parameter_file pf ON (f.FileID=pf.FileID)
LEFT JOIN parameter_type pt
ON (pf.ParameterTypeID=pt.ParameterTypeID AND pt.Name='Selected')
WHERE f.File LIKE CONCAT('%', :FName)",
"SELECT QCStatus, Selected
FROM files_qcstatus
WHERE FileID in (
SELECT FileID
FROM files
WHERE File LIKE CONCAT('%', :FName)
)",
array('FName' => $this->Filename)
);
$this->JSON = [
Expand Down
47 changes: 30 additions & 17 deletions htdocs/api/v0.0.3-dev/candidates/visits/images/headers/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,29 @@ public function handleGET()
$SeriesName = $this->getHeader("acquisition:protocol");
$SeriesDescription = $this->getHeader("acquisition:series_description");

$XSpace = [
"Length" => $this->getHeader("xspace:length"),
"StepSize" => $this->getHeader("xspace:step"),
];
$YSpace = [
"Length" => $this->getHeader("yspace:length"),
"StepSize" => $this->getHeader("yspace:step"),
];
$ZSpace = [
"Length" => $this->getHeader("zspace:length"),
"StepSize" => $this->getHeader("zspace:step"),
];
$TimeD = [
"Length" => $this->getHeader("time:length"),
"StepSize" => $this->getHeader("time:step"),
];
$XSpace = [
"Length" => $this->getHeader("xspace:length"),
"StepSize" => $this->getHeader("xspace:step"),
];
$YSpace = [
"Length" => $this->getHeader("yspace:length"),
"StepSize" => $this->getHeader("yspace:step"),
];
$ZSpace = [
"Length" => $this->getHeader("zspace:length"),
"StepSize" => $this->getHeader("zspace:step"),
];
$TimeD = [
"Length" => $this->getHeader("time:length"),
"StepSize" => $this->getHeader("time:step"),
];
cmadjar marked this conversation as resolved.
Show resolved Hide resolved

$manufacturer = $this->getHeader("study:manufacturer");
$model = $this->getHeader("study:device_model");
$softwareVersion = $this->getHeader("study:software_version");
$serialNumber = $this->getHeader("study:serial_no");
$fieldStrength = $this->getHeader("study:field_value");

$this->JSON = [
'Meta' => [
'CandID' => $this->CandID,
Expand All @@ -108,7 +115,13 @@ public function handleGET()
"ZSpace" => $ZSpace,
"TimeDimension" => $TimeD,
],

'ScannerInfo' => [
"Manufacturer" => $manufacturer,
"Model" => $model,
"SoftwareVersion" => $softwareVersion,
"SerialNumber" => $serialNumber,
"FieldStrength" => $fieldStrength,
],
];
}

Expand Down
35 changes: 28 additions & 7 deletions htdocs/api/v0.0.3-dev/candidates/visits/images/qc/QC.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ public function handleGET()
$factory = \NDB_Factory::singleton();
$DB = $factory->Database();
$QCStatus = $DB->pselectRow(
"SELECT QCStatus,
pf.Value as Selected FROM files f
LEFT JOIN files_qcstatus fqc ON (f.FileID=fqc.FileID)
LEFT JOIN parameter_file pf ON (f.FileID=pf.FileID)
LEFT JOIN parameter_type pt
ON (pf.ParameterTypeID=pt.ParameterTypeID AND pt.Name='Selected')
WHERE f.File LIKE CONCAT('%', :FName)",
"SELECT QCStatus, Selected
FROM files_qcstatus
WHERE FileID in (
SELECT FileID
FROM files
WHERE File LIKE CONCAT('%', :FName)
)",
array('FName' => $this->Filename)
);
$caveats = $this->getImageCaveats();
$this->JSON = [
'Meta' => [
'CandID' => $this->CandID,
Expand All @@ -81,9 +82,29 @@ public function handleGET()
],
'QC' => $QCStatus['QCStatus'],
'Selected' => $QCStatus['Selected'],
'Caveats' => $caveats,
];
}

/**
* Gets the list of Caveats for the file.
*
* @return an array with list of caveats for the file
cmadjar marked this conversation as resolved.
Show resolved Hide resolved
*/
function getImageCaveats()
cmadjar marked this conversation as resolved.
Show resolved Hide resolved
{
$factory = \NDB_Factory::singleton();
$DB = $factory->Database();
$rows = $DB->pselect(
"SELECT Severity, Header, Value, ValidRange, ValidRegex
FROM files f
LEFT JOIN mri_violations_log mvl ON (f.SeriesUID=mvl.SeriesUID)
WHERE f.File LIKE CONCAT('%', :FName)",
array('FName' => $this->Filename)
);
return $rows;
}

/**
* Calculates the ETag for the current QC status
*
Expand Down