FHIR Chat · fhircrackr · analytics on FHIR

Stream: analytics on FHIR

Topic: fhircrackr


view this post on Zulip Danny Ammon (Jul 11 2020 at 10:09):

New R package available: Useful tools for conveniently downloading FHIR resources in xml format
and converting them to R data frames. The package uses FHIR search to download bundles from a FHIR server, provides functions to save and read XML files containing such bundles and allows flattening the bundles to data.frames using XPath expressions. We would be very happy if anyone who's interested could test it and report issues! https://cran.r-project.org/package=fhircrackr

view this post on Zulip Grahame Grieve (Jul 13 2020 at 02:41):

how does it compare to the existing package?

view this post on Zulip Julia Palm (Jul 13 2020 at 05:30):

As far as we can tell the existing package (RonFHIR) just loads FHIR resources into R as json resources, which most R people would probably have been able to to themsevelves using the httr package RonFHIR is wrapping. That is not too helpful as you cant do data analysis on these resources. fhircrackr on the other hand gives an interface (fhir_crack()) to extract the data from resources into table like structures (aka data.frames) within R.

view this post on Zulip Grahame Grieve (Jul 13 2020 at 19:18):

so you have to provide XPath rules to convert to tables? How would JSON be supported or is that not a reasonable addition?

view this post on Zulip Grahame Grieve (Jul 13 2020 at 19:21):

does fhircrackr support smart on fhir?

(great name, btw, but you do need to formally apply for trademark permission here: http://www.hl7.org/about/product.trademark.application.cfm)

view this post on Zulip Julia Palm (Jul 14 2020 at 05:38):

At the moment you have to provide XPath rules to convert to tables, so json is not supported, that is correct.
There's different levels of "cracking" a bundle of fhir ressources provided in the package. If you know which elements of the resources you are interested in and you can provide the XPath expression to their position, you can extract data frames with only that information. I think it will be hard to transfer this functionality to JSON because I'm not aware of a comparable tool for JSON.
On the other hand you can crack the entire bundle and turn every element into a column of the data frame. At the moment, fhircrackr can do this to XMLs exclusively too, but that might technically be transferable to JSON sometime. In my opinion that is however not the most useful functionality, because the resulting data frames are incredibly wide and sparse and contain a lot information you won't be interested in for data analysis.

I have to say I'm not very familiar with smart on fhir. What kinds of preconditions would fhircrackr have to satisfy to support smart on fhir? The package can currently access any endpoint that can return xml resources via fhir search and it is open source, so any of the code is of course freely available.

Thanks for the remark about the trademark permission, we'll take care of that!

view this post on Zulip Grahame Grieve (Jul 14 2020 at 07:03):

well, smart on fhir is really just an OAUth profile - you can copy the code from the existing R package for that (it's not a lot).

view this post on Zulip Grahame Grieve (Jul 14 2020 at 07:04):

I think that there's several equivalents to XPath for json, but none have formal standing


Last updated: Apr 12 2022 at 19:14 UTC