Addresses #64, #70, #79, #92, #120, #132, #131 in code, documentation is still being updated to reflect these changes.

This commit is contained in:
clairblacketer 2017-11-09 09:30:50 -05:00
parent df2d439ac0
commit afd9a520d9
15 changed files with 893 additions and 35 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata

View File

@ -0,0 +1,2 @@
^.*\.Rproj$
^\.Rproj\.user$

View File

@ -0,0 +1,20 @@
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source

View File

@ -0,0 +1,14 @@
Package: DDLGeneratr
Type: Package
Title: OMOP CDM DDL Generator
Version: 0.1.0
Author: Clair Blacketer
Maintainer: Clair Blacketer <mblacke@its.jnj.com>
Description: This packages uses the SqlRender package to convert a DDL script written in OHDSql to the other supported dialects.
License: Apache License 2.0
Encoding: UTF-8
LazyData: true
Imports: SqlRender
NeedsCompilation: no
RoxygenNote: 6.0.1
VignetteBuilder: knitr

View File

@ -0,0 +1 @@
exportPattern("^[[:alpha:]]+")

View File

@ -0,0 +1,18 @@
# Hello, world!
#
# This is an example function named 'hello'
# which prints 'Hello, world!'.
#
# You can learn more about package authoring with RStudio at:
#
# http://r-pkgs.had.co.nz/
#
# Some useful keyboard shortcuts for package authoring:
#
# Build and Reload Package: 'Ctrl + Shift + B'
# Check Package: 'Ctrl + Shift + E'
# Test Package: 'Ctrl + Shift + T'
hello <- function() {
print("Hello, world!")
}

View File

