GithubHelp home page GithubHelp logo

metforminstudy's Introduction

Metformin study package

Requirements

  • A database in Common Data Model version 5 in one of these platforms: SQL Server, Oracle, PostgreSQL, IBM Netezza, Apache Impala, Amazon RedShift, Google BigQuery, or Microsoft APS.
  • R version 3.5.0 or newer
  • On Windows: RTools
  • Java
  • 25 GB of free disk space

See these instructions on how to set up the R environment on Windows.

How to run

  1. In R, use the following code to install the dependencies:

    install.packages("devtools")
    library(devtools)
    install_github("ohdsi/ParallelLogger", ref = "v1.1.1")
    install_github("ohdsi/SqlRender", ref = "v1.6.3")
    install_github("ohdsi/DatabaseConnector", ref = "v2.4.1")
    install_github("ohdsi/OhdsiSharing", ref = "v0.1.3")
    install_github("ohdsi/FeatureExtraction", ref = "v2.2.5")
    install_github("ohdsi/CohortMethod", ref = "v3.1.0")
    install_github("ohdsi/EmpiricalCalibration", ref = "v2.0.0")
    install_github("ohdsi/MethodEvaluation", ref = "v1.1.0")

    If you experience problems on Windows where rJava can't find Java, one solution may be to add args = "--no-multiarch" to each install_github call, for example:

    install_github("ohdsi/SqlRender", args = "--no-multiarch")

    Alternatively, ensure that you have installed only the 64-bit versions of R and Java, as described in the Book of OHDSI

  2. In R, use the following devtools command to install the Metformin package:

    install() # Note: it is ok to delete inst/doc
  3. Once installed, you can execute the study by modifying and using the code below. For your convenience, this code is also provided under extras/CodeToRun.R:

    library(Metformin)
    
    # Optional: specify where the temporary files (used by the ff package) will be created:
    options(fftempdir = "c:/FFtemp")
    
    # Maximum number of cores to be used:
    maxCores <- parallel::detectCores()
    
    # Minimum cell count when exporting data:
    minCellCount <- 5
    
    # The folder where the study intermediate and result files will be written:
    outputFolder <- "c:/Metformin"
    
    # Details for connecting to the server:
    # See ?DatabaseConnector::createConnectionDetails for help
    connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "postgresql",
    								server = "some.server.com/ohdsi",
    								user = "joe",
    								password = "secret")
    
    # The name of the database schema where the CDM data can be found:
    cdmDatabaseSchema <- "cdm_synpuf"
    
    # The name of the database schema and table where the study-specific cohorts will be instantiated:
    cohortDatabaseSchema <- "scratch.dbo"
    cohortTable <- "my_study_cohorts"
    
    # Some meta-information that will be used by the export function:
    databaseId <- "Synpuf"
    databaseName <- "Medicare Claims Synthetic Public Use Files (SynPUFs)"
    databaseDescription <- "Medicare Claims Synthetic Public Use Files (SynPUFs) were created to allow interested parties to gain familiarity using Medicare claims data while protecting beneficiary privacy. These files are intended to promote development of software and applications that utilize files in this format, train researchers on the use and complexities of Centers for Medicare and Medicaid Services (CMS) claims, and support safe data mining innovations. The SynPUFs were created by combining randomized information from multiple unique beneficiaries and changing variable values. This randomization and combining of beneficiary information ensures privacy of health information."
    
    # For Oracle: define a schema that can be used to emulate temp tables:
    oracleTempSchema <- NULL
    
    execute(connectionDetails = connectionDetails,
            cdmDatabaseSchema = cdmDatabaseSchema,
            cohortDatabaseSchema = cohortDatabaseSchema,
            cohortTable = cohortTable,
            oracleTempSchema = oracleTempSchema,
            outputFolder = outputFolder,
            databaseId = databaseId,
            databaseName = databaseName,
            databaseDescription = databaseDescription,
            createCohorts = TRUE,
            synthesizePositiveControls = TRUE,
            runAnalyses = TRUE,
            runDiagnostics = TRUE,
            packageResults = TRUE,
            maxCores = maxCores)
  4. Upload the file export/Results<DatabaseId>.zip in the output folder to the study coordinator:

    submitResults("export/Results<DatabaseId>.zip", key = "<key>", secret = "<secret>")

    Where key and secret are the credentials provided to you personally by the study coordinator.

  5. To view the results, use the Shiny app:

    prepareForEvidenceExplorer("Result<databaseId>.zip", "/shinyData")
    launchEvidenceExplorer("/shinyData", blind = TRUE)

Note that you can save plots from within the Shiny app. It is possible to view results from more than one database by applying prepareForEvidenceExplorer to the Results file from each database, and using the same data folder. Set blind = FALSE if you wish to be unblinded to the final results.

License

The Metformin package is licensed under Apache License 2.0

Development

Metformin was developed in ATLAS and R Studio.

Development status

Unknown

metforminstudy's People

Contributors

aostropolets avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.