Skip to content

Instantly share code, notes, and snippets.

View fdefalco's full-sized avatar

Frank DeFalco fdefalco

  • Johnson & Johnson
View GitHub Profile
library(DataQualityDashboard)
library(dplyr)
if (Sys.getenv("DONT_DOWNLOAD_JDBC_DRIVERS", "") == "TRUE") {
jdbcDriverFolder <- Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")
} else {
jdbcDriverFolder <- tempfile("jdbcDrivers")
dir.create(jdbcDriverFolder)
downloadJdbcDrivers("postgresql", jdbcDriverFolder)
downloadJdbcDrivers("sql server", jdbcDriverFolder)
@fdefalco
fdefalco / EunomiaToAres.R
Last active July 18, 2023 15:41
Eunomia to ARES Test Loop
# eunomia based test script for achilles and ares
backupOptions <- options()
options(connectionObserver = NULL)
options(useFancyQuotes = FALSE)
Sys.setenv(EUNOMIA_DATA_FOLDER = "D:/OHDSI/EunomiaDatasets")
aresDataRoot <- "D:/git/Ares/public/data"
datasetOptions <- list(
options(connectionObserver = NULL)
library("dplyr")
library("tibble")
# This script leverages an existing WebAPI installation to compare two versions of the standard vocabulary and their impact on concept set resolution across a set of cohort definitions.
# base url of the WebAPI installation
baseUrl <- "https://epi.jnj.com:8443/WebAPI"
# if security is enabled authorize use of the webapi
library(httr)
library(tibble)
options(warn=-1)
# create data frame to store results
unitData <- tibble(
ResultBaseUnit = character(),
ResultQuantity = numeric(),
SourceUnit = character()
@fdefalco
fdefalco / DuckDbTests.R
Created August 19, 2022 15:22
DuckDb Eunomia Testing
library("DBI")
library("Eunomia")
library("dplyr")
library("readr")
library("dbplyr")
connection = DBI::dbConnect(duckdb::duckdb(), dbdir=":memory:")
Eunomia::exportToCsv("D:/OHDSI/EunomiaCsv")
DBI::dbWithTransaction(connection, {
# TODO
# Potentially create a version with just Sqlite
# create_source_to_standard_vocab_map.sql - need to improve performance
# include additional measurement units in the vocabulary shard
# abstract creation of concepts.csv to create synthea concepts from concept extraction jar at execution
# add scan report to loop (whiterabbit)
options(connectionObserver = NULL)
options(useFancyQuotes = FALSE)
@fdefalco
fdefalco / covid-19-time-series.R
Created April 7, 2020 13:47
Pull the latest covid-19 data and then plot if for selected counties in the US.
library(tidyr)
library(ggplot2)
library(dplyr)
# pull data from live updated repository
data <- read.csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_US.csv")
# pivot data format and convert dates
narrowData <- data %>% pivot_longer(cols = starts_with("X"), names_prefix = "X", names_to = "date", values_to = "count", values_drop_na = TRUE)
narrowData$date <- as.Date(narrowData$date, "%m.%d.%y")
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>population pyramid integration</title>
</head>
<body>
</body>