Add CDM R package demo to website
This commit is contained in:
parent
c768fa7e91
commit
125ac08c77
|
@ -11,18 +11,24 @@
|
|||
|
||||
|
||||
|
||||
<title>cdmRPackage.utf8</title>
|
||||
<title>CDM R Package Demo</title>
|
||||
|
||||
<script src="site_libs/header-attrs-2.6/header-attrs.js"></script>
|
||||
<script src="site_libs/jquery-1.11.3/jquery.min.js"></script>
|
||||
<script src="site_libs/header-attrs-2.11/header-attrs.js"></script>
|
||||
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link href="site_libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" />
|
||||
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
|
||||
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
|
||||
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
|
||||
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
|
||||
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
|
||||
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
|
||||
<style>h1 {font-size: 34px;}
|
||||
h1.title {font-size: 38px;}
|
||||
h2 {font-size: 30px;}
|
||||
h3 {font-size: 24px;}
|
||||
h4 {font-size: 18px;}
|
||||
h5 {font-size: 16px;}
|
||||
h6 {font-size: 12px;}
|
||||
code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
|
||||
pre:not([class]) { background-color: white }</style>
|
||||
<script src="site_libs/navigation-1.1/tabsets.js"></script>
|
||||
<link href="site_libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
|
||||
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
|
||||
|
@ -40,11 +46,6 @@
|
|||
</style>
|
||||
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<style type="text/css">
|
||||
pre:not([class]) {
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
if (window.hljs) {
|
||||
hljs.configure({languages: []});
|
||||
|
@ -57,32 +58,6 @@ if (window.hljs) {
|
|||
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
h1 {
|
||||
font-size: 34px;
|
||||
}
|
||||
h1.title {
|
||||
font-size: 38px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 30px;
|
||||
}
|
||||
h3 {
|
||||
font-size: 24px;
|
||||
}
|
||||
h4 {
|
||||
font-size: 18px;
|
||||
}
|
||||
h5 {
|
||||
font-size: 16px;
|
||||
}
|
||||
h6 {
|
||||
font-size: 12px;
|
||||
}
|
||||
.table th:not([align]) {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
|
@ -95,10 +70,6 @@ h6 {
|
|||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
code {
|
||||
color: inherit;
|
||||
background-color: rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
img {
|
||||
max-width:100%;
|
||||
}
|
||||
|
@ -114,40 +85,13 @@ button.code-folding-btn:focus {
|
|||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
pre code {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
/* padding for bootstrap navbar */
|
||||
body {
|
||||
padding-top: 51px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
/* offset scroll position for anchor links (for fixed navbar) */
|
||||
.section h1 {
|
||||
padding-top: 56px;
|
||||
margin-top: -56px;
|
||||
}
|
||||
.section h2 {
|
||||
padding-top: 56px;
|
||||
margin-top: -56px;
|
||||
}
|
||||
.section h3 {
|
||||
padding-top: 56px;
|
||||
margin-top: -56px;
|
||||
}
|
||||
.section h4 {
|
||||
padding-top: 56px;
|
||||
margin-top: -56px;
|
||||
}
|
||||
.section h5 {
|
||||
padding-top: 56px;
|
||||
margin-top: -56px;
|
||||
}
|
||||
.section h6 {
|
||||
padding-top: 56px;
|
||||
margin-top: -56px;
|
||||
}
|
||||
.dropdown-submenu {
|
||||
position: relative;
|
||||
}
|
||||
|
@ -175,7 +119,7 @@ body {
|
|||
margin-right: -10px;
|
||||
}
|
||||
.dropdown-submenu:hover>a:after {
|
||||
border-left-color: #ffffff;
|
||||
border-left-color: #adb5bd;
|
||||
}
|
||||
.dropdown-submenu.pull-left {
|
||||
float: none;
|
||||
|
@ -187,7 +131,7 @@ body {
|
|||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
<script type="text/javascript">
|
||||
// manage active state of menu based on current page
|
||||
$(document).ready(function () {
|
||||
// active menu anchor
|
||||
|
@ -198,10 +142,23 @@ $(document).ready(function () {
|
|||
var menuAnchor = $('a[href="' + href + '"]');
|
||||
|
||||
// mark it active
|
||||
menuAnchor.parent().addClass('active');
|
||||
menuAnchor.tab('show');
|
||||
|
||||
// if it's got a parent navbar menu mark it active as well
|
||||
menuAnchor.closest('li.dropdown').addClass('active');
|
||||
|
||||
// Navbar adjustments
|
||||
var navHeight = $(".navbar").first().height() + 15;
|
||||
var style = document.createElement('style');
|
||||
var pt = "padding-top: " + navHeight + "px; ";
|
||||
var mt = "margin-top: -" + navHeight + "px; ";
|
||||
var css = "";
|
||||
// offset scroll position for anchor links (for fixed navbar)
|
||||
for (var i = 1; i <= 6; i++) {
|
||||
css += ".section h" + i + "{ " + pt + mt + "}\n";
|
||||
}
|
||||
style.innerHTML = "body {" + pt + "padding-bottom: 40px; }\n" + css;
|
||||
document.head.appendChild(style);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -213,7 +170,6 @@ $(document).ready(function () {
|
|||
max-height: 500px;
|
||||
min-height: 44px;
|
||||
overflow-y: auto;
|
||||
background: white;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
@ -266,69 +222,6 @@ $(document).ready(function () {
|
|||
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
#TOC {
|
||||
margin: 25px 0px 20px 0px;
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
#TOC {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
.toc-content {
|
||||
/* see https://github.com/w3c/csswg-drafts/issues/4434 */
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.toc-content {
|
||||
padding-left: 30px;
|
||||
padding-right: 40px;
|
||||
}
|
||||
|
||||
div.main-container {
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
div.tocify {
|
||||
width: 20%;
|
||||
max-width: 260px;
|
||||
max-height: 85%;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) and (max-width: 991px) {
|
||||
div.tocify {
|
||||
width: 25%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
div.tocify {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
|
||||
.tocify ul, .tocify li {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.tocify-subheader .tocify-item {
|
||||
font-size: 0.90em;
|
||||
}
|
||||
|
||||
.tocify .list-group-item {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
@ -338,16 +231,6 @@ div.tocify {
|
|||
<div class="container-fluid main-container">
|
||||
|
||||
|
||||
<!-- setup 3col/9col grid for toc_float and main content -->
|
||||
<div class="row-fluid">
|
||||
<div class="col-xs-12 col-sm-4 col-md-3">
|
||||
<div id="TOC" class="tocify">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toc-content col-xs-12 col-sm-8 col-md-9">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||
|
@ -364,13 +247,13 @@ div.tocify {
|
|||
<ul class="nav navbar-nav">
|
||||
<li>
|
||||
<a href="index.html">
|
||||
<span class="fas fa-home"></span>
|
||||
<span class="fa fa-home"></span>
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
<span class="fas fa-landmark"></span>
|
||||
<span class="fa fa-landmark"></span>
|
||||
|
||||
Background
|
||||
|
||||
|
@ -390,7 +273,7 @@ div.tocify {
|
|||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
<span class="fas fa-list-alt"></span>
|
||||
<span class="fa fa-list-alt"></span>
|
||||
|
||||
Conventions
|
||||
|
||||
|
@ -410,7 +293,7 @@ div.tocify {
|
|||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
<span class="fas fa-history"></span>
|
||||
<span class="fa fa-history"></span>
|
||||
|
||||
CDM Versions
|
||||
|
||||
|
@ -441,7 +324,7 @@ div.tocify {
|
|||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
<span class="fas fa-plus-square"></span>
|
||||
<span class="fa fa-plus-square"></span>
|
||||
|
||||
Proposals
|
||||
|
||||
|
@ -463,7 +346,7 @@ div.tocify {
|
|||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
<span class="fas fa-question"></span>
|
||||
<span class="fa fa-question"></span>
|
||||
|
||||
How to
|
||||
|
||||
|
@ -483,7 +366,7 @@ div.tocify {
|
|||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
<span class="fas fa-life-ring"></span>
|
||||
<span class="fa fa-life-ring"></span>
|
||||
|
||||
Support
|
||||
|
||||
|
@ -505,7 +388,7 @@ div.tocify {
|
|||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a href="https://github.com/OHDSI/CommonDataModel">
|
||||
<span class="fas fa-github"></span>
|
||||
<span class="fa fa-github"></span>
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
@ -514,21 +397,56 @@ div.tocify {
|
|||
</div><!--/.container -->
|
||||
</div><!--/.navbar -->
|
||||
|
||||
<div class="fluid-row" id="header">
|
||||
<div id="header">
|
||||
|
||||
|
||||
|
||||
<h1 class="title toc-ignore"><strong>CDM R Package Demo</strong></h1>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<p>Below is an example showing two different ways the CDM R package can be used to create the tables in your environment. First, it uses the <code>buildRelease</code> function to create the DDL files on your machine. Once you have these downloaded you can then run them in your SQL client to set up the empty CDM tables. Second, the script shows the <code>executeDdl</code> function that will connect up to your SQL client directly (assuming your dbms is one of the supported dialects) and instantiate the tables through R.</p>
|
||||
<pre class="r"><code>## First, install the package from GitHub
|
||||
install.packages("devtools")
|
||||
devtools::install_github("OHDSI/CommonDataModel")
|
||||
|
||||
## List the currently supported SQL dialects
|
||||
CommonDataModel::listSupportedDialects()
|
||||
|
||||
## List the currently supported CDM versions
|
||||
CommonDataModel::listSupportedVersions()
|
||||
|
||||
## There are multiple ways to generate the DDLs
|
||||
|
||||
## 1. Use the buildRelease function to generate the text files in the dialect you choose.
|
||||
## This function will put the output files in the folder you specify
|
||||
|
||||
CommonDataModel::buildRelease(cdmVersions = "5.4",
|
||||
targetDialects = "postgresql",
|
||||
outputfolder = "/pathToOutput")
|
||||
|
||||
## 2. If you have an empty schema ready to go, the package will connect and instantiate
|
||||
## the tables for you.
|
||||
|
||||
### 2a. To start, you need to download DatabaseConnector in order to connect to your database.
|
||||
devtools::install_github("DatabaseConnector")
|
||||
|
||||
cd <- DatabaseConnector::createConnectionDetails(dbms = "postgresql",
|
||||
server = "localhost/ohdsi",
|
||||
user = "postgres",
|
||||
password = "postgres",
|
||||
pathToDriver = "/pathToDriver"
|
||||
)
|
||||
|
||||
CommonDataModel::executeDdl(connectionDetails = cd,
|
||||
cdmVersion = "5.4",
|
||||
cdmDatabaseSchema = "ohdsi_demo"
|
||||
)</code></pre>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
@ -553,39 +471,13 @@ $(document).ready(function () {
|
|||
|
||||
$(document).ready(function () {
|
||||
$('.tabset-dropdown > .nav-tabs > li').click(function () {
|
||||
$(this).parent().toggleClass('nav-tabs-open')
|
||||
$(this).parent().toggleClass('nav-tabs-open');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- code folding -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
// move toc-ignore selectors from section div to header
|
||||
$('div.section.toc-ignore')
|
||||
.removeClass('toc-ignore')
|
||||
.children('h1,h2,h3,h4,h5').addClass('toc-ignore');
|
||||
|
||||
// establish options
|
||||
var options = {
|
||||
selectors: "h1,h2,h3",
|
||||
theme: "bootstrap3",
|
||||
context: '.toc-content',
|
||||
hashGenerator: function (text) {
|
||||
return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_');
|
||||
},
|
||||
ignoreSelector: ".toc-ignore",
|
||||
scrollTo: 0
|
||||
};
|
||||
options.showAndHide = true;
|
||||
options.smoothScroll = true;
|
||||
|
||||
// tocify
|
||||
var toc = $("#TOC").tocify(options).data("toc-tocify");
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- dynamically load mathjax for compatibility with self-contained -->
|
||||
<script>
|
||||
|
|
|
@ -1,7 +1,45 @@
|
|||
---
|
||||
output:
|
||||
html_document:
|
||||
toc: TRUE
|
||||
toc_float: TRUE
|
||||
title: "**CDM R Package Demo**"
|
||||
output: html_document
|
||||
---
|
||||
|
||||
Below is an example showing two different ways the CDM R package can be used to create the tables in your environment. First, it uses the `buildRelease` function to create the DDL files on your machine. Once you have these downloaded you can then run them in your SQL client to set up the empty CDM tables. Second, the script shows the `executeDdl` function that will connect up to your SQL client directly (assuming your dbms is one of the supported dialects) and instantiate the tables through R.
|
||||
|
||||
```{r echo=TRUE, eval=FALSE}
|
||||
## First, install the package from GitHub
|
||||
install.packages("devtools")
|
||||
devtools::install_github("OHDSI/CommonDataModel")
|
||||
|
||||
## List the currently supported SQL dialects
|
||||
CommonDataModel::listSupportedDialects()
|
||||
|
||||
## List the currently supported CDM versions
|
||||
CommonDataModel::listSupportedVersions()
|
||||
|
||||
## There are multiple ways to generate the DDLs
|
||||
|
||||
## 1. Use the buildRelease function to generate the text files in the dialect you choose.
|
||||
## This function will put the output files in the folder you specify
|
||||
|
||||
CommonDataModel::buildRelease(cdmVersions = "5.4",
|
||||
targetDialects = "postgresql",
|
||||
outputfolder = "/pathToOutput")
|
||||
|
||||
## 2. If you have an empty schema ready to go, the package will connect and instantiate
|
||||
## the tables for you.
|
||||
|
||||
### 2a. To start, you need to download DatabaseConnector in order to connect to your database.
|
||||
devtools::install_github("DatabaseConnector")
|
||||
|
||||
cd <- DatabaseConnector::createConnectionDetails(dbms = "postgresql",
|
||||
server = "localhost/ohdsi",
|
||||
user = "postgres",
|
||||
password = "postgres",
|
||||
pathToDriver = "/pathToDriver"
|
||||
)
|
||||
|
||||
CommonDataModel::executeDdl(connectionDetails = cd,
|
||||
cdmVersion = "5.4",
|
||||
cdmDatabaseSchema = "ohdsi_demo"
|
||||
)
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue