diff --git a/SQL/0000-00-00-schema.sql b/SQL/0000-00-00-schema.sql index 1d5a27d74b2..7221e86c8d3 100644 --- a/SQL/0000-00-00-schema.sql +++ b/SQL/0000-00-00-schema.sql @@ -289,6 +289,14 @@ CREATE TABLE `instrument_data` ( PRIMARY KEY (`ID`) ); +CREATE TABLE `instrument_data_files` ( + `ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `DataID` INT(10) UNSIGNED DEFAULT NULL, + `FilePath` VARCHAR(255) NOT NULL, + CONSTRAINT `FK_flag_instrument_data_files` FOREIGN KEY (`DataID`) REFERENCES `instrument_data` (`ID`), + PRIMARY KEY (`ID`) +); + CREATE TABLE `flag` ( `ID` int(10) unsigned NOT NULL auto_increment, `SessionID` int(10) unsigned NOT NULL, @@ -1462,7 +1470,7 @@ INSERT INTO StatisticsTabs (ModuleName, SubModuleName, Description, OrderNo) VAL CREATE TABLE `server_processes` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `pid` int(11) unsigned NOT NULL, - `type` enum('mri_upload') NOT NULL, + `type` enum('mri_upload','parse_instrument_data') NOT NULL, `stdout_file` varchar(255) DEFAULT NULL, `stderr_file` varchar(255) DEFAULT NULL, `exit_code_file` varchar(255) DEFAULT NULL, diff --git a/modules/instrument_manager/README.md b/modules/instrument_manager/README.md index 1a4c8b284dd..416e37c841f 100644 --- a/modules/instrument_manager/README.md +++ b/modules/instrument_manager/README.md @@ -7,13 +7,17 @@ metadata for a LORIS instance as well as provide a centralized place to install instruments created from the instrument builder without backend access. +Instrument data can be uploaded from a csv file. A template with the +expected headers can be downloaded. + It provides overview of the "health" of the various MySQL instrument -tables and whether or not they are in sync with the instrument as it +tables and whether they are in sync with the instrument as it exists on the filesystem or not. However, the checks are only possible for LINST (instrument builder) instruments, as the appropriate state of database tables can not easily be statically determined for PHP instruments. + ## Intended Users The instrument manager is intended to be used by study or LORIS diff --git a/modules/instrument_manager/help/instrument_manager.md b/modules/instrument_manager/help/instrument_manager.md index f31f1ab2833..59db18d03cc 100644 --- a/modules/instrument_manager/help/instrument_manager.md +++ b/modules/instrument_manager/help/instrument_manager.md @@ -14,10 +14,14 @@ In the **Browse** tab, use the *Selection Filter* section to search for an instr *Table Valid*: displays whether the SQL database is properly configured with respect to the instrument installed in the LORIS `project/instruments` directory. -*Pages Valid* displays whether the `instrument_subtests` table in LORIS is properly populated for this instrument +*Pages Valid*: displays whether the `instrument_subtests` table in LORIS is properly populated for this instrument **Note**: the *Table Valid* and *Pages Valid* columns can only be determined for LINST instruments (generated by the Instrument Builder, see *Instrument Type* column), since this can't be determined for PHP instruments. +*Permission Required*: view and manage permissions required to access the instrument + +*Upload*: display dialog to upload instrument data from a csv file + ## Upload New Instrument If your LORIS is configured for it, the **Upload** tab will display an *Upload Instrument* section. Click **Browse** to select a LINST file from your computer. Click **Install Instrument** to install the instrument into LORIS. diff --git a/modules/instrument_manager/test/TestPlan.md b/modules/instrument_manager/test/TestPlan.md index 91d7a0599ca..7d4af4169f7 100644 --- a/modules/instrument_manager/test/TestPlan.md +++ b/modules/instrument_manager/test/TestPlan.md @@ -22,4 +22,9 @@ eg "Table Valid" column is valid when instrument fields match up and "Pages Vali [Manual Testing] 9. With a user who has the `instrument_manager_write` permission, click the button in the `Permission Required` column. A modal should popup where you can edit the permissions. - Check that modifying the permissions saves the new permissions. - - Check that a user can access that instruments if and only if they has that permission. + - Check that a user can access that instruments if and only if they have that permission. +10. Test uploading csv data as a user who has the `instrument_manager_write` permission: + - Pick an instrument and press "Download expected template" + - Attempt to successfully upload a csv file, ideally with one or more data rows + - Attempt to make uploading fail (ex: uploading to the wrong instrument or omitting headers) + - Upload a csv file larger than `MAX_FILE_BYTES` (in `instrument_data.class.inc`) and ensure that the data is uploaded as a background task. Manually run the `tools/monitor_instrument_data.php` script and view the status change in `server_process_manager` module. diff --git a/raisinbread/RB_files/RB_Config.sql b/raisinbread/RB_files/RB_Config.sql index 7a91dd3186f..c70498b91d5 100644 --- a/raisinbread/RB_files/RB_Config.sql +++ b/raisinbread/RB_files/RB_Config.sql @@ -107,6 +107,8 @@ INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (126,129,'365'); INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (127,130,'/var/www/loris/'); INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (128,131,'/data/EEGUploadIncomingPath/'); INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (129,132,'false'); +INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (130,133,'/data/uploads/instruments/'); +INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (131,134,'/data/tmp/'); UNLOCK TABLES; SET FOREIGN_KEY_CHECKS=1; diff --git a/raisinbread/RB_files/RB_ConfigSettings.sql b/raisinbread/RB_files/RB_ConfigSettings.sql index 6e5137f91f3..fe292aeb74f 100644 --- a/raisinbread/RB_files/RB_ConfigSettings.sql +++ b/raisinbread/RB_files/RB_ConfigSettings.sql @@ -112,7 +112,7 @@ INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMult INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (122,'AWS_S3_Endpoint','Endpoint to use for accessing files stored in S3. Endpoint or region are required for S3 support.',1,0,'text',121,'AWS S3 Endpoint',3); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (123,'AWS_S3_Region','AWS Region to use for accessing files stored in S3. Endpoint or region are required for S3 support.',1,0,'text',121,'AWS S3 Region',3); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (124,'AWS_S3_Default_Bucket','Default bucket for LORIS to use for accessing files in S3.',1,0,'text',121,'AWS S3 Default Bucket',3); -INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES +INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (125,'useEEGBrowserVisualizationComponents','Whether to enable the visualization components on the EEG Browser module',1,0,'boolean',39,'Enable the EEG Browser components',4); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (126,'createVisit','Enable visit creation in the imaging pipeline',1,0,'boolean',69,'Enable visit creation',11); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (127,'default_project','Default project used when creating scan candidate or visit',1,0,'text',69,'Default project',12); @@ -121,5 +121,7 @@ INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMult INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (130,'DownloadPath','Where files are downloaded',1,0,'text',26,'Downloads',4); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (131,'EEGUploadIncomingPath', 'Path to the upload directory for incoming EEG studies', 1, 0, 'text', 26, 'EEG Incoming Directory', 15); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (132,'useDoB','Use DoB (Date of Birth)',1,0,'boolean',1,'Use DoB',12); +INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (133,'instrumentDataPath','Path to directory for uploaded instrument data csv files',1,0,'text',26,'Instrument Data Upload Path',16); +INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (134,'tempPath','Path for temporary files',1,0,'text',26,'Temp File Path',17); UNLOCK TABLES; SET FOREIGN_KEY_CHECKS=1;