diff --git a/.Rproj.user/178A6739/sources/prop/48F98022 b/.Rproj.user/178A6739/sources/prop/48F98022 index c86caeb..cfff3d0 100644 --- a/.Rproj.user/178A6739/sources/prop/48F98022 +++ b/.Rproj.user/178A6739/sources/prop/48F98022 @@ -1,6 +1,6 @@ { "source_window_id": "", "Source": "Source", - "cursorPosition": "50,4", - "scrollLine": "12" + "cursorPosition": "89,22", + "scrollLine": "71" } \ No newline at end of file diff --git a/.Rproj.user/178A6739/sources/prop/9D91FFC1 b/.Rproj.user/178A6739/sources/prop/9D91FFC1 index e766928..87247a5 100644 --- a/.Rproj.user/178A6739/sources/prop/9D91FFC1 +++ b/.Rproj.user/178A6739/sources/prop/9D91FFC1 @@ -1,6 +1,6 @@ { "source_window_id": "", "Source": "Source", - "cursorPosition": "16,0", + "cursorPosition": "27,17", "scrollLine": "0" } \ No newline at end of file diff --git a/.Rproj.user/178A6739/sources/session-99529da2/58AD392C b/.Rproj.user/178A6739/sources/session-99529da2/58AD392C index bdf502c..5620778 100644 --- a/.Rproj.user/178A6739/sources/session-99529da2/58AD392C +++ b/.Rproj.user/178A6739/sources/session-99529da2/58AD392C @@ -3,7 +3,7 @@ "path": "~/Projects/LoanRisk/panel.R", "project_path": "panel.R", "type": "r_source", - "hash": "2913767970", + "hash": "0", "contents": "", "dirty": false, "created": 1686047069391.0, @@ -12,15 +12,15 @@ "properties": { "source_window_id": "", "Source": "Source", - "cursorPosition": "50,4", - "scrollLine": "12" + "cursorPosition": "89,22", + "scrollLine": "71" }, "folds": "", - "lastKnownWriteTime": 1686047587, + "lastKnownWriteTime": 1686050840, "encoding": "UTF-8", "collab_server": "", "source_window": "", - "last_content_update": 1686047587539, + "last_content_update": 1686050840851, "read_only": false, "read_only_alternatives": [] } \ No newline at end of file diff --git a/.Rproj.user/178A6739/sources/session-99529da2/58AD392C-contents b/.Rproj.user/178A6739/sources/session-99529da2/58AD392C-contents index 542a99f..15b877c 100644 --- a/.Rproj.user/178A6739/sources/session-99529da2/58AD392C-contents +++ b/.Rproj.user/178A6739/sources/session-99529da2/58AD392C-contents @@ -1,114 +1,120 @@ + countries <- read.csv("./data/countries.csv") -panel1<- +panel1 <- tabPanel( - "Home", - fluidRow(column( - width = 11, - fluidRow( - column( - width = 8, - tags$div( - tags$blockquote( - "LoanRisk is being built to provide convenience to Finance and Accounting consultants and SMEs in finance industry." - ), - p( - "IFRS reporting, especially estimated loss calculation is a fairly complicated process involving Monte Carlo simulation, forecasting, survival modelling (or other predictive algorithm) and financial mathematics. - Naturally, it is time consuming and has its share of hassles. This app attempts to avoid all the hassles of setting up environment and tools to perform the multistep analysis. + "Home", + fluidRow(column(width = 11, + fluidRow( + column(width = 8, + tags$div( + tags$blockquote( + "LoanRisk is being built to provide convenience to Finance and Accounting consultants and SMEs in finance industry." + ), + p( + "IFRS reporting, especially estimated loss calculation is a fairly complicated process involving Monte Carlo simulation, forecasting, survival modelling (or other predictive algorithm) and financial mathematics. + Naturally, it is time consuming and has its share of hassles. This app attempts to avoid all the hassles of setting up environment and tools to perform the multistep analysis. This app will calculate the provisioning requirements in a few clicks and one can download the report with a single click!" - ), - p("The basic steps are mentioned in the diagram on the left hand side. The app is not in its most evolved form yet. - There is a huge list of features and functions that I personally want to include and implement in future."), - h6("How to use?"), - p("Using the tool is very simple. You can upload two data sets. One that shows a certain number of transactions of each asset, along with some dates, parameters and event outcome. - And the other that contains value of collateral or estimated value of sales of the asset/hypothecated asset. Then proceed further with the clicks and in between select some parameters. - For e.g. the discount rate to be applied, the most probable, maximum possible and minimum possible depreciation of value of the collateral. - Once the simulation is done, you can download the report in pdf format.")#, - # "If you are a R coder, you are welcome to contribute and help improve. Please visit the ", - # tags$a(href = "https://github.com/asitav-sen/LoanRisk", "github page"), - # " or ", - # tags$a(href = "www.asitavsen.com", "contact me."), - # "Please use this ", - # tags$a(href = "https://github.com/asitav-sen/LoanRisk/issues", "link"), - # " to report issues and/or request new features/functions.", "For general discussions, please use this",tags$a(href = "https://github.com/asitav-sen/LoanRisk/discussions", "link"), - # tags$br(), - # tags$image(height=100, width=100,src="logo3.png") - ) - ), - column( - width = 4, - mermaid(" + ), + p( + "The basic steps are mentioned in the diagram on the left hand side. The app is not in its most evolved form yet. + There is a huge list of features and functions that I personally want to include and implement in future." + ), + h6("How to use?"), + p( + "Using the tool is very simple. You can upload two data sets. One that shows a certain number of transactions of each asset, along with some dates, parameters and event outcome. + And the other that contains value of collateral or estimated value of sales of the asset/hypothecated asset. Then proceed further with the clicks and in between select some parameters. + For e.g. the discount rate to be applied, the most probable, maximum possible and minimum possible depreciation of value of the collateral. + Once the simulation is done, you can download the report in pdf format." + )#, + # "If you are a R coder, you are welcome to contribute and help improve. Please visit the ", + # tags$a(href = "https://github.com/asitav-sen/LoanRisk", "github page"), + # " or ", + # tags$a(href = "www.asitavsen.com", "contact me."), + # "Please use this ", + # tags$a(href = "https://github.com/asitav-sen/LoanRisk/issues", "link"), + # " to report issues and/or request new features/functions.", "For general discussions, please use this",tags$a(href = "https://github.com/asitav-sen/LoanRisk/discussions", "link"), + # tags$br(), + # tags$image(height=100, width=100,src="logo3.png") + )), + column( + width = 4, + mermaid( + " graph TB A[Data Upload]-->B[Downloading macroeconomic data] B[Downloading macroeconomic data from IMF]-->C[Forecasting macroeconomic parameters] C[Forecasting macroeconomic parameters]-->D[Fit Survival Model] D[Fit Survival Model]-->E[Monte Carlo Simulation] E[Monte Carlo Simulation]-->F[Report] - ") - ) - ), - )), - tags$hr(), - fluidRow( - column( - width = 6, - fluidRow( - h3("Data"), + " + ) + ) + ),)), + tags$hr(), + fluidRow( + column( + width = 6, + fluidRow( + h3("Data"), + br(), + p("This section shows the data (uploaded or inbuilt sample).") + ), + br(), + withSpinner( + dataTableOutput("up_data"), + type = 7, + color = "black" + ), br(), - p("This section shows the data (uploaded or inbuilt sample).") + actionButton("uploadnew", "Upload New Data", class = "btn-light") ), - br(), - withSpinner(dataTableOutput("up_data"),type = 7, - color = "black"), - br(), - actionButton("uploadnew", "Upload New Data", class="btn-light") + column(width = 6, + br(), + basicstatUI("nofloans")) + ), - column(width = 6, - br(), - basicstatUI("nofloans")) - - ), - br(), - br(), - fluidRow( - column( - width = 6, - h3("With Macroeconomic data"), - p( - "In this section, we add macroeconomic data. Please select the country of the asset and click on fetch button. If download fails, click again or try after sometime. Please note that GDP data has been discontinued by IMF recently. Hence, using Industrial output temporarily." - ), + br(), + br(), + fluidRow( column( width = 6, - selectInput( - "country", - "Country", - selected = "India", - choices = countries$Country + h3("With Macroeconomic data"), + p( + "In this section, we add macroeconomic data. Please select the country of the asset and click on fetch button. If download fails, click again or try after sometime. Please note that GDP data has been discontinued by IMF recently. Hence, using Industrial output temporarily." + ), + column( + width = 6, + selectInput( + "country", + "Country", + selected = "India", + choices = countries$Country + ) + ), + column( + width = 6, + br(), + actionButton("fetchimf", "Fetch IMF data", class = "glow") + ), + withSpinner( + dataTableOutput("fulldata"), + type = 7, + color = "black" ) ), - column( - width = 6, - br(), - actionButton("fetchimf", "Fetch IMF data", class = "glow") - ), - withSpinner( - dataTableOutput("fulldata"), - type = 7, - color = "black" - ) + column(width = 6, + uiOutput("ac_button"), + uiOutput("expcalcu")) ), - column(width = 6, - uiOutput("ac_button"), - uiOutput("expcalcu")) - ), - br(), - br(), - fluidRow(column(width = 11, - uiOutput("scenario_opts"))), - br(), - fluidRow(column(width = 11, - uiOutput("credit_loss"))), - fluidRow(column(width = 11, - uiOutput("dlmanager"))) -) \ No newline at end of file + br(), + br(), + fluidRow(column(width = 11, + uiOutput("scenario_opts"))), + br(), + fluidRow(column(width = 11, + uiOutput("credit_loss"))), + fluidRow(column(width = 11, + uiOutput("dlmanager"))) + ) \ No newline at end of file diff --git a/.Rproj.user/178A6739/sources/session-99529da2/FEF97A26 b/.Rproj.user/178A6739/sources/session-99529da2/FEF97A26 index f1e9d5f..67838d0 100644 --- a/.Rproj.user/178A6739/sources/session-99529da2/FEF97A26 +++ b/.Rproj.user/178A6739/sources/session-99529da2/FEF97A26 @@ -3,7 +3,7 @@ "path": "~/Projects/LoanRisk/mod_basic.R", "project_path": "mod_basic.R", "type": "r_source", - "hash": "1648399213", + "hash": "0", "contents": "", "dirty": false, "created": 1686047786220.0, @@ -12,15 +12,15 @@ "properties": { "source_window_id": "", "Source": "Source", - "cursorPosition": "16,0", + "cursorPosition": "27,17", "scrollLine": "0" }, "folds": "", - "lastKnownWriteTime": 1686049500, + "lastKnownWriteTime": 1686050855, "encoding": "UTF-8", "collab_server": "", "source_window": "", - "last_content_update": 1686049500334, + "last_content_update": 1686050855732, "read_only": false, "read_only_alternatives": [] } \ No newline at end of file diff --git a/.Rproj.user/178A6739/sources/session-99529da2/FEF97A26-contents b/.Rproj.user/178A6739/sources/session-99529da2/FEF97A26-contents index b07cb7d..733f591 100644 --- a/.Rproj.user/178A6739/sources/session-99529da2/FEF97A26-contents +++ b/.Rproj.user/178A6739/sources/session-99529da2/FEF97A26-contents @@ -6,9 +6,7 @@ basicstatUI <- function(id) { fluidRow( h3("No of Assets"), br(), - p( - "This section shows some basic information about the portfolio." - ), + p("This section shows some basic information about the portfolio."), plotOutput(ns("statplot")), verbatimTextOutput(ns("balancetext")) ) @@ -90,18 +88,16 @@ basicstatServer <- function(id, dt) { group_by(customer_type, loan_status) %>% summarise(no_of_loans = n()) %>% ungroup() %>% - ggplot( - aes( - x = customer_type, - y = no_of_loans, - label = no_of_loans, - fill = factor( - loan_status, - levels = c("0", "1"), - labels = c("Good", "Bad") - ) + ggplot(aes( + x = customer_type, + y = no_of_loans, + label = no_of_loans, + fill = factor( + loan_status, + levels = c("0", "1"), + labels = c("Good", "Bad") ) - ) + + )) + geom_col(position = "dodge") + geom_text(aes(y = no_of_loans + 20), position = position_dodge(width = 1)) + labs(title = "No. of assets by customer type", diff --git a/mod_basic.R b/mod_basic.R index b07cb7d..733f591 100644 --- a/mod_basic.R +++ b/mod_basic.R @@ -6,9 +6,7 @@ basicstatUI <- function(id) { fluidRow( h3("No of Assets"), br(), - p( - "This section shows some basic information about the portfolio." - ), + p("This section shows some basic information about the portfolio."), plotOutput(ns("statplot")), verbatimTextOutput(ns("balancetext")) ) @@ -90,18 +88,16 @@ basicstatServer <- function(id, dt) { group_by(customer_type, loan_status) %>% summarise(no_of_loans = n()) %>% ungroup() %>% - ggplot( - aes( - x = customer_type, - y = no_of_loans, - label = no_of_loans, - fill = factor( - loan_status, - levels = c("0", "1"), - labels = c("Good", "Bad") - ) + ggplot(aes( + x = customer_type, + y = no_of_loans, + label = no_of_loans, + fill = factor( + loan_status, + levels = c("0", "1"), + labels = c("Good", "Bad") ) - ) + + )) + geom_col(position = "dodge") + geom_text(aes(y = no_of_loans + 20), position = position_dodge(width = 1)) + labs(title = "No. of assets by customer type", diff --git a/panel.R b/panel.R index 542a99f..15b877c 100644 --- a/panel.R +++ b/panel.R @@ -1,114 +1,120 @@ + countries <- read.csv("./data/countries.csv") -panel1<- +panel1 <- tabPanel( - "Home", - fluidRow(column( - width = 11, - fluidRow( - column( - width = 8, - tags$div( - tags$blockquote( - "LoanRisk is being built to provide convenience to Finance and Accounting consultants and SMEs in finance industry." - ), - p( - "IFRS reporting, especially estimated loss calculation is a fairly complicated process involving Monte Carlo simulation, forecasting, survival modelling (or other predictive algorithm) and financial mathematics. - Naturally, it is time consuming and has its share of hassles. This app attempts to avoid all the hassles of setting up environment and tools to perform the multistep analysis. + "Home", + fluidRow(column(width = 11, + fluidRow( + column(width = 8, + tags$div( + tags$blockquote( + "LoanRisk is being built to provide convenience to Finance and Accounting consultants and SMEs in finance industry." + ), + p( + "IFRS reporting, especially estimated loss calculation is a fairly complicated process involving Monte Carlo simulation, forecasting, survival modelling (or other predictive algorithm) and financial mathematics. + Naturally, it is time consuming and has its share of hassles. This app attempts to avoid all the hassles of setting up environment and tools to perform the multistep analysis. This app will calculate the provisioning requirements in a few clicks and one can download the report with a single click!" - ), - p("The basic steps are mentioned in the diagram on the left hand side. The app is not in its most evolved form yet. - There is a huge list of features and functions that I personally want to include and implement in future."), - h6("How to use?"), - p("Using the tool is very simple. You can upload two data sets. One that shows a certain number of transactions of each asset, along with some dates, parameters and event outcome. - And the other that contains value of collateral or estimated value of sales of the asset/hypothecated asset. Then proceed further with the clicks and in between select some parameters. - For e.g. the discount rate to be applied, the most probable, maximum possible and minimum possible depreciation of value of the collateral. - Once the simulation is done, you can download the report in pdf format.")#, - # "If you are a R coder, you are welcome to contribute and help improve. Please visit the ", - # tags$a(href = "https://github.com/asitav-sen/LoanRisk", "github page"), - # " or ", - # tags$a(href = "www.asitavsen.com", "contact me."), - # "Please use this ", - # tags$a(href = "https://github.com/asitav-sen/LoanRisk/issues", "link"), - # " to report issues and/or request new features/functions.", "For general discussions, please use this",tags$a(href = "https://github.com/asitav-sen/LoanRisk/discussions", "link"), - # tags$br(), - # tags$image(height=100, width=100,src="logo3.png") - ) - ), - column( - width = 4, - mermaid(" + ), + p( + "The basic steps are mentioned in the diagram on the left hand side. The app is not in its most evolved form yet. + There is a huge list of features and functions that I personally want to include and implement in future." + ), + h6("How to use?"), + p( + "Using the tool is very simple. You can upload two data sets. One that shows a certain number of transactions of each asset, along with some dates, parameters and event outcome. + And the other that contains value of collateral or estimated value of sales of the asset/hypothecated asset. Then proceed further with the clicks and in between select some parameters. + For e.g. the discount rate to be applied, the most probable, maximum possible and minimum possible depreciation of value of the collateral. + Once the simulation is done, you can download the report in pdf format." + )#, + # "If you are a R coder, you are welcome to contribute and help improve. Please visit the ", + # tags$a(href = "https://github.com/asitav-sen/LoanRisk", "github page"), + # " or ", + # tags$a(href = "www.asitavsen.com", "contact me."), + # "Please use this ", + # tags$a(href = "https://github.com/asitav-sen/LoanRisk/issues", "link"), + # " to report issues and/or request new features/functions.", "For general discussions, please use this",tags$a(href = "https://github.com/asitav-sen/LoanRisk/discussions", "link"), + # tags$br(), + # tags$image(height=100, width=100,src="logo3.png") + )), + column( + width = 4, + mermaid( + " graph TB A[Data Upload]-->B[Downloading macroeconomic data] B[Downloading macroeconomic data from IMF]-->C[Forecasting macroeconomic parameters] C[Forecasting macroeconomic parameters]-->D[Fit Survival Model] D[Fit Survival Model]-->E[Monte Carlo Simulation] E[Monte Carlo Simulation]-->F[Report] - ") - ) - ), - )), - tags$hr(), - fluidRow( - column( - width = 6, - fluidRow( - h3("Data"), + " + ) + ) + ),)), + tags$hr(), + fluidRow( + column( + width = 6, + fluidRow( + h3("Data"), + br(), + p("This section shows the data (uploaded or inbuilt sample).") + ), + br(), + withSpinner( + dataTableOutput("up_data"), + type = 7, + color = "black" + ), br(), - p("This section shows the data (uploaded or inbuilt sample).") + actionButton("uploadnew", "Upload New Data", class = "btn-light") ), - br(), - withSpinner(dataTableOutput("up_data"),type = 7, - color = "black"), - br(), - actionButton("uploadnew", "Upload New Data", class="btn-light") + column(width = 6, + br(), + basicstatUI("nofloans")) + ), - column(width = 6, - br(), - basicstatUI("nofloans")) - - ), - br(), - br(), - fluidRow( - column( - width = 6, - h3("With Macroeconomic data"), - p( - "In this section, we add macroeconomic data. Please select the country of the asset and click on fetch button. If download fails, click again or try after sometime. Please note that GDP data has been discontinued by IMF recently. Hence, using Industrial output temporarily." - ), + br(), + br(), + fluidRow( column( width = 6, - selectInput( - "country", - "Country", - selected = "India", - choices = countries$Country + h3("With Macroeconomic data"), + p( + "In this section, we add macroeconomic data. Please select the country of the asset and click on fetch button. If download fails, click again or try after sometime. Please note that GDP data has been discontinued by IMF recently. Hence, using Industrial output temporarily." + ), + column( + width = 6, + selectInput( + "country", + "Country", + selected = "India", + choices = countries$Country + ) + ), + column( + width = 6, + br(), + actionButton("fetchimf", "Fetch IMF data", class = "glow") + ), + withSpinner( + dataTableOutput("fulldata"), + type = 7, + color = "black" ) ), - column( - width = 6, - br(), - actionButton("fetchimf", "Fetch IMF data", class = "glow") - ), - withSpinner( - dataTableOutput("fulldata"), - type = 7, - color = "black" - ) + column(width = 6, + uiOutput("ac_button"), + uiOutput("expcalcu")) ), - column(width = 6, - uiOutput("ac_button"), - uiOutput("expcalcu")) - ), - br(), - br(), - fluidRow(column(width = 11, - uiOutput("scenario_opts"))), - br(), - fluidRow(column(width = 11, - uiOutput("credit_loss"))), - fluidRow(column(width = 11, - uiOutput("dlmanager"))) -) \ No newline at end of file + br(), + br(), + fluidRow(column(width = 11, + uiOutput("scenario_opts"))), + br(), + fluidRow(column(width = 11, + uiOutput("credit_loss"))), + fluidRow(column(width = 11, + uiOutput("dlmanager"))) + ) \ No newline at end of file