This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################ | |
### FUNCTION TO EXTRACT DATA FROM SQL | |
get_sql_data <- function(driver = "SQL Server", | |
server = "sdl02-vm161", | |
db_name = "OpsDW", | |
query_text = which_query){ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- VM 25 | |
---------------------------------------------------------- | |
---------------------------------------------------------- | |
DROP TABLE #AllCHA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### text_extraction.py | |
################################################################################# | |
################################################################################# | |
### PRELIMINARIES | |
import os | |
os.chdir("/Users/abrahammathew/Desktop/LZ_demo_poc/test_data") | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### EXECUTE ANALYSIS WITH AVERAGES AND IDEALIZED SLOTS | |
### PREDICT FOR 2020 | |
################################################################################################# | |
### SET PARAMETERS | |
data_path = "K:/Data Excellence/4 - Reducing Direct Clinical Costs/ATM/NP_Supply/NP_Supply_Estimation_V3/data/NP_Supply_Data_With_2020.csv" | |
use_these_packages <- c("dplyr", "ggplot2", "data.table", "lubridate", "stringr", "boot") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' GET_NETWORK_SUMMARY | |
#' | |
#' @param DATA_DT The name of the data table | |
#' @param USE_THESE_FEATURES a vector of all variable names | |
#' @param DO_SAMPLE Logical value for if the data should be sampled | |
#' @param DO_SAMPLE_FRAC If Do Sample is set to true, what percentage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddMissingDates <- function( | |
AGG_TS_DATA = FINAL_DATA[data_type == "TRAIN"], | |
DATE_COLUMN = "date_ymd", | |
TARGET_COLUMN = "visits", | |
OTHER_COLUMNS = c("revenue_segment", "line", "serviceline_segment", | |
"finance_group", "finance_sub_group"), | |
DEBUG = TRUE){ | |
if(DEBUG) message("AddMissingDates: Function Initialized \n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RunAllModels <- function(USE_THESE_FORMULAS = all_formulas, | |
MODEL_DATA = model_data, | |
DATA_DIMENSION = dim_name, | |
DATE_COLUMN = "date_ymd", | |
TARGET_COLUMN = "visits", | |
DEBUG = TRUE){ | |
if(DEBUG) message("RunAllModels: Function Initialized \n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def CreateProjectFiles(PROJECT_PATH): | |
print("CreateProjectFiles: Function initalized") | |
if os.path.exists(PROJECT_PATH) and any(os.scandir(PROJECT_PATH)): | |
folders = ["data", "deploy", "docs", "models", "notebooks", | |
"scripts", "tests", "utils"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import calendar | |
def AddMonths(DATE_VAL, | |
ADD_N, | |
DATE_FORMAT = "%Y-%m-%d"): | |
print("AddMonths: Function initalized") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CreateProjectFiles <- function(PROJECT_PATH = rstudioapi::getActiveProject(), | |
FOLDERS_TO_CREATE = c("data", "docs", "figs", "logs", | |
"output", "queries", "R", "tests"), | |
OPEN_NEW_SESSION = TRUE, | |
DEBUG = TRUE){ | |
if(DEBUG) message("CreateProjectFiles: Function initialized \n") | |
if(!dir.exists(PROJECT_PATH)){ |
OlderNewer