@ -171,6 +171,7 @@ pre code {
< ul >
< ul >
< li > < a href = "#sqldroplast" > sqlDropLast< / a > < / li >
< li > < a href = "#sqldroplast" > sqlDropLast< / a > < / li >
< li > < a href = "#sqlinitizalize" > sqlInitizalize< / a > < / li >
< li > < a href = "#sqlinitizalize" > sqlInitizalize< / a > < / li >
< li > < a href = "#sqlbackup" > sqlBackUp< / a > < / li >
< li > < a href = "#sqlshowsamples" > sqlShowSamples< / a > < / li >
< li > < a href = "#sqlshowsamples" > sqlShowSamples< / a > < / li >
< li > < a href = "#sqlgenovid" > sqlGenOVID< / a > < / li >
< li > < a href = "#sqlgenovid" > sqlGenOVID< / a > < / li >
< li > < a href = "#sqlwritetemp" > sqlWriteTemp< / a > < / li >
< li > < a href = "#sqlwritetemp" > sqlWriteTemp< / a > < / li >
@ -289,17 +290,76 @@ sqlDropLast(dta, "TableTest")
< hr / >
< hr / >
< / div >
< / div >
< / div >
< / div >
< div id = "sqlbackup" class = "section level2" >
< h2 > sqlBackUp< / h2 >
< div id = "description-2" class = "section level3" >
< h3 > Description< / h3 >
< p > Creates a Back Up copy of the database.< / p >
< / div >
< div id = "usage-2" class = "section level3" >
< h3 > Usage< / h3 >
< p > sqlBackUp(dbfile=file,bu.dir=“BU_OVARIO”)< / p >
< / div >
< div id = "arguments-2" class = "section level3" >
< h3 > Arguments< / h3 >
< table >
< thead >
< tr class = "header" >
< th > Argument< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody >
< tr class = "odd" >
< td > dbfile< / td >
< td > Database File location.< / td >
< / tr >
< tr class = "even" >
< td > bu.dir< / td >
< td > Directory under the DB file where the back up will be placed.< / td >
< / tr >
< / tbody >
< / table >
< / div >
< div id = "details-2" class = "section level3" >
< h3 > Details< / h3 >
< p > Creates a Back Up copy of the database. It adds the date in front of the back up file.< / p >
< / div >
< div id = "value-2" class = "section level3" >
< h3 > Value< / h3 >
< p > Invisibly for success (and failures cause errors).< / p >
< / div >
< div id = "examples-2" class = "section level3" >
< h3 > Examples< / h3 >
< pre class = "r" > < code > sqlInitialize()
sqlBackUp()< / code > < / pre >
< / div >
< div id = "function-2" class = "section level3" >
< h3 > Function< / h3 >
< pre class = "r" > < code > sqlBackUp< -function(dbfile=file,bu.dir=" BU_OVARIO" ){
db=strsplit(dbfile, " /" )[[1]]%> % tail(n=1)
bu_path< -gsub(db,bu.dir,dbfile)
if (!dir.exists(bu_path)){
dir.create(bu_path)
print(paste0(" Back Up directory " , bu_path, " created" ))
}
cp_bu< -paste0(bu_path, " /" , format(Sys.time(), format=" %Y%m%d" )," -" ,db)
file.copy(dbfile, cp_bu)
}< / code > < / pre >
< hr / >
< / div >
< / div >
< div id = "sqlshowsamples" class = "section level2" >
< div id = "sqlshowsamples" class = "section level2" >
< h2 > sqlShowSamples< / h2 >
< h2 > sqlShowSamples< / h2 >
< div id = "description-2" class = "section level3" >
< div id = "description-3 " class = "section level3" >
< h3 > Description< / h3 >
< h3 > Description< / h3 >
< p > Shows if there are already samples from the specified NHCs.< / p >
< p > Shows if there are already samples from the specified NHCs.< / p >
< / div >
< / div >
< div id = "usage-2" class = "section level3" >
< div id = "usage-3 " class = "section level3" >
< h3 > Usage< / h3 >
< h3 > Usage< / h3 >
< p > sqlShowSamples(conn=dta, nhcs=nhc.test, verb=F)< / p >
< p > sqlShowSamples(conn=dta, nhcs=nhc.test, verb=F)< / p >
< / div >
< / div >
< div id = "arguments-2" class = "section level3" >
< div id = "arguments-3 " class = "section level3" >
< h3 > Arguments< / h3 >
< h3 > Arguments< / h3 >
< table >
< table >
< thead >
< thead >
@ -324,21 +384,21 @@ sqlDropLast(dta, "TableTest")
< / tbody >
< / tbody >
< / table >
< / table >
< / div >
< / div >
< div id = "details-2 " class = "section level3" >
< div id = "details-3 " class = "section level3" >
< h3 > Details< / h3 >
< h3 > Details< / h3 >
< p > Takes the NHCs listed in the nhcs vector and checks if there are already samples from those patients.< / p >
< p > Takes the NHCs listed in the nhcs vector and checks if there are already samples from those patients.< / p >
< / div >
< / div >
< div id = "value-2 " class = "section level3" >
< div id = "value-3 " class = "section level3" >
< h3 > Value< / h3 >
< h3 > Value< / h3 >
< p > A data.frame with information about the patients.< / p >
< p > A data.frame with information about the patients.< / p >
< / div >
< / div >
< div id = "examples-2 " class = "section level3" >
< div id = "examples-3 " class = "section level3" >
< h3 > Examples< / h3 >
< h3 > Examples< / h3 >
< pre class = "r" > < code > dta< -odbcConnect(" test" )
< pre class = "r" > < code > dta< -odbcConnect(" test" )
nhc.test< -c(" XXXXXXXX" ," XXXXXXX" )
nhc.test< -c(" XXXXXXXX" ," XXXXXXX" )
sqlShowSamples()< / code > < / pre >
sqlShowSamples()< / code > < / pre >
< / div >
< / div >
< div id = "function-2 " class = "section level3" >
< div id = "function-3 " class = "section level3" >
< h3 > Function< / h3 >
< h3 > Function< / h3 >
< pre class = "r" > < code > sqlShowSamples< -function(conn=dta, nhcs=nhc.test, verb=F){
< pre class = "r" > < code > sqlShowSamples< -function(conn=dta, nhcs=nhc.test, verb=F){
if (isFALSE(verb)){
if (isFALSE(verb)){
@ -359,15 +419,15 @@ sqlShowSamples()
< / div >
< / div >
< div id = "sqlgenovid" class = "section level2" >
< div id = "sqlgenovid" class = "section level2" >
< h2 > sqlGenOVID< / h2 >
< h2 > sqlGenOVID< / h2 >
< div id = "description-3 " class = "section level3" >
< div id = "description-4 " class = "section level3" >
< h3 > Description< / h3 >
< h3 > Description< / h3 >
< p > Generates new consecutive OVID code for the patients that are not found in the DB.< / p >
< p > Generates new consecutive OVID code for the patients that are not found in the DB.< / p >
< / div >
< / div >
< div id = "usage-3 " class = "section level3" >
< div id = "usage-4 " class = "section level3" >
< h3 > Usage< / h3 >
< h3 > Usage< / h3 >
< p > sqlGenOVID(conn=dta, nhcs=nhc.test, verb=T, sinc=F)< / p >
< p > sqlGenOVID(conn=dta, nhcs=nhc.test, verb=T, sinc=F)< / p >
< / div >
< / div >
< div id = "arguments-3 " class = "section level3" >
< div id = "arguments-4 " class = "section level3" >
< h3 > Arguments< / h3 >
< h3 > Arguments< / h3 >
< table >
< table >
< colgroup >
< colgroup >
@ -400,21 +460,21 @@ sqlShowSamples()
< / tbody >
< / tbody >
< / table >
< / table >
< / div >
< / div >
< div id = "details-3 " class = "section level3" >
< div id = "details-4 " class = "section level3" >
< h3 > Details< / h3 >
< h3 > Details< / h3 >
< p > Generates new consecutive OVID code for the patients that are not found in the DB.< / p >
< p > Generates new consecutive OVID code for the patients that are not found in the DB.< / p >
< / div >
< / div >
< div id = "value-3 " class = "section level3" >
< div id = "value-4 " class = "section level3" >
< h3 > Value< / h3 >
< h3 > Value< / h3 >
< p > If verb is TRUE, it returns a data.frame.< / p >
< p > If verb is TRUE, it returns a data.frame.< / p >
< / div >
< / div >
< div id = "examples-3 " class = "section level3" >
< div id = "examples-4 " class = "section level3" >
< h3 > Examples< / h3 >
< h3 > Examples< / h3 >
< pre class = "r" > < code > dta< -odbcConnect(" test" )
< pre class = "r" > < code > dta< -odbcConnect(" test" )
nhc.test< -c(" XXXXXXXX" ," XXXXXXX" )
nhc.test< -c(" XXXXXXXX" ," XXXXXXX" )
sqlGenOVID(sinc=T)< / code > < / pre >
sqlGenOVID(sinc=T)< / code > < / pre >
< / div >
< / div >
< div id = "function-3 " class = "section level3" >
< div id = "function-4 " class = "section level3" >
< h3 > Function< / h3 >
< h3 > Function< / h3 >
< pre class = "r" > < code > sqlGenOVID< -function(conn=dta, nhcs=nhc.test, verb=T, sinc=F){
< pre class = "r" > < code > sqlGenOVID< -function(conn=dta, nhcs=nhc.test, verb=T, sinc=F){
ovid< -sqlFetch(conn," OVID" )
ovid< -sqlFetch(conn," OVID" )
@ -440,15 +500,15 @@ sqlGenOVID(sinc=T)
< / div >
< / div >
< div id = "sqlwritetemp" class = "section level2" >
< div id = "sqlwritetemp" class = "section level2" >
< h2 > sqlWriteTemp< / h2 >
< h2 > sqlWriteTemp< / h2 >
< div id = "description-4 " class = "section level3" >
< div id = "description-5 " class = "section level3" >
< h3 > Description< / h3 >
< h3 > Description< / h3 >
< p > Fills the Query Template file with the OVID and OV newly generated codes.< / p >
< p > Fills the Query Template file with the OVID and OV newly generated codes.< / p >
< / div >
< / div >
< div id = "usage-4 " class = "section level3" >
< div id = "usage-5 " class = "section level3" >
< h3 > Usage< / h3 >
< h3 > Usage< / h3 >
< p > sqlWriteTemp(conn=dta, nhcs=nhc.test, file=“queryOV.xlsx”, samples.mod=T, clinics.mod=T)< / p >
< p > sqlWriteTemp(conn=dta, nhcs=nhc.test, file=“queryOV.xlsx”, samples.mod=T, clinics.mod=T)< / p >
< / div >
< / div >
< div id = "arguments-4 " class = "section level3" >
< div id = "arguments-5 " class = "section level3" >
< h3 > Arguments< / h3 >
< h3 > Arguments< / h3 >
< table >
< table >
< thead >
< thead >
@ -481,22 +541,22 @@ sqlGenOVID(sinc=T)
< / tbody >
< / tbody >
< / table >
< / table >
< / div >
< / div >
< div id = "details-4 " class = "section level3" >
< div id = "details-5 " class = "section level3" >
< h3 > Details< / h3 >
< h3 > Details< / h3 >
< p > Fills the Query Template file with the OVID and OV newly generated codes. It is required that the DB has been updated with the sqlGenOVID function. It replaces previous content in the template file sheets that are filled. In the case of “CLINICS” table, if there were already an entry in the DB for that OVID code, the template file is filled with that information.< / p >
< p > Fills the Query Template file with the OVID and OV newly generated codes. It is required that the DB has been updated with the sqlGenOVID function. It replaces previous content in the template file sheets that are filled. In the case of “CLINICS” table, if there were already an entry in the DB for that OVID code, the template file is filled with that information.< / p >
< / div >
< / div >
< div id = "value-4 " class = "section level3" >
< div id = "value-5 " class = "section level3" >
< h3 > Value< / h3 >
< h3 > Value< / h3 >
< p > Invisibly for success (and failures cause errors).< / p >
< p > Invisibly for success (and failures cause errors).< / p >
< / div >
< / div >
< div id = "examples-4 " class = "section level3" >
< div id = "examples-5 " class = "section level3" >
< h3 > Examples< / h3 >
< h3 > Examples< / h3 >
< pre class = "r" > < code > dta< -odbcConnect(" test" )
< pre class = "r" > < code > dta< -odbcConnect(" test" )
nhc.test< -c(" XXXXXXXX" ," XXXXXXX" )
nhc.test< -c(" XXXXXXXX" ," XXXXXXX" )
sqlGenOVID(sinc=T)
sqlGenOVID(sinc=T)
sqlWriteTemp()< / code > < / pre >
sqlWriteTemp()< / code > < / pre >
< / div >
< / div >
< div id = "function-4 " class = "section level3" >
< div id = "function-5 " class = "section level3" >
< h3 > Function< / h3 >
< h3 > Function< / h3 >
< pre class = "r" > < code > sqlWriteTemp< -function(conn=dta, nhcs=nhc.test, file=" queryOV.xlsx" , samples.mod=T, clinics.mod=T){
< pre class = "r" > < code > sqlWriteTemp< -function(conn=dta, nhcs=nhc.test, file=" queryOV.xlsx" , samples.mod=T, clinics.mod=T){
upd.ovid< -sqlFetch(conn, " OVID" ) %> % filter(NHC %in% nhcs)
upd.ovid< -sqlFetch(conn, " OVID" ) %> % filter(NHC %in% nhcs)
@ -535,15 +595,15 @@ sqlWriteTemp()
< / div >
< / div >
< div id = "sqlsincbd" class = "section level2" >
< div id = "sqlsincbd" class = "section level2" >
< h2 > sqlSincBD< / h2 >
< h2 > sqlSincBD< / h2 >
< div id = "description-5 " class = "section level3" >
< div id = "description-6 " class = "section level3" >
< h3 > Description< / h3 >
< h3 > Description< / h3 >
< p > Updates the DB with the information filled in the template file.< / p >
< p > Updates the DB with the information filled in the template file.< / p >
< / div >
< / div >
< div id = "usage-5 " class = "section level3" >
< div id = "usage-6 " class = "section level3" >
< h3 > Usage< / h3 >
< h3 > Usage< / h3 >
< p > sqlSincBD(conn=dta, filetemp=“QueryOV.xlsx”, sinc.samples=F, sinc.clinics=F)< / p >
< p > sqlSincBD(conn=dta, filetemp=“QueryOV.xlsx”, sinc.samples=F, sinc.clinics=F)< / p >
< / div >
< / div >
< div id = "arguments-5 " class = "section level3" >
< div id = "arguments-6 " class = "section level3" >
< h3 > Arguments< / h3 >
< h3 > Arguments< / h3 >
< table >
< table >
< colgroup >
< colgroup >
@ -576,15 +636,15 @@ sqlWriteTemp()
< / tbody >
< / tbody >
< / table >
< / table >
< / div >
< / div >
< div id = "details-5 " class = "section level3" >
< div id = "details-6 " class = "section level3" >
< h3 > Details< / h3 >
< h3 > Details< / h3 >
< p > Updates the DB with the information filled in the template file. All the “samples” entries are added as new rows (as all samples are new even if the patient was already in the DB). The new patients included in the “CLINICS” sheet are introduced in the DB as new rows and the ones that were already there are modified in its previous row location.< / p >
< p > Updates the DB with the information filled in the template file. All the “samples” entries are added as new rows (as all samples are new even if the patient was already in the DB). The new patients included in the “CLINICS” sheet are introduced in the DB as new rows and the ones that were already there are modified in its previous row location.< / p >
< / div >
< / div >
< div id = "value-5 " class = "section level3" >
< div id = "value-6 " class = "section level3" >
< h3 > Value< / h3 >
< h3 > Value< / h3 >
< p > Invisibly for success (and failures cause errors).< / p >
< p > Invisibly for success (and failures cause errors).< / p >
< / div >
< / div >
< div id = "examples-5 " class = "section level3" >
< div id = "examples-6 " class = "section level3" >
< h3 > Examples< / h3 >
< h3 > Examples< / h3 >
< pre class = "r" > < code > dta< -odbcConnect(" test" )
< pre class = "r" > < code > dta< -odbcConnect(" test" )
nhc.test< -c(" XXXXXXXX" ," XXXXXXX" )
nhc.test< -c(" XXXXXXXX" ," XXXXXXX" )
@ -592,7 +652,7 @@ sqlGenOVID(sinc=T)
sqlWriteTemp()
sqlWriteTemp()
sqlSincBD(sinc.samples=T, sinc.clinics=T)< / code > < / pre >
sqlSincBD(sinc.samples=T, sinc.clinics=T)< / code > < / pre >
< / div >
< / div >
< div id = "function-5 " class = "section level3" >
< div id = "function-6 " class = "section level3" >
< h3 > Function< / h3 >
< h3 > Function< / h3 >
< pre class = "r" > < code > sqlSincBD< -function(conn=dta, filetemp=" QueryOV.xlsx" , sinc.samples=F, sinc.clinics=F){
< pre class = "r" > < code > sqlSincBD< -function(conn=dta, filetemp=" QueryOV.xlsx" , sinc.samples=F, sinc.clinics=F){
## Añadir código de muestra nueva a la base de datos
## Añadir código de muestra nueva a la base de datos