@ -0,0 +1,740 @@
/*********************************************************************************
# Copyright 2017-11 Observational Health Data Sciences and Informatics
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
********************************************************************************/
/************************
####### # # ####### ###### ##### ###### # # ####### #####
# # ## ## # # # # # # # # ## ## # # # # #
# # # # # # # # # # # # # # # # # # # # #
# # # # # # # ###### # # # # # # # # ###### #####
# # # # # # # # # # # # # # # ### #
# # # # # # # # # # # # # # # # # ### # #
####### # # ####### # ##### ###### # # ## ##### ### #####
script to create OMOP common data model version 5.3
last revised: 6-Nov-2017
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
*************************/
/************************
Standardized vocabulary
************************/
CREATE TABLE concept (
concept_id INTEGER NOT NULL ,
concept_name VARCHAR(255) NOT NULL ,
domain_id VARCHAR(20) NOT NULL ,
vocabulary_id VARCHAR(20) NOT NULL ,
concept_class_id VARCHAR(20) NOT NULL ,
standard_concept VARCHAR(1) NULL ,
concept_code VARCHAR(50) NOT NULL ,
valid_start_date DATE NOT NULL ,
valid_end_date DATE NOT NULL ,
invalid_reason VARCHAR(1) NULL
)
;
CREATE TABLE vocabulary (
vocabulary_id VARCHAR(20) NOT NULL,
vocabulary_name VARCHAR(255) NOT NULL,
vocabulary_reference VARCHAR(255) NOT NULL,
vocabulary_version VARCHAR(255) NOT NULL,
vocabulary_concept_id INTEGER NOT NULL
)
;
CREATE TABLE domain (
domain_id VARCHAR(20) NOT NULL,
domain_name VARCHAR(255) NOT NULL,
domain_concept_id INTEGER NOT NULL
)
;
CREATE TABLE concept_class (
concept_class_id VARCHAR(20) NOT NULL,
concept_class_name VARCHAR(255) NOT NULL,
concept_class_concept_id INTEGER NOT NULL
)
;
CREATE TABLE concept_relationship (
concept_id_1 INTEGER NOT NULL,
concept_id_2 INTEGER NOT NULL,
relationship_id VARCHAR(20) NOT NULL,
valid_start_date DATE NOT NULL,
valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL
)
;
CREATE TABLE relationship (
relationship_id VARCHAR(20) NOT NULL,
relationship_name VARCHAR(255) NOT NULL,
is_hierarchical VARCHAR(1) NOT NULL,
defines_ancestry VARCHAR(1) NOT NULL,
reverse_relationship_id VARCHAR(20) NOT NULL,
relationship_concept_id INTEGER NOT NULL
)
;
CREATE TABLE concept_synonym (
concept_id INTEGER NOT NULL,
concept_synonym_name VARCHAR(1000) NOT NULL,
language_concept_id INTEGER NOT NULL
)
;
CREATE TABLE concept_ancestor (
ancestor_concept_id INTEGER NOT NULL,
descendant_concept_id INTEGER NOT NULL,
min_levels_of_separation INTEGER NOT NULL,
max_levels_of_separation INTEGER NOT NULL
)
;
CREATE TABLE source_to_concept_map (
source_code VARCHAR(50) NOT NULL,
source_concept_id INTEGER NOT NULL,
source_vocabulary_id VARCHAR(20) NOT NULL,
source_code_description VARCHAR(255) NULL,
target_concept_id INTEGER NOT NULL,
target_vocabulary_id VARCHAR(20) NOT NULL,
valid_start_date DATE NOT NULL,
valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL
)
;
CREATE TABLE drug_strength (
drug_concept_id INTEGER NOT NULL,
ingredient_concept_id INTEGER NOT NULL,
amount_value FLOAT NULL,
amount_unit_concept_id INTEGER NULL,
numerator_value FLOAT NULL,
numerator_unit_concept_id INTEGER NULL,
denominator_value FLOAT NULL,
denominator_unit_concept_id INTEGER NULL,
box_size INTEGER NULL,
valid_start_date DATE NOT NULL,
valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL
)
;
CREATE TABLE cohort_definition (
cohort_definition_id INTEGER NOT NULL,
cohort_definition_name VARCHAR(255) NOT NULL,
cohort_definition_description VARCHAR(MAX) NULL,
definition_type_concept_id INTEGER NOT NULL,
cohort_definition_syntax VARCHAR(MAX) NULL,
subject_concept_id INTEGER NOT NULL,
cohort_initiation_date DATE NULL
)
;
CREATE TABLE attribute_definition (
attribute_definition_id INTEGER NOT NULL,
attribute_name VARCHAR(255) NOT NULL,
attribute_description VARCHAR(MAX) NULL,
attribute_type_concept_id INTEGER NOT NULL,
attribute_syntax VARCHAR(MAX) NULL
)
;
/**************************
Standardized meta-data
***************************/
CREATE TABLE cdm_source
(
cdm_source_name VARCHAR(255) NOT NULL ,
cdm_source_abbreviation VARCHAR(25) NULL ,
cdm_holder VARCHAR(255) NULL ,
source_description VARCHAR(MAX) NULL ,
source_documentation_reference VARCHAR(255) NULL ,
cdm_etl_reference VARCHAR(255) NULL ,
source_release_date DATE NULL ,
cdm_release_date DATE NULL ,
cdm_version VARCHAR(10) NULL ,
vocabulary_version VARCHAR(20) NULL
)
;
CREATE TABLE metadata
(
metadata_concept_id INTEGER NOT NULL ,
metadata_type_concept_id INTEGER NOT NULL ,
name VARCHAR(250) NOT NULL ,
value_as_string NVARCHAR NULL ,
value_as_concept_id INTEGER NULL ,
metadata_date DATE NULL ,
metadata_datetime DATETIME2 NULL
)
;
/************************
Standardized clinical data
************************/
CREATE TABLE person
(
person_id INTEGER NOT NULL ,
gender_concept_id INTEGER NOT NULL ,
year_of_birth INTEGER NOT NULL ,
month_of_birth INTEGER NULL,
day_of_birth INTEGER NULL,
birth_datetime DATETIME2 NULL,
race_concept_id INTEGER NOT NULL,
ethnicity_concept_id INTEGER NOT NULL,
location_id INTEGER NULL,
provider_id INTEGER NULL,
care_site_id INTEGER NULL,
person_source_value VARCHAR(50) NULL,
gender_source_value VARCHAR(50) NULL,
gender_source_concept_id INTEGER NULL,
race_source_value VARCHAR(50) NULL,
race_source_concept_id INTEGER NULL,
ethnicity_source_value VARCHAR(50) NULL,
ethnicity_source_concept_id INTEGER NULL
)
;
CREATE TABLE observation_period
(
observation_period_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
observation_period_start_date DATE NOT NULL ,
observation_period_end_date DATE NOT NULL ,
period_type_concept_id INTEGER NOT NULL
)
;
CREATE TABLE specimen
(
specimen_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
specimen_concept_id INTEGER NOT NULL ,
specimen_type_concept_id INTEGER NOT NULL ,
specimen_date DATE NOT NULL ,
specimen_datetime DATETIME2 NULL ,
quantity FLOAT NULL ,
unit_concept_id INTEGER NULL ,
anatomic_site_concept_id INTEGER NULL ,
disease_status_concept_id INTEGER NULL ,
specimen_source_id VARCHAR(50) NULL ,
specimen_source_value VARCHAR(50) NULL ,
unit_source_value VARCHAR(50) NULL ,
anatomic_site_source_value VARCHAR(50) NULL ,
disease_status_source_value VARCHAR(50) NULL
)
;
CREATE TABLE death
(
person_id INTEGER NOT NULL ,
death_date DATE NOT NULL ,
death_datetime DATETIME2 NULL ,
death_type_concept_id INTEGER NOT NULL ,
cause_concept_id INTEGER NULL ,
cause_source_value VARCHAR(50) NULL,
cause_source_concept_id INTEGER NULL
)
;
CREATE TABLE visit_occurrence
(
visit_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
visit_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL ,
visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL ,
visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL,
care_site_id INTEGER NULL,
visit_source_value VARCHAR(50) NULL,
visit_source_concept_id INTEGER NULL
admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER(50) NULL ,
discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_occurrence_id INTEGER NULL
)
;
CREATE TABLE visit_detail
(
visit_detail_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
visit_detail_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL ,
visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL ,
visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL ,
care_site_id INTEGER NULL ,
admitting_source_concept_id INTEGER NULL ,
discharge_to_concept_id INTEGER NULL ,
preceding_visit_detail_id INTEGER NULL ,
visit_source_value VARCHAR(50) NULL ,
visit_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL ,
discharge_to_source_value VARCHAR(50) NULL ,
visit_detail_parent_id INTEGER NULL ,
visit_occurrence_id INTEGER NOT NULL
)
;
CREATE TABLE procedure_occurrence
(
procedure_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
procedure_concept_id INTEGER NOT NULL ,
procedure_date DATE NOT NULL ,
procedure_datetime DATETIME2 NOT NULL ,
procedure_type_concept_id INTEGER NOT NULL ,
modifier_concept_id INTEGER NULL ,
quantity INTEGER NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
procedure_source_value VARCHAR(50) NULL ,
procedure_source_concept_id INTEGER NULL ,
modifier_source_value VARCHAR(50) NULL
)
;
CREATE TABLE drug_exposure
(
drug_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL ,
drug_exposure_start_date DATE NOT NULL ,
drug_exposure_start_datetime DATETIME2 NULL ,
drug_exposure_end_date DATE NOT NULL ,
drug_exposure_end_datetime DATETIME2 NULL ,
verbatim_end_date DATE NULL ,
drug_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL ,
refills INTEGER NULL ,
quantity FLOAT NULL ,
days_supply INTEGER NULL ,
sig VARCHAR(MAX) NULL ,
route_concept_id INTEGER NULL ,
lot_number VARCHAR(50) NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
drug_source_value VARCHAR(50) NULL ,
drug_source_concept_id INTEGER NULL ,
route_source_value VARCHAR(50) NULL ,
dose_unit_source_value VARCHAR(50) NULL
)
;
CREATE TABLE device_exposure
(
device_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
device_concept_id INTEGER NOT NULL ,
device_exposure_start_date DATE NOT NULL ,
device_exposure_start_datetime DATETIME2 NULL ,
device_exposure_end_date DATE NULL ,
device_exposure_end_datetime DATETIME2 NULL ,
device_type_concept_id INTEGER NOT NULL ,
unique_device_id VARCHAR(50) NULL ,
quantity INTEGER NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
device_source_value VARCHAR(100) NULL ,
device_source_concept_id INTEGER NULL
)
;
CREATE TABLE condition_occurrence
(
condition_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
condition_concept_id INTEGER NOT NULL ,
condition_start_date DATE NOT NULL ,
condition_start_datetime DATETIME2 NULL ,
condition_end_date DATE NULL ,
condition_end_datetime DATETIME2 NULL ,
condition_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
condition_source_value VARCHAR(50) NULL ,
condition_source_concept_id INTEGER NULL ,
condition_status_source_value VARCHAR(50) NULL ,
condition_status_concept_id INTEGER NULL
)
;
CREATE TABLE measurement
(
measurement_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
measurement_concept_id INTEGER NOT NULL ,
measurement_date DATE NOT NULL ,
measurement_time VARCHAR(10) NULL ,
measurement_datetime DATETIME2 NULL ,
measurement_type_concept_id INTEGER NOT NULL ,
operator_concept_id INTEGER NULL ,
value_as_number FLOAT NULL ,
value_as_concept_id INTEGER NULL ,
unit_concept_id INTEGER NULL ,
range_low FLOAT NULL ,
range_high FLOAT NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
measurement_source_value VARCHAR(50) NULL ,
measurement_source_concept_id INTEGER NULL ,
unit_source_value VARCHAR(50) NULL ,
value_source_value VARCHAR(50) NULL
)
;
CREATE TABLE note
(
note_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
note_date DATE NOT NULL ,
note_datetime DATETIME2 NULL ,
note_type_concept_id INTEGER NOT NULL ,
note_class_concept_id INTEGER NOT NULL ,
note_title VARCHAR(250) NULL ,
note_text VARCHAR(MAX) NULL ,
encoding_concept_id INTEGER NOT NULL ,
language_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
note_source_value VARCHAR(50) NULL
)
;
CREATE TABLE note_nlp
(
note_nlp_id BIGINT NOT NULL ,
note_id INTEGER NOT NULL ,
section_concept_id INTEGER NULL ,
snippet VARCHAR(250) NULL ,
offset VARCHAR(250) NULL ,
lexical_variant VARCHAR(250) NOT NULL ,
note_nlp_concept_id INTEGER NULL ,
note_nlp_source_concept_id INTEGER NULL ,
nlp_system VARCHAR(250) NULL ,
nlp_date DATE NOT NULL ,
nlp_datetime DATETIME2 NULL ,
term_exists VARCHAR(1) NULL ,
term_temporal VARCHAR(50) NULL ,
term_modifiers VARCHAR(2000) NULL
)
;
CREATE TABLE observation
(
observation_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
observation_concept_id INTEGER NOT NULL ,
observation_date DATE NOT NULL ,
observation_datetime DATETIME2 NULL ,
observation_type_concept_id INTEGER NOT NULL ,
value_as_number FLOAT NULL ,
value_as_string VARCHAR(60) NULL ,
value_as_concept_id INTEGER NULL ,
qualifier_concept_id INTEGER NULL ,
unit_concept_id INTEGER NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
observation_source_value VARCHAR(50) NULL ,
observation_source_concept_id INTEGER NULL ,
unit_source_value VARCHAR(50) NULL ,
qualifier_source_value VARCHAR(50) NULL
)
;
CREATE TABLE fact_relationship
(
domain_concept_id_1 INTEGER NOT NULL ,
fact_id_1 INTEGER NOT NULL ,
domain_concept_id_2 INTEGER NOT NULL ,
fact_id_2 INTEGER NOT NULL ,
relationship_concept_id INTEGER NOT NULL
)
;
/************************
Standardized health system data
************************/
CREATE TABLE location
(
location_id INTEGER NOT NULL ,
address_1 VARCHAR(50) NULL ,
address_2 VARCHAR(50) NULL ,
city VARCHAR(50) NULL ,
state VARCHAR(2) NULL ,
zip VARCHAR(9) NULL ,
county VARCHAR(20) NULL ,
location_source_value VARCHAR(50) NULL
)
;
CREATE TABLE care_site
(
care_site_id INTEGER NOT NULL ,
care_site_name VARCHAR(255) NULL ,
place_of_service_concept_id INTEGER NULL ,
location_id INTEGER NULL ,
care_site_source_value VARCHAR(50) NULL ,
place_of_service_source_value VARCHAR(50) NULL
)
;
CREATE TABLE provider
(
provider_id INTEGER NOT NULL ,
provider_name VARCHAR(255) NULL ,
NPI VARCHAR(20) NULL ,
DEA VARCHAR(20) NULL ,
specialty_concept_id INTEGER NULL ,
care_site_id INTEGER NULL ,
year_of_birth INTEGER NULL ,
gender_concept_id INTEGER NULL ,
provider_source_value VARCHAR(50) NULL ,
specialty_source_value VARCHAR(50) NULL ,
specialty_source_concept_id INTEGER NULL ,
gender_source_value VARCHAR(50) NULL ,
gender_source_concept_id INTEGER NULL
)
;
/************************
Standardized health economics
************************/
CREATE TABLE payer_plan_period
(
payer_plan_period_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
payer_plan_period_start_date DATE NOT NULL ,
payer_plan_period_end_date DATE NOT NULL ,
payer_concept_id INTEGER NULL ,
payer_source_value VARCHAR(50) NULL ,
payer_source_concept_id INTEGER NULL ,
plan_concept_id INTEGER NULL ,
plan_source_value VARCHAR(50) NULL ,
plan_source_concept_id INTEGER NULL ,
sponsor_concept_id INTEGER NULL ,
sponsor_source_value VARCHAR(50) NULL ,
sponsor_source_concept_id INTEGER NULL ,
family_source_value VARCHAR(50) NULL ,
stop_reason_concept_id INTEGER NULL ,
stop_reason_source_value INTEGER NULL ,
stop_reason_source_concept_id INTEGER NULL
)
;
CREATE TABLE cost
(
cost_id INTEGER NOT NULL ,
cost_event_id INTEGER NOT NULL ,
cost_domain_id VARCHAR(20) NOT NULL ,
cost_type_concept_id INTEGER NOT NULL ,
currency_concept_id INTEGER NULL ,
total_charge FLOAT NULL ,
total_cost FLOAT NULL ,
total_paid FLOAT NULL ,
paid_by_payer FLOAT NULL ,
paid_by_patient FLOAT NULL ,
paid_patient_copay FLOAT NULL ,
paid_patient_coinsurance FLOAT NULL ,
paid_patient_deductible FLOAT NULL ,
paid_by_primary FLOAT NULL ,
paid_ingredient_cost FLOAT NULL ,
paid_dispensing_fee FLOAT NULL ,
payer_plan_period_id INTEGER NULL ,
amount_allowed FLOAT NULL ,
revenue_code_concept_id INTEGER NULL ,
reveue_code_source_value VARCHAR(50) NULL,
drg_concept_id INTEGER NULL,
drg_source_value VARCHAR(3) NULL
)
;
/************************
Standardized derived elements
************************/
CREATE TABLE cohort
(
cohort_definition_id INTEGER NOT NULL ,
subject_id INTEGER NOT NULL ,
cohort_start_date DATE NOT NULL ,
cohort_end_date DATE NOT NULL
)
;
CREATE TABLE cohort_attribute
(
cohort_definition_id INTEGER NOT NULL ,
cohort_start_date DATE NOT NULL ,
cohort_end_date DATE NOT NULL ,
subject_id INTEGER NOT NULL ,
attribute_definition_id INTEGER NOT NULL ,
value_as_number FLOAT NULL ,
value_as_concept_id INTEGER NULL
)
;
CREATE TABLE drug_era
(
drug_era_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL ,
drug_era_start_date DATE NOT NULL ,
drug_era_end_date DATE NOT NULL ,
drug_exposure_count INTEGER NULL ,
gap_days INTEGER NULL
)
;
CREATE TABLE dose_era
(
dose_era_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL ,
unit_concept_id INTEGER NOT NULL ,
dose_value FLOAT NOT NULL ,
dose_era_start_date DATE NOT NULL ,
dose_era_end_date DATE NOT NULL
)
;
CREATE TABLE condition_era
(
condition_era_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
condition_concept_id INTEGER NOT NULL ,
condition_era_start_date DATE NOT NULL ,
condition_era_end_date DATE NOT NULL ,
condition_occurrence_count INTEGER NULL
)
;

