C-CDA --> HealthKit

Hey folks
I’m thinking of posting a modest bounty somewhere for a tool to convert a C-CDA document (clinical document out of an EMR) into health kit.

Anyone know if anything already exists and/or how challenging it might be?

Anyone interested in working on it? I’ll gladly donate my C-CCDA XML files to the cause.

I’m equally interested in a C-CDA XML to Evernote converter… anyone tried that?


1 Like

I’m not set up for doing iOS stuff (and HealthKit doesn’t have a Web API), but I’d be interested in some sample C-CDA files regardless :slight_smile:

Have you looked at Microsoft HealthVault? Should be able to import C-CDA files there…

@NickDawson - I’m definitely interested in this! I replied to your comment in the other thread, but this section seems more appropriate.

I could really use an example CCDA file to go off of.

You need to understand the data you want to store in HealthKit. You can use the Health App to manually add any data. Explore that app. If the data you want to store is not supported by the Health App, it’s not possible to store it there until apple supports that data type.

Apple just announced support for hydration, reproductive health and UV exposure. I’m waiting for support for Cholesterol.

I’m writing an HealthKit app and would like to enable EMR integration. Are you willing to share the data format you have and describe where you obtained it?

I’m actually just wrapping up doing this as well as HealthKit to CDA. Also wrote a generalized CDA (CCD / C32) parser and generator. I haven’t yet wired in QRDA I, but I don’t think that would be all that much work now that the guts of it are working.

I’m in the process of documenting how I put it together as well as the weirdness that you can run into attempting to make this work. EX: How are you charting “Heart Rate” in your EMR? Which code system? Which code? Oh, your EMR is mis-representing UCUM unit “oz” as “ounces” - let’s replace that with a valid HKUnit string.

From HealthKit out to CDA I’m just providing a generalized CDA-based model for you to stuff data into from HealthKit (super easy, too), so you have to say “OK, here’s my HKSample that represents “heart rate” - please LOINC-ify.” I didn’t want to make assumptions about just pulling a bunch of samples and doing medians or whatever over time.

My code is an absolute mess at this point, so I’m not yet publishing it on GitHub, but I will once I clean it up. It’s embarrassingly bad right now. But … it works, so I’ve got that going for me, which is nice.

Almost done with this. The basic bits are complete and I’m now cleaning up code and testing some more things.

I’ve started to post information on the approach here https://www.linkedin.com/pulse/connecting-ios-your-emr-using-healthkit-cda-part-one-eric-whitley. More posts coming over the next few days and I hope to release the code to github for initial critique early next week.

It’s a pretty direct port of the CCDA and C32 import/export functionality from the Ruby Health-Data-Standards project. I’m not yet touching QRDA1, but that would be reasonably straight-forward to wire up (minus all of the HQMF measure references, etc. - not touching that). The only sections/entries/templates that I built in are the ones currently in use by that project.

Re: HealthKit <-> CDA vocabulary linking, I got the expert input from a physician who is a super savvy informaticist, so that was incredibly helpful. I wound up having to build in bi-direction concept mapping hooks, so you can say “oh, an X term from SNOMED CT is a HealthKit heart rate sample type” for import, but then say “but when you export, use the following LOINC term.” That kind of thing. All of those maps can be changed at runtime in case you don’t agree with my educated guesses or your personal CDAs use nonstandard vocabularies or alternative terms.

I wired up some rudimentary (and horribly bad) unit string parsing and handling, but set that bit up so you can inject a closure and just say “I definitely know better” and supply your own logic. I need to test it completely, but I think I also successfully provided the ability for an app to consume a user’s HKHealthStore unit preferences (preferredUnitsForQuantityTypes) from a the app would supply. That’s optional.

This is more or less my first attempt at doing anything in Swift and iOS, so I expect the code to garner some feedback (EX: “you have memory leaks” etc.).