Skip to content

Commit

Permalink
Remove old getDataDictionary definitions to appease Xavier
Browse files Browse the repository at this point in the history
  • Loading branch information
driusan committed Dec 20, 2022
1 parent fc70858 commit d797ba2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 183 deletions.
113 changes: 0 additions & 113 deletions modules/candidate_parameters/php/module.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -188,117 +188,4 @@ class Module extends \Module
}
return $entries;
}

/**
* Return a data dictionary of data types managed by this module.
* DictionaryItems are grouped into categories and a module may
* provide 0 or more categories of dictionaryitems.
*
* @param \LORIS\LorisInstance $loris The LORIS instance whose data
* dictionary should be retrieved.
*
* @return \LORIS\Data\Dictionary\Category[]
*/
public function getDataDictionary(\LORIS\LorisInstance $loris) : iterable
{
$candscope = new Scope(Scope::CANDIDATE);
$sesscope = new Scope(Scope::SESSION);

$ids = new \LORIS\Data\Dictionary\Category(
"Identifiers",
"Candidate Identifiers"
);

$ids = $ids->withItems(
[
new DictionaryItem(
"CandID",
"LORIS Candidate Identifier",
$candscope,
new \LORIS\Data\Types\IntegerType(999999),
new Cardinality(Cardinality::UNIQUE),
),
new DictionaryItem(
"PSCID",
"Project Candidate Identifier",
$candscope,
new \LORIS\Data\Types\StringType(255),
// PSCIDs aren't unique because scanners candidates
// share the same PSCID, but each candidate has
// a single PSCID..
new Cardinality(Cardinality::SINGLE),
),
]
);

$demographics = new \LORIS\Data\Dictionary\Category(
"Demographics",
"Candidate Demographics"
);
$demographics = $demographics->withItems(
[
new DictionaryItem(
"DoB",
"Date of Birth",
$candscope,
new \LORIS\Data\Types\DateType(),
new Cardinality(Cardinality::SINGLE),
),
new DictionaryItem(
"DoD",
"Date of Death",
$candscope,
new \LORIS\Data\Types\DateType(),
new Cardinality(Cardinality::OPTIONAL),
),
new DictionaryItem(
"Sex",
"Candidate's biological sex",
$candscope,
new \LORIS\Data\Types\Enumeration('Male', 'Female', 'Other'),
new Cardinality(Cardinality::SINGLE),
),
]
);

$meta = new \LORIS\Data\Dictionary\Category("Meta", "Other parameters");
$meta = $meta->withItems(
[
new DictionaryItem(
"VisitLabel",
"The study visit label",
$sesscope,
new \LORIS\Data\Types\StringType(255),
new Cardinality(Cardinality::UNIQUE),
),
new DictionaryItem(
"Project",
"The LORIS project to categorize this session",
$sesscope,
new \LORIS\Data\Types\Enumeration(
...array_values(\Utility::getProjectList())
),
new Cardinality(Cardinality::SINGLE),
),
new DictionaryItem(
"Cohort",
"The LORIS cohort used for battery selection",
$sesscope,
new \LORIS\Data\Types\Enumeration(
...array_values(\Utility::getCohortList())
),
new Cardinality(Cardinality::SINGLE),
),
new DictionaryItem(
"Site",
"The Site at which a visit occurred",
$sesscope,
new \LORIS\Data\Types\Enumeration(...\Utility::getSiteList()),
new Cardinality(Cardinality::SINGLE),
),
]
);

return [$ids, $demographics, $meta];
}
}
40 changes: 0 additions & 40 deletions modules/imaging_browser/php/module.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -125,44 +125,4 @@ class Module extends \Module
}
return [];
}

/**
* {@inheritDoc}
*
* @param \LORIS\LorisInstance $loris The Loris instance from which the
* data dictionary for this module
* should be retrieved.
*
* @return \LORIS\Data\Dictionary\Category[]
*/
public function getDataDictionary(\LORIS\LorisInstance $loris) : iterable
{
$scope = new Scope(Scope::SESSION);
$images = new \LORIS\Data\Dictionary\Category(
"Images",
"Image Acquisitions",
);
$items = [];

$scantypes = \Utility::getScanTypeList();
foreach ($scantypes as $ScanType) {
$items[] = new DictionaryItem(
$ScanType,
"$ScanType acquisition location",
$scope,
new \LORIS\Data\Types\URI(),
new Cardinality(Cardinality::MANY),
);
$items[] = new DictionaryItem(
$ScanType . "_QCStatus",
"Quality Control status for $ScanType acquisition",
$scope,
new \LORIS\Data\Types\Enumeration("Pass", "Fail"),
new Cardinality(Cardinality::MANY),
);
}
$images = $images->withItems($items);

return [$images];
}
}
30 changes: 0 additions & 30 deletions modules/instruments/php/module.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -150,35 +150,5 @@ class Module extends \Module
}
return [];
}

/**
* Return the data dictionary for all instruments installed on a LORIS
* instance.
*
* @param \LORIS\LorisInstance $loris The loris instance whose dictionary
* should be retrieved
*
* @return \LORIS\Data\Dictionary\Category[]
*/
public function getDataDictionary(\LORIS\LorisInstance $loris) : iterable
{
$tests = array_keys(\Utility::getAllInstruments());

$dict = [];
foreach ($tests as $testname) {
try {
$inst = \NDB_BVL_Instrument::factory($loris, $testname, "", "");
$cat = new \LORIS\Data\Dictionary\Category(
$testname,
$inst->getFullName()
);
$fields = $inst->getDataDictionary();
$dict[] = $cat->withItems($fields);
} catch (\LorisException $e) {
error_log($e);
}
}
return $dict;
}
}

0 comments on commit d797ba2

Please sign in to comment.