View File

@ -0,0 +1,12 @@
\name{hello}
\alias{hello}
\title{Hello, World!}
\usage{
hello()
}
\description{
Prints 'Hello, world!'.
}
\examples{
hello()
}

View File

@ -0,0 +1,32 @@
The VISIT_DETAIL table contains detail information about a record in the VISIT_OCCURRENCE table.
Field|Required|Type|Description
:------------------------|:--------|:-----|:-------------------------------------------------
| visit_detail_id| Yes| integer| A unique identifier for each Person's visit-detail at a healthcare provider.|
| person_id | Yes | integer | A foreign key identifier to the Person for whom the visit is recorded. The demographic details of that Person are stored in the PERSON table.|
| visit_detail_concept_id| Yes | integer | A foreign key that refers to a visit Concept identifier in the Standardized Vocabularies. |
| visit_start_date| Yes | date | The start date of the visit.|
| visit_start_datetime | Yes | datetime | The date and time of the visit-detail started.|
| visit_end_date| Yes | date | The end date of the visit.|
| visit_end_datetime | No | datetime | The date and time of the visit end.|
| visit_type_concept_id | Yes | integer | A foreign key to the predefined Concept identifier in the Standardized Vocabularies reflecting the type of source data from which the visit record is derived. |
| provider_id | No | integer | A foreign key to the provider in the provider table who was associated with the visit. |
| care_site_id | No | integer |A foreign key to the care site in the care site table where visit occurred |
| admitting_source_concept_id | No | integer | A foreign key to the predefined concept in the Place of Service Vocabulary reflecting the admitting source for a visit. |
| discharge_to_concept_id | No | integer | A foreign key to the predefined concept in the Place of Service Vocabulary reflecting the discharge disposition (destination) for a visit.|
| preceding_visit_detail_id | No | integer | A foreign key to the visit_occurrence table record of the visit immediately preceding this visit. |
| visit_source_value | No | string | The source code for the visit as it appears in the source data. |
| visit_source_concept_id | No | Integer | A foreign key to a Concept that refers to the code used in the source. |
| admitting_source_value | No | string | The source code for the admitting source as it appears in the source data. |
| discharge_to_source_value | No | string | The source code for the discharge disposition as it appears in the source data.|
| visit_detail_parent_id | No | integer | A foreign key to the visit_detail table record to represent the immediate parent visit-detail record. |
| visit_occurrence_id | Yes | integer | A foreign key that refers to the record in the visit_occurrence table |
### Conventions
* For every record in VISIT_OCCURRENCE there may be 0 or more records in VISIT_DETAIL.
* Records in VISIT_DETAIL will be related to each other sequentially or hierarchically AND will be related to the VISIT_OCCURRENCE table
**Example:**
An entire inpatient stay is represented as one record in the VISIT_OCCURRENCE table. The one inpatient stay is comprised of movements within the hospital, such as to the ER, ICU or medical floor. Each of the visit details may have different start
and end datetimes and would each end up as one record in the VISIT_DETAIL table with the same VISIT_OCCURRENCE_ID, related to each other sequentially by using the PRECEDING_VISIT_DETAIL_ID.

