Hey, Thanks a lot Joe and Owe.....the program ran well...then I thought about
upgrading the program to do the reversal also i.e now I'm enabling the
user to search both ways ICD-9 to ICD-10 as well as ICD-10 to ICD-9. But
I'm facing 2 problems here....
1. the program runs in a ambiguous way: the headings and the data on output are all mismatching. I did not change anything in the query part.
2.While I use the second radio button, for searching the vice-verse, the program is not actually switching to the second option. No output on screen shows up(blank main panel).
Thankx for looking:
UI.R radioButtons(inputId = "code",
label="Select the Stereotype of Code to be Searched:",
choices= list("ICD-9-CM" = "i9",
"ICD-10-CM" = "i10")),
textInput("icd", "Type an ICD-9 Code here:",value=80363),
submitButton("Update View"),
helpText("NOTE: INSTRUCTIONS FOR INPUT:-"),
helpText("1. All ICD-9/10 Codes have a maximum length of 6 Characters."),
helpText("2. All ICD-9/10 Alphanumeric codes are Case-sensitive i.e.
Codes starting with Alphabets should be input with the Alphabets in
capitals."),
helpText("3. e.g ICD-9 Code '0010' should be input as '0010' and NOT '10'."),
helpText("4. e.g ICD-9 Code 'E9293' should be input as 'E9293' and NOT as 'e9293'."),
helpText("5. e.g ICD-10 Code 'F12280' should be input as 'F12280' and NOT as 'f12280'.")),
mainPanel(
tabsetPanel(
tabPanel("Corresponding ICD Code", tableOutput("out1")),
tabPanel("ICD-9 Codes usage statistics"),#-, tableOutput("out2"), plotOutput("plot9")),
tabPanel("ICD-10 Codes usage statistics")#, tableOutput("out3"), plotOutput("plot10")
))))
server.Rlibrary(shiny)
library(RPostgreSQL)
shinyServer(function(input, output){
inputCode <- reactive({
input$icd
input$code
switch(input$code,
i9 = "ic9",
i10 = "ic10")
if(input$code == "ic9")
{
query <- "SELECT icd_10_codes, description, flags FROM icd_9_10_dia WHERE icd_9_codes ='"
}
else if(input$code == "ic10"){
query <- "SELECT icd_9_codes, description, flags FROM icd_10_9_dia WHERE icd_10_codes ='"
}
stmt
})
dbConn <- function(inputCode,out){
con <- dbConnect(dbDriver("PostgreSQL"), user="postgres", password="jst", dbname="ICD_9_10_Mapping", host = "localhost", port = 5432)
on.exit(dbDisconnect(con), add=TRUE)
invert <- "'"
stmt <<- paste(query,toString(input$icd, width = 10),invert, sep = "")