You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

We have written an R package client to the Concept Library API, which allows you to connect and download content directly into data frames in R.

Downloading and installing the R package

External: the package is available on Github and can be installed using the install_github() function in devtools. This will automatically download and install dependencies, like installing from CRAN.

Using devtools to install ConceptLibraryClient from Github
install.packages("devtools");
library(devtools);

install_github("DSThayer/concept-library-client", subdir="ConceptLibraryClient");

Internal: the package is available with other packages we have developed for SAIL users, in R:/r_packages/ConceptLibraryClient. Please run the install.r script to install the package and dependencies.

Getting concepts into data frames

The basic process is: 


Getting concepts
library(ConceptLibraryClient);

#Retrieve the latest version of a concept. You will be prompted for a username and password
copd_icd10 = ConceptLibraryClient::get_concept_codes(
  url='https://conceptlibrary.saildatabank.com',
  id=141
);

#View the retrieved data frame
copd_icd10;

#Set your credentials so you don't have to log in for each command.
credentials = create_auth();

#Get a concept, explicitly specifying a particular version.
copd_icd10_20200602 = get_concept_codes(
  url='https://conceptlibrary.saildatabank.com',
  id=141,
  version=392,
  auth=credentials #Supply username and password
);

#Retrieve multiple concepts into a single data frame
comorbidities_primary_care = get_concept_codes(
  url='https://conceptlibrary.saildatabank.com',
  id=c(140,142,144),
  auth=credentials
);

  • No labels