View File

@ -12,13 +12,13 @@ Field|Required|Type|Description
|visit_type_concept_id|Yes|Integer|A foreign key to the predefined Concept identifier in the Standardized Vocabularies reflecting the type of source data from which the visit record is derived.|
|provider_id|No|integer|A foreign key to the provider in the provider table who was associated with the visit.|
|care_site_id|No|integer|A foreign key to the care site in the care site table that was visited.|
|visit_source_value|No|string(50)|The source code for the visit as it appears in the source data.|
|visit_source_concept_id|No|Integer|A foreign key to a Concept that refers to the code used in the source.|
|admitting_source_concept_id| |Integer |No |A foreign key to the predefined concept in the Place of Service Vocabulary reflecting the admitting source for a visit.|
|admitting_source_value |Varchar(50)| No| The source code for the admitting source as it appears in the source data.|
|discharge_to_concept_id| Integer |No |A foreign key to the predefined concept in the Place of Service Vocabulary reflecting the discharge disposition for a visit.|
|discharge_to_source_value| Varchar(50)| No| The source code for the discharge disposition as it appears in the source data.|
|preceding_visit_occurrence_id |Integer| No |A foreign key to the VISIT_OCCURRENCE table of the visit immediately preceding this visit|
|visit_source_value|No|varchar(50)|The source code for the visit as it appears in the source data.|
|visit_source_concept_id|No|integer|A foreign key to a Concept that refers to the code used in the source.|
|admitting_source_concept_id| |integer |No |A foreign key to the predefined concept in the Place of Service Vocabulary reflecting the admitting source for a visit.|
|admitting_source_value |varchar(50)| No| The source code for the admitting source as it appears in the source data.|
|discharge_to_concept_id| integer |No |A foreign key to the predefined concept in the Place of Service Vocabulary reflecting the discharge disposition for a visit.|
|discharge_to_source_value| varchar(50)| No| The source code for the discharge disposition as it appears in the source data.|
|preceding_visit_occurrence_id |integer| No |A foreign key to the VISIT_OCCURRENCE table of the visit immediately preceding this visit|
### Conventions
@ -39,4 +39,4 @@ Field|Required|Type|Description
* Patient self-discharge against medical advice: 4021968
* In the case where a patient died during admission (Visit_Occurrence.discharge_disposition_concept_id = 4216643 <20>Patient died<65>), a record in the Death table should be created with death_type_concept_id = 44818516 (<28>EHR discharge status "Expired").
* PRECEDING_VISIT_ID can be used to link a visit immediately preceding the current visit
* Some EMR systems combine emergency room followed by inpatient admission into one visit, and it is close to impossible to separate the two. To annotate this visit type, a new visit concept <EFBFBD>Emergency Room and Inpatient Visit<69> was added (CONCEPT_ID 262).
* Some EMR systems combine emergency room followed by inpatient admission into one visit, and it is close to impossible to separate the two. To annotate this visit type, a new visit concept "Emergency Room and Inpatient Visit" was added (CONCEPT_ID 262).

