### Install Eunomia Package Source: https://github.com/ohdsi/eunomia/blob/main/docs/index.html Use this command to install the Eunomia package from CRAN. Ensure R and Java are configured as per the Hades setup instructions. ```r install.packages("Eunomia") ``` -------------------------------- ### Connect to Eunomia Sample Dataset and Query Source: https://github.com/ohdsi/eunomia/blob/main/docs/index.html This snippet demonstrates how to get Eunomia connection details, establish a connection, execute a SQL query to count records in the 'person' table, retrieve table names, and disconnect. ```r library(Eunomia) connectionDetails <- getEunomiaConnectionDetails() connection <- connect(connectionDetails) querySql(connection, "SELECT COUNT(*) FROM person;") # COUNT(*) #1 2694 getTableNames(connection,databaseSchema = 'main') disconnect(connection) ``` -------------------------------- ### Example of Extracting and Loading Data Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/extractLoadData.html This example demonstrates how to use the extractLoadData function to extract data from a specified .ZIP file. The data will be loaded into a database file in the same directory. ```r if (FALSE) { # \dontrun{ extractLoadData("c:/strategusData/GiBleed_5.3.zip") } # } ``` -------------------------------- ### Get Default Eunomia Connection Details Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/getEunomiaConnectionDetails.html This function creates a copy of the default Eunomia database. It returns a ConnectionDetails object compatible with the DatabaseConnector package. By default, it creates a temporary SQLite file that is deleted at the end of the R session. ```r getEunomiaConnectionDetails( databaseFile = tempfile(fileext = ".sqlite"), dbms = "sqlite", overwrite = FALSE ) ``` -------------------------------- ### getDatabaseFile Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/getDatabaseFile.html Creates a copy of a Eunomia database, and returns the path to the new database file. If the dataset does not yet exist on the user's computer it will attempt to download the source data to the the path defined by the EUNOMIA_DATA_FOLDER environment variable. ```APIDOC ## getDatabaseFile ### Description Creates a copy of a Eunomia database, and returns the path to the new database file. If the dataset does not yet exist on the user's computer it will attempt to download the source data to the the path defined by the EUNOMIA_DATA_FOLDER environment variable. ### Usage ```R getDatabaseFile( datasetName, cdmVersion = "5.3", pathToData = Sys.getenv("EUNOMIA_DATA_FOLDER"), dbms = "sqlite", databaseFile = tempfile(fileext = paste0(".", dbms)), inputFormat = "csv", verbose = FALSE, overwrite = TRUE ) ``` ### Arguments * **datasetName** - The data set name as found on https://github.com/OHDSI/EunomiaDatasets. The data set name corresponds to the folder with the data set ZIP files * **cdmVersion** - The OMOP CDM version. This version will appear in the suffix of the data file, for example: _.zip. Default: '5.3' * **pathToData** - The path where the Eunomia data is stored on the file system., By default the value of the environment variable "EUNOMIA_DATA_FOLDER" is used. * **dbms** - The database system to use. "sqlite" (default) or "duckdb" * **databaseFile** - The path where the database file will be copied to. By default, the database will be copied to a temporary folder, and will be deleted at the end of the R session. * **inputFormat** - The format of the files expected in the archive. (csv or parquet) * **verbose** - Provide additional logging details during execution * **overwrite** - Remove and replace an existing data set. ### Value The file path to the new Eunomia dataset copy ### Examples ```R if (FALSE) { # \dontrun{ conn <- DBI::dbConnect(RSQLite::SQLite(), getDatabaseFile("GiBleed")) DBI::dbDisconnect(conn) conn <- DBI::dbConnect(duckdb::duckdb(), getDatabaseFile("GiBleed", dbms = "duckdb")) DBI::dbDisconnect(conn, shutdown = TRUE) conn <- DatabaseConnector::connect(dbms = "sqlite", server = getDatabaseFile("GiBleed")) DatabaseConnector::disconnect(conn) } # } ``` ``` -------------------------------- ### getConnectionDetails Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/getConnectionDetails.html Creates a copy of the default Eunomia database and provides connection details for that copy. This function ensures compatibility with previous Eunomia releases. ```APIDOC ## getConnectionDetails ### Description Creates a copy of the default (GiBleed) Eunomia database, and provides details for connecting to that copy. Function provides backwards compatibility to prior releases of Eunomia default (GiBleed) dataset. ### Function Signature getConnectionDetails( datasetName, cdmVersion = "5.3", pathToData = Sys.getenv("EUNOMIA_DATA_FOLDER"), dbms = "sqlite", autoDownload = TRUE ) ### Parameters #### Arguments - **datasetName** (string) - The data set name as found on https://github.com/OHDSI/EunomiaDatasets. The data set name corresponds to the folder with the data set ZIP files. - **cdmVersion** (string) - The OMOP CDM version. This version will appear in the suffix of the data file, for example: _.zip. Default: '5.3'. - **pathToData** (string) - The path where the Eunomia data is stored on the file system. By default the value of the environment variable "EUNOMIA_DATA_FOLDER" is used. - **dbms** (string) - The DBMS to create a connection details object to support. Default is sqlite. - **autoDownload** (boolean) - Controls if the CDM zip archive is automatically downloaded if the data is not currently available. ### Value A ConnectionDetails object, to be used with the `DatabaseConnector` package. ``` -------------------------------- ### Connect to SQLite Database Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/getDatabaseFile.html Connects to a SQLite database copy of the 'GiBleed' Eunomia dataset. The database file is automatically managed by the function. ```r conn <- DBI::dbConnect(RSQLite::SQLite(), getDatabaseFile("GiBleed")) DBI::dbDisconnect(conn) ``` -------------------------------- ### getDatabaseFile() Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/index.html Creates a copy of a Eunomia dataset. This function allows for duplication of existing datasets within the Eunomia environment. ```APIDOC ## getDatabaseFile() ### Description Create a copy of a Eunomia dataset. ### Method Not applicable (R function) ### Endpoint Not applicable (R function) ### Parameters This function does not explicitly list parameters in the provided documentation. ### Request Example Not applicable (R function) ### Response Not applicable (R function) ``` -------------------------------- ### Connect using DatabaseConnector Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/getDatabaseFile.html Connects to a SQLite database copy of the 'GiBleed' Eunomia dataset using the DatabaseConnector package. The connection is then disconnected. ```r conn <- DatabaseConnector::connect(dbms = "sqlite", server = getDatabaseFile("GiBleed")) DatabaseConnector::disconnect(conn) ``` -------------------------------- ### Check Java Version Support Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/supportsJava8.html Use this function to verify if the current Java virtual machine meets the minimum version requirement of Java 8. It checks the `java.version` system property. ```r supportsJava8() ``` -------------------------------- ### loadDataFiles() Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/index.html Loads data files into a specified database (SQLite or DuckDB). This function is used to populate a database with data from Eunomia files. ```APIDOC ## loadDataFiles() ### Description Load data files into a database(sqlite or duckdb). ### Method Not applicable (R function) ### Endpoint Not applicable (R function) ### Parameters This function does not explicitly list parameters in the provided documentation. ### Request Example Not applicable (R function) ### Response Not applicable (R function) ``` -------------------------------- ### extractLoadData() Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/index.html Extracts Eunomia data files from a .ZIP archive and loads them into a new OMOP CDM database. The database is stored in the same directory as the .ZIP file. ```APIDOC ## extractLoadData() ### Description Extract the Eunomia data files and load into a database Extract files from a .ZIP file and creates a OMOP CDM database that is then stored in the same directory as the .ZIP file. ### Method Not applicable (R function) ### Endpoint Not applicable (R function) ### Parameters This function does not explicitly list parameters in the provided documentation. ### Request Example Not applicable (R function) ### Response Not applicable (R function) ``` -------------------------------- ### getEunomiaConnectionDetails Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/getEunomiaConnectionDetails.html Creates a copy of the default Eunomia database and returns connection details for it. This function ensures backward compatibility with previous versions of the Eunomia default dataset. ```APIDOC ## getEunomiaConnectionDetails ### Description Creates a copy of the default (GiBleed) Eunomia database, and provides details for connecting to that copy. Function provides backwards compatibility to prior releases of Eunomia default (GiBleed) dataset. ### Usage ```R getEunomiaConnectionDetails( databaseFile = tempfile(fileext = ".sqlite"), dbms = "sqlite", overwrite = FALSE ) ``` ### Arguments #### `databaseFile` The path where the database file will be copied to. By default, the database will be copied to a temporary folder, and will be deleted at the end of the R session. #### `dbms` The target dialect, by default "sqlite". #### `overwrite` Control whether the existing archive file will be overwritten should it already exist. ### Value A ConnectionDetails object, to be used with the `DatabaseConnector` package. ``` -------------------------------- ### downloadEunomiaData Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/downloadEunomiaData.html Downloads specified Eunomia data files from a GitHub repository. It allows for specifying the dataset name, CDM version, download path, and overwrite behavior. ```APIDOC ## downloadEunomiaData ### Description Downloads specified Eunomia data files from a GitHub repository. It allows for specifying the dataset name, CDM version, download path, and overwrite behavior. ### Usage ```R downloadEunomiaData( datasetName, cdmVersion = "5.3", pathToData = Sys.getenv("EUNOMIA_DATA_FOLDER"), overwrite = FALSE, verbose = FALSE ) ``` ### Arguments * **datasetName** (string) - Required - The data set name as found on https://github.com/OHDSI/EunomiaDatasets. The data set name corresponds to the folder with the data set ZIP files. * **cdmVersion** (string) - Optional - The OMOP CDM version. This version will appear in the suffix of the data file, for example: _.zip. Default: '5.3'. * **pathToData** (string) - Optional - The path where the Eunomia data is stored on the file system. By default the value of the environment variable "EUNOMIA_DATA_FOLDER" is used. * **overwrite** (boolean) - Optional - Control whether the existing archive file will be overwritten should it already exist. * **verbose** (boolean) - Optional - Provide additional logging details during execution. ### Value Invisibly returns the destination if the download was successful. ### Examples ```R if (FALSE) { # \dontrun{ downloadEunomiaData("GiBleed") } # } ``` ``` -------------------------------- ### Connect to DuckDB Database Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/getDatabaseFile.html Connects to a DuckDB database copy of the 'GiBleed' Eunomia dataset, specifying the 'duckdb' DBMS. The database connection is shut down after use. ```r conn <- DBI::dbConnect(duckdb::duckdb(), getDatabaseFile("GiBleed", dbms = "duckdb")) DBI::dbDisconnect(conn, shutdown = TRUE) ``` -------------------------------- ### Download Eunomia Data Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/downloadEunomiaData.html Use this function to download specified Eunomia datasets. It supports specifying the CDM version, download path, and whether to overwrite existing files. Ensure the dataset name corresponds to a folder on the EunomiaDatasets GitHub repository. ```r downloadEunomiaData( datasetName, cdmVersion = "5.3", pathToData = Sys.getenv("EUNOMIA_DATA_FOLDER"), overwrite = FALSE, verbose = FALSE ) ``` ```r if (FALSE) { # \dontrun{ downloadEunomiaData("GiBleed") } # } ``` -------------------------------- ### loadDataFiles Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/loadDataFiles.html Loads data from CSV or Parquet files into a specified database file (SQLite or DuckDB). This function is useful for preparing CDM data for analysis within the Eunomia environment. ```APIDOC ## Function: loadDataFiles ### Description Loads data from CDM source files (CSV or Parquet) into a local database file (SQLite or DuckDB). ### Usage ```R loadDataFiles( dataPath, dbPath, inputFormat = "csv", cdmVersion = "5.3", cdmDatabaseSchema = "main", dbms = "sqlite", verbose = FALSE, overwrite = FALSE ) ``` ### Arguments * **dataPath** (string) - Required - The path to the directory containing CDM source files (csv or parquet). * **dbPath** (string) - Required - The path to the .sqlite or .duckdb file that will be created. * **inputFormat** (string) - Optional - The input format of the files to load. Supported formats include csv, parquet. Defaults to "csv". * **cdmVersion** (string) - Optional - The CDM version to create in the resulting database. Supported versions are 5.3 and 5.4. Defaults to "5.3". * **cdmDatabaseSchema** (string) - Optional - The schema in which to create the CDM tables. Defaults to "main". * **dbms** (string) - Optional - The file-based database system to use: 'sqlite' (default) or 'duckdb'. Defaults to "sqlite". * **verbose** (boolean) - Optional - Provide additional logging details during execution. Defaults to FALSE. * **overwrite** (boolean) - Optional - Remove and replace an existing data set. Defaults to FALSE. ### Value No return value, loads data into database file. ``` -------------------------------- ### downloadEunomiaData() Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/index.html Downloads Eunomia data files. This function facilitates the retrieval of necessary data files for use with the Eunomia package. ```APIDOC ## downloadEunomiaData() ### Description Download Eunomia data files. ### Method Not applicable (R function) ### Endpoint Not applicable (R function) ### Parameters This function does not explicitly list parameters in the provided documentation. ### Request Example Not applicable (R function) ### Response Not applicable (R function) ``` -------------------------------- ### extractLoadData Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/extractLoadData.html Extracts data files from a .ZIP archive and creates an OMOP CDM database. The database is stored in the same directory as the .ZIP file. ```APIDOC ## extractLoadData ### Description Extracts data files from a .ZIP archive and creates an OMOP CDM database. The database is stored in the same directory as the .ZIP file. ### Usage ```R extractLoadData(from, to, dbms = "sqlite", cdmVersion = "5.3", inputFormat = "csv", verbose = FALSE) ``` ### Arguments * **from** (string) - The path to the .ZIP file that contains the csv CDM source files * **to** (string) - The path to the .sqlite or .duckdb file that will be created * **dbms** (string) - The file based database system to use: 'sqlite' (default) or 'duckdb' * **cdmVersion** (string) - The version of the OMOP CDM that are represented in the archive files. * **inputFormat** (string) - The format of the files expected in the archive. (csv or parquet) * **verbose** (boolean) - Provide additional logging details during execution. ### Value No return value, called to load archive into a database file. ### Examples ```R # \dontrun{ extractLoadData("c:/strategusData/GiBleed_5.3.zip") # } ``` ``` -------------------------------- ### Export Eunomia Database to CSV Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/exportToCsv.html Use this function to write the Eunomia database contents to CSV files. The output folder defaults to a 'csv' subdirectory in the current working directory. Ensure you have the necessary connection details for the Eunomia database. ```r exportToCsv( outputFolder = file.path(getwd(), "csv"), connectionDetails = getEunomiaConnectionDetails() ) ``` -------------------------------- ### getEunomiaConnectionDetails() Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/index.html Retrieves the default connection details for Eunomia. This function provides the necessary information to establish a connection to the Eunomia database. ```APIDOC ## getEunomiaConnectionDetails() ### Description Get Default Eunomia Connection Details. ### Method Not applicable (R function) ### Endpoint Not applicable (R function) ### Parameters This function does not explicitly list parameters in the provided documentation. ### Request Example Not applicable (R function) ### Response Not applicable (R function) ``` -------------------------------- ### Extract and Load Data Function Usage Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/extractLoadData.html This shows the basic usage of the extractLoadData function. It requires the path to the .ZIP file containing the CDM source files. The function creates an OMOP CDM database in the specified location. ```r extractLoadData( from, to, dbms = "sqlite", cdmVersion = "5.3", inputFormat = "csv", verbose = FALSE ) ``` -------------------------------- ### createCohorts Function Signature Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/createCohorts.html This is the usage signature for the createCohorts function. It outlines the function's parameters and their default values. ```r createCohorts( connectionDetails, cdmDatabaseSchema = "main", cohortDatabaseSchema = "main", cohortTable = "cohort" ) ``` -------------------------------- ### Load Data Files Function Signature Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/loadDataFiles.html This is the function signature for loadDataFiles, detailing its parameters and their default values. Use this to understand how to call the function. ```R loadDataFiles( dataPath, dbPath, inputFormat = "csv", cdmVersion = "5.3", cdmDatabaseSchema = "main", dbms = "sqlite", verbose = FALSE, overwrite = FALSE ) ``` -------------------------------- ### exportDataFiles() Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/index.html Exports data files from a specified database (SQLite or DuckDB). This function is useful for extracting processed data from the Eunomia environment. ```APIDOC ## exportDataFiles() ### Description Export data files from a database(sqlite or duckdb). ### Method Not applicable (R function) ### Endpoint Not applicable (R function) ### Parameters This function does not explicitly list parameters in the provided documentation. ### Request Example Not applicable (R function) ### Response Not applicable (R function) ``` -------------------------------- ### createCohorts() Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/index.html Constructs cohorts based on specified criteria. This function is a core component for defining and generating patient cohorts within the Eunomia framework. ```APIDOC ## createCohorts() ### Description Constructs cohorts. ### Method Not applicable (R function) ### Endpoint Not applicable (R function) ### Parameters This function does not explicitly list parameters in the provided documentation. ### Request Example Not applicable (R function) ### Response Not applicable (R function) ``` -------------------------------- ### getConnectionDetails Function Signature Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/getConnectionDetails.html This is the function signature for getConnectionDetails. It outlines the available parameters and their default values. ```r getConnectionDetails( datasetName, cdmVersion = "5.3", pathToData = Sys.getenv("EUNOMIA_DATA_FOLDER"), dbms = "sqlite", autoDownload = TRUE ) ``` -------------------------------- ### createCohorts Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/createCohorts.html Creates a set of predefined cohorts in a cohort table. This function will delete all existing cohorts in the table before creating new ones. ```APIDOC ## createCohorts ### Description Creates a set of predefined cohorts in a cohort table. WARNING: this will delete all existing cohorts in the table! ### Usage ```R createCohorts( connectionDetails, cdmDatabaseSchema = "main", cohortDatabaseSchema = "main", cohortTable = "cohort" ) ``` ### Arguments * `connectionDetails` (object) - The connection details to connect to the (Eunomia) database. * `cdmDatabaseSchema` (string) - Deprecated. The cdm must be created in the main schema. * `cohortDatabaseSchema` (string) - Deprecated. The cohort table will be created in the main schema. * `cohortTable` (string) - Deprecated. Cohort table will be named "cohort". ### Value A data frame listing all created cohorts. ``` -------------------------------- ### exportToCsv Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/exportToCsv.html Extracts the Eunomia database to CSV files. This function writes the contents of the Eunomia database to individual CSV files within a specified output folder. ```APIDOC ## exportToCsv ### Description Extract the Eunomia database to CSV files. This function writes the contents of the Eunomia database to individual CSV files within a specified output folder. ### Method Not applicable (R function) ### Endpoint Not applicable (R function) ### Parameters #### Arguments - **outputFolder** (string) - Required - A folder where the CSV files will be written. - **connectionDetails** (object) - Optional - Connection details for the Eunomia database. Defaults to a fresh Eunomia database. ### Request Example ```R exportToCsv( outputFolder = "/path/to/your/csv/folder", connectionDetails = getEunomiaConnectionDetails() ) ``` ### Response #### Success Response CSV files containing the Eunomia database contents are created in the specified `outputFolder`. #### Response Example No explicit response body, but files are generated. ``` -------------------------------- ### Export Data Files Function Signature Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/exportDataFiles.html This is the function signature for exportDataFiles. It outlines the parameters required for exporting data. ```r exportDataFiles( dbPath, outputFolder, outputFormat = "csv", dbms = "sqlite", verbose = FALSE ) ``` -------------------------------- ### exportDataFiles Source: https://github.com/ohdsi/eunomia/blob/main/docs/reference/exportDataFiles.html Exports data from a specified SQLite or DuckDB database file to CSV or Parquet files in a designated output folder. This function is useful for extracting structured data for further analysis or sharing. ```APIDOC ## exportDataFiles ### Description Exports data from a specified SQLite or DuckDB database file to CSV or Parquet files in a designated output folder. This function is useful for extracting structured data for further analysis or sharing. ### Function Signature ```R exportDataFiles(dbPath, outputFolder, outputFormat = "csv", dbms = "sqlite", verbose = FALSE) ``` ### Parameters #### Arguments - **dbPath** (string) - Required - The path to the source .sqlite or .duckdb file. - **outputFolder** (string) - Required - The path to the export destination directory. - **outputFormat** (string) - Optional - The output format for the files. Supported formats include csv, parquet. Defaults to "csv". - **dbms** (string) - Optional - The file-based database system to use: 'sqlite' (default) or 'duckdb'. Defaults to "sqlite". - **verbose** (boolean) - Optional - Boolean argument controlling verbose debugging output. Defaults to FALSE. ### Value No return value. The function's effect is the creation of files in the specified `outputFolder`. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.