Exemple #1
0
* Data Dictionary construction
* This relies on the quickform_parser and data_dictionary_builder having being recently run
*/
$Test_name = "DataDictionary";
$query = "select Name, Type, Description, SourceField, SourceFrom from parameter_type where SourceField is not null order by SourceFrom";
$DB->select($query, $dictionary);
if (PEAR::isError($dictionary)) {
    PEAR::raiseError("Could not generate data dictionary. " . $dictionary->getMessage());
}
writeExcel($Test_name, $dictionary, $dataDir);
//MRI data construction
//Using CouchDBMRIImporter since same data is imported to DQT.
$Test_name = "MRI_Data";
$mriData = new CouchDBMRIImporter();
$scanTypes = $mriData->getScanTypes();
$candidateData = $mriData->getCandidateData($scanTypes);
$mriDataDictionary = $mriData->getDataDictionary($scanTypes);
//add all dictionary names as excel column headings
foreach ($mriDataDictionary as $dicKey => $dicVal) {
    //if column not already present
    if (!array_key_exists($dicKey, $candidateData[0])) {
        $candidateData[0][$dicKey] = NULL;
    }
}
writeExcel($Test_name, $candidateData, $dataDir);
// Clean up
// tar and gzip the product
$tarFile = $dumpName . ".tgz";
// produced dump file name and extension
$tar = new Archive_Tar($tarFile, "gz");
$tar->add("./{$dumpName}/") or die("Could not add files!");