View File

@ -0,0 +1,15 @@
The METADATA table contains metadata information about a dataset that has been transformed to the OMOP Common Data Model.
Field |Required |Type |Description
:------------------------------|:--------|:------------|:-----------------------------------------
|metadata_concept_id |Yes |integer |A foreign key that refers to a Standard Metadata Concept identifier in the Standardized Vocabularies.|
|metadata_type_concept_id |Yes |integer |A foreign key that refers to a Standard Type Concept identifier in the Standardized Vocabularies.|
|name |Yes |varchar(250) |The name of the Concept stored in metadata_concept_id or a description of the data being stored.|
|value_as_string |No |nvarchar |The metadata value stored as a string.|
|value_as_concept_id |No |integer |A foreign key to a metadata value stored as a Concept ID.|
|metadata date |No |date |The date associated with the metadata|
|metadata_datetime |No |datetime |The date and time associated with the metadata|
### Conventions
*

View File

@ -4,9 +4,9 @@ Field|Required|Type|Description
:-------------------------|:--------|:-----|:--------------------------------------
|attribute_definition_id|Yes|integer|A unique identifier for each Attribute.|
|attribute_name|Yes|varchar(255)|A short description of the Attribute.|
|attribute_description|No|CLOB|A complete description of the Attribute definition|
|attribute_description|No|varchar(MAX)|A complete description of the Attribute definition|
|attribute_type_concept_id|Yes|integer|Type defining what kind of Attribute Definition the record represents and how the syntax may be executed|
|attribute_syntax|No|CLOB|Syntax or code to operationalize the Attribute definition|
|attribute_syntax|No|varchar(MAX)|Syntax or code to operationalize the Attribute definition|
### Conventions

