Skip to content

Instantly share code, notes, and snippets.

@kaicode
Created November 14, 2019 12:01
Show Gist options
  • Save kaicode/6dfaeb9cb272020d677e9be7c91e75b3 to your computer and use it in GitHub Desktop.
Save kaicode/6dfaeb9cb272020d677e9be7c91e75b3 to your computer and use it in GitHub Desktop.
library(httr)
library(jsonlite)
# ECL examples here https://confluence.ihtsdotools.org/display/DOCECL/6.+Examples
# Can test them in the browser here:
ecl <- "< 404684003 |Clinical finding|:
363698007 |Finding site| = << 39057004 |Pulmonary valve structure|,
116676008 |Associated morphology| = << 415582006 |Stenosis|"
path <- "https://browser.ihtsdotools.org/snowstorm/snomed-ct/v2/MAIN/SNOMEDCT-GB/concepts?limit=10000&ecl=$ecl"
path
r <- GET(url = path)
status_code(r)
str(content(r))
r <- content(r, as = "text", encoding = "UTF-8")
df <- fromJSON(r,flatten = TRUE)
df
colnames(df$items)
df$items$conceptId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment