From 2c3c42fb1c1fbb4a73db9aa497683c7a3fcf5d9b Mon Sep 17 00:00:00 2001 From: Andryc Date: Wed, 18 Aug 2021 12:19:04 -0400 Subject: [PATCH 1/3] update to metadata table - issue 202 --- inst/csv/OMOP_CDMv5.4_Field_Level.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inst/csv/OMOP_CDMv5.4_Field_Level.csv b/inst/csv/OMOP_CDMv5.4_Field_Level.csv index 203a04f..8db0962 100644 --- a/inst/csv/OMOP_CDMv5.4_Field_Level.csv +++ b/inst/csv/OMOP_CDMv5.4_Field_Level.csv @@ -359,11 +359,13 @@ Condition.",,No,No,,,,, CONDITION_ERA,condition_occurrence_count,No,integer,"The number of individual Condition Occurrences used to construct the condition era.",,No,No,,,,, +METADATA,metadata_id,Yes,integer,The unique key given to a Metadata record.,Attribute value is auto-generated,Yes,No,,,,, METADATA,metadata_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,, METADATA,metadata_type_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,, METADATA,name,Yes,varchar(250),,,No,No,,,,, METADATA,value_as_string,No,varchar(250),,,No,No,,,,, METADATA,value_as_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,, +METADATA,value_as_number,No,float,"This is the numerical value of the Result of the Metadata, if applicable and available. It is not expected that all Metadata will have numeric results, rather, this field is here to house values should they exist. ",,No,No,,,,, METADATA,metadata_date,No,date,,,No,No,,,,, METADATA,metadata_datetime,No,datetime,,,No,No,,,,, CDM_SOURCE,cdm_source_name,Yes,varchar(255),The name of the CDM instance.,,No,No,,,,, From 4be728e9d8cdcf32ee5bf2738c15425356eb671a Mon Sep 17 00:00:00 2001 From: Andryc Date: Thu, 19 Aug 2021 12:20:49 -0400 Subject: [PATCH 2/3] Updates to yml and cdm531.Rmd --- rmd/cdm53.Rmd | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++ rmd/cdm54.Rmd | 107 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 rmd/cdm53.Rmd create mode 100644 rmd/cdm54.Rmd diff --git a/rmd/cdm53.Rmd b/rmd/cdm53.Rmd new file mode 100644 index 0000000..e7d234b --- /dev/null +++ b/rmd/cdm53.Rmd @@ -0,0 +1,109 @@ +--- +output: + # pdf_document: + # toc: yes + # toc_depth: '5' + html_document: + toc: yes + toc_depth: 5 + toc_float: yes +--- + +```{r setup, include=FALSE, eval=TRUE} + +#todo figure out how to get the document dynamically without specifying the name +library(rmarkdown) +library(knitr) +library(kableExtra) +library(magrittr) +library(dplyr) +library(stringr) + +``` + +# **OMOP CDM v5.3** + +Below is the specification document for the OMOP Common Data Model, v5.3 (previously v5.3.1). Each table is represented with a high-level description and ETL conventions that should be followed. This is continued with a discussion of each field in each table, any conventions related to the field, and constraints that should be followed (like primary key, foreign key, etc). Should you have questions please feel free to visit the [forums](https://forums.ohdsi.org/) or the [github issue](https://github.com/ohdsi/CommonDataModel/issues) page. + +*__Special Note__ This documentation previously referenced v5.3.1. During the OHDSI/CommonDataModel Hack-A-Thon that occurred on August 18, 2021 the decision was made to align documentation with the minor releases. Hot fixes and minor.minor release can be found through the searching of tags.* + +--after regeneration of DDLs +link to csv of cdm +link to pdf of cdm documentation +link to forum on doc page + +```{r docLoop53, echo=FALSE, results='asis'} +tableSpecs <- read.csv("../inst/csv/OMOP_CDMv5.3_Table_Level.csv", stringsAsFactors = FALSE) +cdmSpecs <- read.csv("../inst/csv/OMOP_CDMv5.3_Field_Level.csv", stringsAsFactors = FALSE) + +tables <- tableSpecs$cdmTableName + +cdmSpecsClean <- cdmSpecs %>% + dplyr::select(`CDM Table` = cdmTableName, + `CDM Field` = cdmFieldName, + `User Guide` = userGuidance, + `ETL Conventions` = etlConventions, + `Datatype` = cdmDatatype, + `Required` = isRequired, + `Primary Key` = isPrimaryKey, + `Foreign Key` = isForeignKey, + `FK Table` = fkTableName, + `FK Domain` = fkDomain + ) + +cdmSpecsClean[is.na(cdmSpecsClean)] <- "" + +for(tb in tables) { + + if(tb == 'PERSON'){ + cat("## **Clinical Data Tables**\n\n") + } + + if(tb == 'LOCATION'){ + cat("## **Health System Data Tables**\n\n") + } + + if(tb == 'PAYER_PLAN_PERIOD'){ + cat("## **Health Economics Data Tables**\n\n") + } + + if(tb == 'DRUG_ERA'){ + cat("## **Standardized Derived Elements**\n\n") + } + + if(tb == 'METADATA'){ + cat("## **Metadata Tables**\n\n") + } + if(tb == 'CONCEPT'){ + cat("## **Vocabulary Tables**\n\n") + } + + cat("###", tb, "{.tabset .tabset-pills} \n\n") + + tableInfo <- subset(tableSpecs, cdmTableName == tb) + cat("**Table Description**\n\n",tableInfo[,"tableDescription"], "\n\n") + + if(!isTRUE(tableInfo[,"userGuidance"]=="")){ + cat("**User Guide**\n\n",tableInfo[,"userGuidance"],"\n\n") + } + + if(!isTRUE(tableInfo[,"etlConventions"]=="")){ + cat("**ETL Conventions**\n\n",tableInfo[,"etlConventions"],"\n\n") + } + + loopTable <- subset(cdmSpecsClean, `CDM Table` == tb) + loopTable <- subset(loopTable, select = -c(1)) + + print(kable(x = loopTable, align = "l", row.names = FALSE, format = "html", escape = FALSE) %>% + column_spec(1, bold = T) %>% + column_spec(2, width = "3in", include_thead = T) %>% + column_spec(3, width = "4in", include_thead = T) %>% + column_spec(4:9, width = "1in", include_thead = T) %>% + kable_styling(c("condensed","hover"), position = "center", full_width = T, font_size = 13)) + + + } + + + +``` diff --git a/rmd/cdm54.Rmd b/rmd/cdm54.Rmd new file mode 100644 index 0000000..2cbcfda --- /dev/null +++ b/rmd/cdm54.Rmd @@ -0,0 +1,107 @@ +--- +output: + # pdf_document: + # toc: yes + # toc_depth: '5' + html_document: + toc: yes + toc_depth: 5 + toc_float: yes +--- + +```{r setup, include=FALSE, eval=TRUE} + +#todo figure out how to get the document dynamically without specifying the name +library(rmarkdown) +library(knitr) +library(kableExtra) +library(magrittr) +library(dplyr) +library(stringr) + +``` + +# **OMOP CDM v5.4** + +Below is the specification document for the OMOP Common Data Model, v5.4. Each table is represented with a high-level description and ETL conventions that should be followed. This is continued with a discussion of each field in each table, any conventions related to the field, and constraints that should be followed (like primary key, foreign key, etc). Should you have questions please feel free to visit the [forums](https://forums.ohdsi.org/) or the [github issue](https://github.com/ohdsi/CommonDataModel/issues) page. + +--after regeneration of DDLs +link to csv of cdm +link to pdf of cdm documentation +link to forum on doc page + +```{r docLoop53, echo=FALSE, results='asis'} +tableSpecs <- read.csv("../inst/csv/OMOP_CDMv5.4_Table_Level.csv", stringsAsFactors = FALSE) +cdmSpecs <- read.csv("../inst/csv/OMOP_CDMv5.4_Field_Level.csv", stringsAsFactors = FALSE) + +tables <- tableSpecs$cdmTableName + +cdmSpecsClean <- cdmSpecs %>% + dplyr::select(`CDM Table` = cdmTableName, + `CDM Field` = cdmFieldName, + `User Guide` = userGuidance, + `ETL Conventions` = etlConventions, + `Datatype` = cdmDatatype, + `Required` = isRequired, + `Primary Key` = isPrimaryKey, + `Foreign Key` = isForeignKey, + `FK Table` = fkTableName, + `FK Domain` = fkDomain + ) + +cdmSpecsClean[is.na(cdmSpecsClean)] <- "" + +for(tb in tables) { + + if(tb == 'PERSON'){ + cat("## **Clinical Data Tables**\n\n") + } + + if(tb == 'LOCATION'){ + cat("## **Health System Data Tables**\n\n") + } + + if(tb == 'PAYER_PLAN_PERIOD'){ + cat("## **Health Economics Data Tables**\n\n") + } + + if(tb == 'DRUG_ERA'){ + cat("## **Standardized Derived Elements**\n\n") + } + + if(tb == 'METADATA'){ + cat("## **Metadata Tables**\n\n") + } + if(tb == 'CONCEPT'){ + cat("## **Vocabulary Tables**\n\n") + } + + cat("###", tb, "{.tabset .tabset-pills} \n\n") + + tableInfo <- subset(tableSpecs, cdmTableName == tb) + cat("**Table Description**\n\n",tableInfo[,"tableDescription"], "\n\n") + + if(!isTRUE(tableInfo[,"userGuidance"]=="")){ + cat("**User Guide**\n\n",tableInfo[,"userGuidance"],"\n\n") + } + + if(!isTRUE(tableInfo[,"etlConventions"]=="")){ + cat("**ETL Conventions**\n\n",tableInfo[,"etlConventions"],"\n\n") + } + + loopTable <- subset(cdmSpecsClean, `CDM Table` == tb) + loopTable <- subset(loopTable, select = -c(1)) + + print(kable(x = loopTable, align = "l", row.names = FALSE, format = "html", escape = FALSE) %>% + column_spec(1, bold = T) %>% + column_spec(2, width = "3in", include_thead = T) %>% + column_spec(3, width = "4in", include_thead = T) %>% + column_spec(4:9, width = "1in", include_thead = T) %>% + kable_styling(c("condensed","hover"), position = "center", full_width = T, font_size = 13)) + + + } + + + +``` From 6414b42f6b9cf07bf86fcbb95156371d92292dcc Mon Sep 17 00:00:00 2001 From: Andryc Date: Thu, 19 Aug 2021 12:46:40 -0400 Subject: [PATCH 3/3] prepping for pull request --- CdmDdlBase.Rproj | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/CdmDdlBase.Rproj b/CdmDdlBase.Rproj index ce013e1..c763d05 100644 --- a/CdmDdlBase.Rproj +++ b/CdmDdlBase.Rproj @@ -1,21 +1,21 @@ -Version: 1.0 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: XeLaTeX - -AutoAppendNewline: Yes -StripTrailingWhitespace: Yes - -BuildType: Package -PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source -PackageRoxygenize: rd,collate,namespace +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: XeLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source +PackageRoxygenize: rd,collate,namespace