This module provides an API and the implementation of two handlers for storing complex observations directly in the database.
This approach addresses the problem of sync'ing and backuping complex obs: by default, complex obs are stored as files in server file system outside the database (see Complex Obs Support). So, the value stored in the database is the name of the file (for example, "image.jpg"). This causes two issues:
- If using sync module, the file is not sync'ed (just the name of the file in the file system). This also can lead to duplicate name conflicts.
- When making database backup, complex obs files are not included in the backup. It is necessary to backup complex obs directory as well.
In this module, complex obs are processed as follows:
- They are assigned an uuid, so duplicate conflicts are avoid when using sync module.
- The value of the complex obs is stored in the database as a BLOB.
The module provides the implementation of two handlers: ImageDBHandler and BinaryDBHandler.
- ImageDBHandler: it is used for storing images (an error is thrown if the file cannot be processed as an image).
- BinaryDBHandler: generic handler for any type of binary file.
These handlers are registered in the OpenMRS instance and can be chosen at concept creation: