Skip to content

Commit

Permalink
Merge branch 'main' into feat/cloud_deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
bergalli authored Feb 20, 2024
2 parents 6a66cde + 39cc72e commit 2b6a9fa
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 1,027 deletions.
1 change: 0 additions & 1 deletion .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ if (file.exists("renv")) {
# Allow absolute module imports (relative to the app root).
options(box.path = getwd())


Sys.setenv(TRISK_INPUT_PATH = file.path("app", "data", "st_inputs"))
Sys.setenv(TRISK_OUTPUT_PATH = file.path("app", "data", "backend_db"))
# 'prod' or 'dev'
Expand Down
1 change: 1 addition & 0 deletions app/logic/cloud_logic.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ trigger_trisk_api_computation <- function(trisk_run_params, api_endpoint) {

# Define the headers, including Host
headers <- c(

`Host` = paste0("trisk-api.default.", trisk_api_service),
`Content-Type` = "application/json"
)
Expand Down
1 change: 1 addition & 0 deletions app/logic/data_load.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
box::use(

app/logic/cloud_logic[
get_data_from_postgres
]
Expand Down
1 change: 1 addition & 0 deletions app/logic/data_write.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ append_st_results_to_backend_data <- function(

# If the file exists, read the existing data, otherwise set the existing data to NULL
if (file.exists(fpath)) {

persistent_data <- arrow::read_parquet(fpath)
} else {
persistent_data <- NULL
Expand Down
1 change: 1 addition & 0 deletions app/logic/trisk_button_logic.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ trisk_generator <- function(
max_trisk_granularity
)
run_id <- check_if_run_exists(trisk_run_params, backend_trisk_run_folder)

} else {
run_id <- NULL
}
Expand Down
1 change: 1 addition & 0 deletions app/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ ui <- function(id) {
#' @export
server <- function(id) {
moduleServer(id, function(input, output, session) {

possible_trisk_combinations <- r2dii.climate.stress.test::get_scenario_geography_x_ald_sector(trisk_input_path)

# the TRISK runs are generated In the sidebar module
Expand Down
8 changes: 4 additions & 4 deletions app/view/crispy_equities.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ box::use(
)

box::use(
app/view/modules/trisk_button,
app/view/portfolio/portfolio_analysis,
app/view/modules/plots_equity_change,
app/view/modules/plots_trajectories,
app / view / modules / trisk_button,
app / view / portfolio / portfolio_analysis,
app / view / modules / plots_equity_change,
app / view / modules / plots_trajectories,
)

####### UI
Expand Down
4 changes: 2 additions & 2 deletions app/view/crispy_loans.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ box::use(
)

box::use(
app/view/modules/trisk_button,
app/view/portfolio/portfolio_analysis
app / view / modules / trisk_button,
app / view / portfolio / portfolio_analysis
)


Expand Down
5 changes: 3 additions & 2 deletions app/view/modules/trisk_button.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ box::use(
)

box::use(
app/logic/trisk_button_logic[
app / logic / trisk_button_logic[
trisk_generator,
check_if_run_exists
],
app/logic/data_load[
app / logic / data_load[
load_backend_crispy_data,
load_backend_trajectories_data
]
Expand Down Expand Up @@ -177,6 +177,7 @@ fetch_crispy_and_trajectories_data <- function(session, backend_trisk_run_folder

observe({
if (!is.null(trisk_granularity_r()) & !is.null(raw_crispy_data_r()) & !is.null(raw_trajectories_data_r())) {

crispy_data_r(
raw_crispy_data_r() |>
stress.test.plot.report::main_load_multi_crispy_data(granularity = trisk_granularity_r())
Expand Down
5 changes: 0 additions & 5 deletions scripts/creds.R
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
Sys.setenv(ST_POSTGRES_DB = "defaultdb")
Sys.setenv(ST_POSTGRES_HOST = "db-postgresql-st-inputs-do-user-15367886-0.c.db.ondigitalocean.com")
Sys.setenv(ST_POSTGRES_PORT = "25060")
Sys.setenv(ST_POSTGRES_USERNAME = "doadmin")
Sys.setenv(ST_POSTGRES_PASSWORD = "AVNS_s2JaVyjqyVTRru4_3C4")
Loading

0 comments on commit 2b6a9fa

Please sign in to comment.