obs.value_complex is very short

In Bahmni we are using complex obs to store uploaded images, with a simple handler that stores the URL of the uploaded image file in obs.value_complex.

Now, to improve the UX, we would like to store a bit more metadata, including letting the uploader give the image a title. So later when someone views a list of images they see the titles before deciding what image to open.

We would like to do something like setting obs.valueComplex to

{"title":"Chest X Ray", "url":"..."}

(or, if you don’t like JSON, it could just be

Chest X Ray | url

But the obs.value_complex is only varchar(255) so we don’t think we can reliably fit a small amount of user-entered text and the URL in that field.

Basically, we feel that obs.value_complex should be big enough to store both a reference to data and enough description to allow an end-user to decide if they want to make the expensive call to fetch that data.

Can we make obs.value_complex longer?

The suggestion makes a lot of sense!

Why not a new table (obs_complex ?) with title and url? And maybe more attributes like mime type, extension, size, compressed … I guess it’s too late.

Fine with me.

Fine with me too

The 255 character limit on obs.value_complex and obs.comments attributes was arbitrary (we wanted enough space for meaningful text, but worried too many large text fields would have adverse consequences on performance).

While I favor @lluismf’s suggestion (i.e., an obs_complex table), I’m assuming any effect on performance would be insignificant, so increasing the size from 255 to 1024 is fine with me too.

I wasn’t thinking about performance, just physical design :grinning:

Sorry. Me mispeaking again. What I meant was:

  1. I favor @lluismf’s suggestion (i.e., an obs_complex_table).
  2. I’m assuming increasing the size from 255 to 1024 would not significantly affect performance, so it’s fine with me too.

@padmavati, FYI we discussed this on yesterday’s OpenMRS design call, and we agree that it’s okay to increase the size of the obs.value_complex column to be ~1000 or so.

If that’s needed for the Bahmni card you’re working on, please create an OpenMRS ticket for it.

Hi @darius

We have prioritized this for the next release. We can pick up in the next release.


@padmavati, Bahmni 0.89 will coincide with an openmrs-core release, but I don’t think that we will do this for the next Bahmni release.

So if we want to add this to Bahmni in 0.90 we need to create the OpenMRS ticket and action it during this iteration.