View File

@ -4,9 +4,9 @@ Field|Required|Type|Description
:------------------------------|:--------|:-----|:-----------------------------------------------
|cohort_definition_id|Yes|integer|A unique identifier for each Cohort.|
|cohort_definition_name|Yes|varchar(255)|A short description of the Cohort.|
|cohort_definition_description|No|CLOB|A complete description of the Cohort definition|
|cohort_definition_description|No|varchar(MAX)|A complete description of the Cohort definition|
|definition_type_concept_id|Yes|integer|Type defining what kind of Cohort Definition the record represents and how the syntax may be executed|
|cohort_definition_syntax|No|CLOB|Syntax or code to operationalize the Cohort definition|
|cohort_definition_syntax|No|varchar(MAX)|Syntax or code to operationalize the Cohort definition|
|subject_concept_id|Yes|integer|A foreign key to the Concept to which defines the domain of subjects that are members of the cohort (e.g., Person, Provider, Visit).|
|cohort_instantiation_date|No|Date|A date to indicate when the Cohort was instantiated in the COHORT table|

View File

@ -4,8 +4,8 @@ Field|Required|Type|Description
:-------------------------|:--------|:------------|:----------------------------
|source_code|Yes|varchar(50)|The source code being translated into a Standard Concept.|
|source_concept_id|Yes|integer|A foreign key to the Source Concept that is being translated into a Standard Concept.|
|source_vocabulary_id|No|varchar(20)|A foreign key to the VOCABULARY table defining the vocabulary of the source code that is being translated to a Standard Concept.|
|source_code_description|Yes|varchar(255)|An optional description for the source code. This is included as a convenience to compare the description of the source code to the name of the concept.|
|source_vocabulary_id|Yes|varchar(20)|A foreign key to the VOCABULARY table defining the vocabulary of the source code that is being translated to a Standard Concept.|
|source_code_description|No|varchar(255)|An optional description for the source code. This is included as a convenience to compare the description of the source code to the name of the concept.|
|target_concept_id|Yes|integer|A foreign key to the target Concept to which the source code is being mapped.|
|target_vocabulary_id|Yes|varchar(20)|A foreign key to the VOCABULARY table defining the vocabulary of the target Concept.|
|valid_start_date|Yes|date|The date when the mapping instance was first recorded.|

