bhima icon indicating copy to clipboard operation
bhima copied to clipboard

Upload and attach scanned documents to transactions.

Open jniles opened this issue 4 years ago • 5 comments

It would be helpful to allow users to scan and upload documents and attach them to any generic transaction. This would make auditing BHIMA a lot easier. For example, you could attach a PV de reception to a voucher, or a bank statement to a particular transaction justifying it.

We already have a lot of the difficult infrastructure written. We have an uploader on the server. We also have mechanisms for uploading documents. All we need to do is implement the client-side modals and behavior.

I propose the way we go about this is the following:

  1. Create a new component/modal that lists documents attached to a particular transaction. All it needs to know is the record_uuid of that transaction. It will allow the user to download a single attachment, all attachments, or delete them.
  2. Store the attachments in a table in the database. They would have a reference to the record_uuid in their table, their own ID, and a path to where they are stored on disk.
  3. Store a boolean variable to indicate if the transaction has an attachment. I propose using the document_map table and extending it with:
ALTER TABLE `document_map` ADD COLUMN attachments BOOLEAN NOT NULL DEFAULT FALSE;

Since all vouchers/invoices/transactions/purchase orders/etc usually LEFT JOIN the document_map table to get their human readable reference, we'll be able to easily add in the attachments boolean.

  1. Add an "Upload an attachment" to the dropdown menu of the different registries that allows a user to add an attachment to that record.
  2. Add a "View attachments" to the dropdown menu of the different registries if the record has an attachment. This will bring up the modal described in (1).

I've been using BHIMA for my own personal finances and this is a critical component to allow me to manage my personal documentaton. I imagine it will be useful as well for users as well.

jniles avatar Sep 07 '20 09:09 jniles

With SEMI, we'll want to have really good tracing of our medications, from purchase order to consumption. Specifically, we'll probably want uploads of our shipping documents.

I say we prioritize this issue. We'll want to be able to see, for every transaction, a list of "attachments" that we can download later. These would be scanned PDFs.

This proposal would probably need to be implemented in conjunction with https://github.com/IMA-WorldHealth/bhima/issues/6275 and https://github.com/IMA-WorldHealth/bhima/issues/6274. Also see https://github.com/IMA-WorldHealth/bhima/issues/4895.

jniles avatar Jun 07 '22 07:06 jniles

When you say "Store the attachments in a table in the database. They would have a reference to the record_uuid in their table, their own ID, and a path to where they are stored on disk.", I presume you are talking about storing the attachment metadata in the database.

I presume we will need a unique file naming convention: Perhaps incorporating the date and UUID into the filename?

jmcameron avatar Jun 07 '22 09:06 jmcameron

I presume we will need a unique file naming convention: Perhaps incorporating the date and UUID into the filename?

Yes, that is right.

jniles avatar Jun 07 '22 09:06 jniles

Should we consider doing https://github.com/IMA-WorldHealth/bhima/issues/6663 first?

jmcameron avatar Jun 07 '22 10:06 jmcameron

Sure!

jniles avatar Jun 07 '22 10:06 jniles