Compare commits
45 Commits
b968de1fb1
..
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 560540cf1a | |||
| bd52e8c452 | |||
| 43b807cc63 | |||
| cb38ea347d | |||
| 6671939939 | |||
| a6f0c97d47 | |||
| 56484a5903 | |||
| b5323436ec | |||
| a57fb3aac8 | |||
| dbb8e1ed0d | |||
| e6c2a32ddb | |||
| 51acdd0ece | |||
| dcbf4f8b9d | |||
| 001f64cc76 | |||
| e95caafe28 | |||
| f45ebfd106 | |||
| cb6c739d14 | |||
| 20bf1d2c20 | |||
| a5581182c2 | |||
| ab1684651e | |||
| 67ba4921ca | |||
| db6c07595c | |||
| 35e4d31495 | |||
| 38aa06c4ee | |||
| 38e902cef0 | |||
| 3492b7f7ef | |||
| 44901be490 | |||
| 3c8a69b21c | |||
| 9b8f24ddd8 | |||
| ea45d8c845 | |||
| 134133498b | |||
| c9d09c44a2 | |||
| b12ae3fd5f | |||
| 2909f49eec | |||
| b14fddf8fe | |||
| 5bbd25c64d | |||
| 5ea3b493f4 | |||
| ffdf64d736 | |||
| af5eee3a33 | |||
| 6cdde0282a | |||
| f4c6fae34a | |||
| a8ca15592e | |||
| 022a222ddf | |||
| 5762efa5e4 | |||
| df0e5d4985 |
+1113
-20
File diff suppressed because it is too large
Load Diff
+4
-1
@@ -1 +1,4 @@
|
|||||||
file<-"C:/Users/47926492N/OneDrive - IDIBELL - Institut d'Investigació Biomèdica de Bellvitge/RATG-PIULATS/OVARIO.accdb"
|
# file<-"C:/Users/47926492N/OneDrive - IDIBELL - Institut d'Investigació Biomèdica de Bellvitge/RATG-PIULATS/MELANOMA UVEAL CIT.accdb"
|
||||||
|
# file<-"C:/Users/47926492N/OneDrive - IDIBELL - Institut d'Investigació Biomèdica de Bellvitge/RATG-PIULATS/OVARIO.accdb"
|
||||||
|
UMfile<-file<-"C:/Users/47926492N/Documents/Test/MELANOMA UVEAL CIT.accdb"
|
||||||
|
OVfile<-file<-"C:/Users/47926492N/Documents/Test/OVARIO.accdb"
|
||||||
+17
-6
@@ -13,6 +13,7 @@ sqlLastDrop<-function(conn, tablename, droplast=1,dbtype=NULL){
|
|||||||
sqlSave(conn, table, tablename = tablename, safer = F)}
|
sqlSave(conn, table, tablename = tablename, safer = F)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sqlInitialize<-function(ruta="ruta_database.R"){
|
sqlInitialize<-function(ruta="ruta_database.R"){
|
||||||
library(tidyverse)
|
library(tidyverse)
|
||||||
library(RODBC)
|
library(RODBC)
|
||||||
@@ -61,23 +62,29 @@ sqlShowSamples<-function(conn=dta, nhcs=nhc.test, verb=F, dbtype=NULL){
|
|||||||
}
|
}
|
||||||
|
|
||||||
sqlGenOVID<-function(conn=dta, nhcs=nhc.test, verb=T, sinc=F, dbtype=NULL){
|
sqlGenOVID<-function(conn=dta, nhcs=nhc.test, verb=T, sinc=F, dbtype=NULL){
|
||||||
if(sqlTables(dta) %>% filter(TABLE_NAME == "UMID") %>% nrow > 0){dbtype<-"UM"}
|
if(sqlTables(conn) %>% filter(TABLE_NAME == "UMID") %>% nrow > 0){dbtype<-"UM"}
|
||||||
if(sqlTables(dta) %>% filter(TABLE_NAME == "OVID") %>% nrow > 0){dbtype<-"OV"}
|
if(sqlTables(conn) %>% filter(TABLE_NAME == "OVID") %>% nrow > 0){dbtype<-"OV"}
|
||||||
|
|
||||||
if (dbtype == "OV"){
|
if (dbtype == "OV"){
|
||||||
db<-c("dbcode"="OVID")
|
db<-c("dbcode"="OVID", "dbpref"="OVID")
|
||||||
}
|
}
|
||||||
if (dbtype == "UM"){
|
if (dbtype == "UM"){
|
||||||
db<-c("dbcode"="UMID")
|
db<-c("dbcode"="UMID","dbpref"="UMID")
|
||||||
|
}
|
||||||
|
if (dbtype == "CC"){
|
||||||
|
db<-c("dbcode"="PATID", "dbpref"="CCID")
|
||||||
}
|
}
|
||||||
|
|
||||||
dbid<-sqlFetch(conn,db["dbcode"])
|
dbid<-sqlFetch(conn,db["dbcode"])
|
||||||
|
|
||||||
new.nhc<-nhcs[!nhcs %in% dbid$NHC] %>% unique()
|
new.nhc<-nhcs[!nhcs %in% dbid$NHC] %>% unique()
|
||||||
|
|
||||||
if(length(new.nhc) > 0){
|
if(length(new.nhc) > 0){
|
||||||
|
if (nrow(dbid) == 0){next.num<-1}else{
|
||||||
next.num<-gsub(db["dbcode"],"",dbid[,db["dbcode"]]) %>% as.numeric %>% max(na.rm=T)+1
|
next.num<-gsub(db["dbcode"],"",dbid[,db["dbcode"]]) %>% as.numeric %>% max(na.rm=T)+1
|
||||||
|
}
|
||||||
|
print(next.num)
|
||||||
last.num<-next.num+(length(new.nhc)-1)
|
last.num<-next.num+(length(new.nhc)-1)
|
||||||
newtab<-data.frame("NHC"=new.nhc, "ID"=sprintf("%s%04d",db["dbcode"],next.num:last.num)) %>% rename(!!db["dbcode"]:="ID")
|
newtab<-data.frame("NHC"=new.nhc, "ID"=sprintf("%s%04d",db["dbpref"],next.num:last.num)) %>% rename(!!db["dbcode"]:="ID")
|
||||||
if(dbtype=="OV"){
|
if(dbtype=="OV"){
|
||||||
dbid<-rbind(dbid,newtab)
|
dbid<-rbind(dbid,newtab)
|
||||||
}
|
}
|
||||||
@@ -86,6 +93,10 @@ sqlGenOVID<-function(conn=dta, nhcs=nhc.test, verb=T, sinc=F, dbtype=NULL){
|
|||||||
# dbid$Id<-as.numeric(rownames(dbid))
|
# dbid$Id<-as.numeric(rownames(dbid))
|
||||||
dbid$NHC<-as.numeric(dbid$NHC)
|
dbid$NHC<-as.numeric(dbid$NHC)
|
||||||
}
|
}
|
||||||
|
if (dbtype=="CC"){
|
||||||
|
dbid<-merge(dbid, newtab, all=T) %>% select(NHC,PATID) %>% arrange(PATID)
|
||||||
|
dbid$NHC<-as.numeric(dbid$NHC)
|
||||||
|
}
|
||||||
rownames(dbid)<-as.character(1:nrow(dbid))
|
rownames(dbid)<-as.character(1:nrow(dbid))
|
||||||
dbid<-filter(dbid, NHC %in% new.nhc) %>% mutate(NHC=as.character(NHC))
|
dbid<-filter(dbid, NHC %in% new.nhc) %>% mutate(NHC=as.character(NHC))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user