View File

@ -1,24 +1,3 @@
names(inds) <-conceptSetIds[[1]]
conceptSetIds
inds <- lapply(conceptSetIds[[2]], getConcepts)
dir <- "\\wprdusmj12rcz\Epi\Mood_Haliperidol\project390\"
dir <- "S:Epi\Mood_Haliperidol\project390\"
dir <- "S:Epi/Mood_Haliperidol/project390/"
inds <- lapply(conceptSetIds[[2]], getConcepts)
inds
names(inds) <-conceptSetIds[[1]]
getConcepts <- function(conceptSetIdentifiers) {
results <- list()
length(results) <- length(conceptSetIdentifiers)
ind <- 0
for (conceptSetIdentifier in conceptSetIdentifiers){
ind <- ind+1
# get the concept set expression from the webapi
conceptSetExpressionUrl = paste("http://hix.jnj.com:8080/WebAPI/conceptset/", conceptSetIdentifier, "/expression", sep = "")
## http://hix.jnj.com:8080/WebAPI/VOCAB/vocabulary/lookup/mapped
expression <- httr::content(httr::GET(conceptSetExpressionUrl),"text")
result <- RJSONIO::fromJSON(expression)
concepts <- t(as.data.frame(lapply(result[[1]], function(x) c(x$concept$CONCEPT_ID,
x$concept$CONCEPT_CODE,
x$concept$CONCEPT_NAME,
x$concept$VOCABULARY_ID,
@ -510,3 +489,24 @@ rmarkdown::render('report.Rmd')
rmarkdown::render('report.Rmd')
rmarkdown::render('report.Rmd')
rmarkdown::render('report.Rmd')
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
install.packages("rmarkdown")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "../../../OMOP_CDM_v5_2.pdf")
rmarkdown::render(input = "OMOP_CDM_PDF.Rmd", output_format = "pdf_document", output_file = "../../OMOP_CDM_v5_2.pdf")