View source: R/populateDBFunctions.R
dbImportOneStudy | R Documentation |
Check each of the SAS xpt file located in the specified folder - import content from file and load it into the corresponding SEND domain table in the open database.
dbImportOneStudy(dbToken, xptPath, overWrite = FALSE, checkRequiredVars = TRUE)
dbToken |
Mandatory |
xptPath |
Mandatory, character |
overWrite |
Mandatory, boolean |
checkRequiredVars |
Mandatory, boolean |
These requirements to the content of the folder must be fulfilled:
The folder must contain some SAS xport files named
[send domain].xpt
- the case of the file names doesn't care
A minimum set of required domain files must be included:
ts.xpt
, tx.xpt
, dm.xpt
.
Each xpt file must contain one data table with same name as the file name - i.e. a send domain name.
Each xpt file must contain a non-empty STUDYID value in each row equal to the value of TS.STUDYID.
Each xpt file must contain a set of required column(s).
In general it's (where relevant for the different kinds of domains):
STUDYID, DOMAIN, --SEQ, USUBJID, --TESTCD, --TEST,--ORRES, --ORRESU,
--STRESC, --STRESN, --STRESU
The DOMAIN variable must contain the name of the actual domain in all rows
The last two requirements are checked for the required domains in all cases.
For other domains, these two requirements are only checked if parameter
checkRequiredVars = TRUE
.
If an error is detected, the import and load of data is canceled, and further
execution is aborted (i.e. error message is written to the console).
These error situations are checked and reported:
Any of the requirements 1 to 3 are not fulfilled or any of the following requirements are not fulfilled for one of the required domains
A study with the same value if STUDYID exists in the database and
parameter overWrite = FALSE
.
If one of the requirements 4 to 6 are not fulfilled for a not-required
domain, this domain is excluded from the import. These kinds of issues are
reported as one warning message to the console when data has been loaded.
Some non-critical issues, which doesn't prohibit data to be loaded to the
database may be detected. These are reported as one warning message to the
console when data has been loaded (together with eventual warning messages
for skipped domains).
These non-critical issues are checked and reported:
The study folder contains one or more xpt file(s) with names(s) not
matching SEND domain name(s).
Such files are ignored by the import/load process.
An imported data tables contains one or more column(s) which do(es)n't exist(s) in the corresponding domain.
The database must be an SQLite database - no other types of databases are supported by this function.
No return value, called for side effects
## Not run: # Do not overwrite if study already exists in the database dbImportOneStudy(myDbToken,'/mydatapath/studies/1213443') # Allow to overwrite data if study already exists in the database dbImportOneStudy(myDbToken,'/mydatapath/studies/786756', overwrite = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.