Using CoachDB to manage facility files

Hello!

I am a member of devs from a company who uses OpenEMR, and they requested a new feature, to better manager the facilities. One of the features is upload documents, like PDFs, and other documents to be liked with the facility or providers, to we keep track about the users documents, like CVs, Licenses and etc.

I look deeply cross the system and CouchDB, but I couldn’t find the functions inside openEMR to maybe create a separate documents to this idea. Today the upload images are for the patients only.

Any one has any idea how can I use the CouchDB to save files to facility and users, instead just for patients?

I think it would be a new feature that would require a new database table and accompanying logic and forms to be able to save to a new folder under sites/default/documents.

Look at how we handle the Bulk Export System Files and you can possibly see a way of how to link the documents to the facility.

1 Like

Rec checking out the logic in documents class. Definitely shouldn’t be too tough to support user specific and facility specific documents. Would probably involve a id column for each (user and facility) in documents table (and make foreign_id null in these cases since foreign_id of 0 is already taken for patient specific documents not yet assigned to a patient). And then could store in folder in documents folder via an already existent mechanism such as user/<random-folder-id>/<random-uuid-name> . The most difficult part would likely be supporting it correctly in the user interface. The nice thing about getting it to work this way is then it will automatically then support couchdb use (if that is turned on) and document encryption at rest.