Seeking advice on plugin to modify CCDA

Hello all,

I am writing a zend module to respond to the patient.ccda.create event so the resulting CCDA can be modified to include information from our clinics custom forms. I am seeking advice on if I am going about this the correct way or if there is a better path.

After the CCDA is requested via the FHIR interface from an external process. The CareCoordination module then communicates with the ccdaservice receiving the CCDA, making note of it, and writing it to the file system.

My event handler then gets called and I have the opportunity to pull the CCDA file using the Documents interface. I intend to add additional information to the Social History section (specificaly gender identity and sex assigned at birth). I expect to do this by parsing the CCDA xml and adding to it like is done in the Care Coordination Module CcdaGenerator.php. Then using the Documents interface writing the CCDA back to the filesystem.

Any feedback is appreciated.

So looking at the code, I think the challenge you’ll run into is that there isn’t a way to update a created Document right now. You’ll have to use the Document interface to generate a new document and either insert a new entry into the ccda table or update the existing ccda entry to hold a reference to the updated document.

Depending on your goals, if you introduced a new event via a PR to be notified before a document is saved in the Document.class.php file (or reuse the ServiceSaveEvent in this class) then you could modify the data without creating duplicate records. Another option would be to add an event in the EncounterCcdadispatchTable::logCCDA for ccda.created and modify the xml that way without having duplicate files / db records generated. I’d be happy to review this PR if you submitted the additions for those events.

2 Likes