From d896895ffdf8132927cca5fea29fdceeb9aa0031 Mon Sep 17 00:00:00 2001 From: catalamarti Date: Fri, 21 Jun 2024 11:04:07 +0100 Subject: [PATCH] edit readme --- README.Rmd | 2 +- README.md | 596 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 593 insertions(+), 5 deletions(-) diff --git a/README.Rmd b/README.Rmd index 43234ed..2a8e9a0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -52,7 +52,7 @@ We can characterise the drug_exposure table: ```{r} library(OmopSketch) -result <- summariseOmopTable() +result <- summariseOmopTable(cdm$drug_exposure) result |> glimpse() ``` diff --git a/README.md b/README.md index fc74851..a164adf 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,24 @@ -# OmopSketch +# OmopSketch OmopSketch website +[![Lifecycle: +experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/oxford-pharmacoepi/OmopSketch/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/oxford-pharmacoepi/OmopSketch/actions/workflows/R-CMD-check.yaml) +[![CRAN +status](https://www.r-pkg.org/badges/version/OmopSketch)](https://CRAN.R-project.org/package=OmopSketch) +[![Codecov test +coverage](https://codecov.io/gh/oxford-pharmacoepi/OmopSketch/branch/main/graph/badge.svg)](https://app.codecov.io/gh/oxford-pharmacoepi/OmopSketch?branch=main) -The goal of OmopSketch is to provide context to your OMOP-mapped database. +### WARNING: this package is under-development +The goal of OmopSketch is to characterise and visualise an OMOP CDM +instance to asses if it meets the necessary criteria to answer a +specific clinical question and conduct a certain study. ## Installation @@ -17,7 +26,586 @@ You can install the development version of OmopSketch from [GitHub](https://github.com/) with: ``` r -install.packages("devtools") -devtools::install_github("oxford-pharmacoepi/OmopSketch") +# install.packages("remotes") +remotes::install_github("oxford-pharmacoepi/OmopSketch") ``` +## Example + +Let’s create a cdm, for this example we will use eunomia: + +``` r +library(duckdb) +#> Loading required package: DBI +library(CDMConnector) +library(dplyr) +#> +#> Attaching package: 'dplyr' +#> The following objects are masked from 'package:stats': +#> +#> filter, lag +#> The following objects are masked from 'package:base': +#> +#> intersect, setdiff, setequal, union +con <- dbConnect(duckdb(), eunomia_dir()) +cdm <- cdmFromCon(con = con, cdmSchema = "main", writeSchema = "main") +cdm +#> +#> ── # OMOP CDM reference (duckdb) of Synthea synthetic health database ────────── +#> • omop tables: person, observation_period, visit_occurrence, visit_detail, +#> condition_occurrence, drug_exposure, procedure_occurrence, device_exposure, +#> measurement, observation, death, note, note_nlp, specimen, fact_relationship, +#> location, care_site, provider, payer_plan_period, cost, drug_era, dose_era, +#> condition_era, metadata, cdm_source, concept, vocabulary, domain, +#> concept_class, concept_relationship, relationship, concept_synonym, +#> concept_ancestor, source_to_concept_map, drug_strength +#> • cohort tables: - +#> • achilles tables: - +#> • other tables: - +``` + +We can characterise the drug_exposure table: + +``` r +library(OmopSketch) +result <- summariseOmopTable(cdm$drug_exposure) +#> ℹ Summarising counts +#> ℹ Summarising records per person +#> ℹ Summarising concepts +result |> glimpse() +#> Rows: 22 +#> Columns: 13 +#> $ result_id 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,… +#> $ cdm_name "Synthea synthetic health database", "Synthea synthet… +#> $ group_name "omop_table", "omop_table", "omop_table", "omop_table… +#> $ group_level "drug_exposure", "drug_exposure", "drug_exposure", "d… +#> $ strata_name "overall", "overall", "overall", "overall", "overall"… +#> $ strata_level "overall", "overall", "overall", "overall", "overall"… +#> $ variable_name "Number of subjects", "Number of records", "Number of… +#> $ variable_level NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "No", "No", "… +#> $ estimate_name "count", "count", "percentage", "mean", "sd", "median… +#> $ estimate_type "integer", "integer", "percentage", "numeric", "numer… +#> $ estimate_value "2694", "67707", "100", "25.1325167037862", "5.245679… +#> $ additional_name "overall", "overall", "overall", "overall", "overall"… +#> $ additional_level "overall", "overall", "overall", "overall", "overall"… +``` + +We can create a visualisation of this table: + +``` r +tableOmopTable(result) +``` + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableLevelEstimate + cdm_name +
Synthea synthetic health database
drug_exposure
Number of subjects-N (%)2,694 (100.0%)
Number of records-N67,707
Records per person-median [IQR]25 [22 - 28]
mean (sd)25.13 (5.25)
In observationNoN (%)251 (0.4%)
YesN (%)67,456 (99.6%)
Standard conceptStandardN (%)67,707 (100.0%)
DomainDrugN (%)67,707 (100.0%)
Type concept idPrescription written (38000177)N (%)41,997 (62.0%)
Dispensed in Outpatient office (581452)N (%)25,710 (38.0%)
+