This package uses pyAnVIL and SMART FHIR python infrastructure to work with FHIR resources in AnVIL.
library(AnvBiocFHIR) allst = list_stores() length(allst) head(allst)
rgru = store_resources(tail(allst)[1]) length(rgru) class(rgru[[1]])
A store has one or more ResearchStudy instances.
sapply(allst[1:4], function(x)length(store_resources(x)))
Methods for an instance.
names(rgru[[1]])
p1 = anv_fhir_test_list_patients(anvurl("phs001272-DS-CSD-MDS")) p1$title length(p1$pats) names(p1$pats[[1]])
There are many available fields, but few are actually populated.
names(p1$pats[[1]]$as_json())
We can dispatch to cluster nodes but must serialize all results before returning. To illustrate we define a function that counts patients (up to 1000, until pagination is straightened out) in a store:
countpats = function (x) { y = anv_fhir_test_list_patients(anvurl(x)) ans = length(y$pats) names(ans) = y$title ans }
No python references are returned.
We won't test this in this document, but this is a typical result:
> system.time(pp <- lapply(allst[2:5], countpats)) user system elapsed 11.474 0.802 16.643 > library(parallel) > options(mc.cores=4) > system.time(pp2 <- mclapply(allst[2:5], countpats)) user system elapsed 12.353 1.393 6.106
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.