Obs Graph Widget in RefApp 2.x

The attempt has been to plot a BMI graph using the Obs Graph widget

The Widget config is almost exactly the same as the example in the above doc and visible here

As of now, all that I get is a warning in the server logs and no graph gets displayed.

The config has a key called “function” where an actual function called bmi gets used, should this function be defined somewhere? or is the possible solution something else?

Thank you!

It is, but in a slightly convoluted way (specifically, it’s defined here).

The problem seems to be accessing some data via the REST interface… Is there anything earlier in the server logs? Alternatively, in your browser network tab do you see a failed request for either the /concept or /obs endpoints?

Thanks for the reply @ibacher. I can now see a request Error (type 500) for the below end-point:

/concept/'5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'?v=custom:(uuid,display,name:(display),datatype:(uuid,display))

There is a similar request error involving the other concept ‘5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA’ as well.

PS: Both these concepts exist in the Dictionary and if I remove the line with the “function” key from the config (which is Ln. 14 here), the widget works perfectly fine.

So the problem with the request is definitely the single-quotes that get added there. It must be returning some kind of error that isn’t properly converted.

Presumably, though, you don’t see a graph of the BMI right? If you don’t need it, I suppose we can stop there…

However, another option. The “function” entry in both the example config and the config used in coreapps has this:

"function": "(bmi,\"5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\", \"5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\");" 

Could we try instead using this:

"function": "(bmi,5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, 5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA);" 

Basically, my guess is that since the value of function is already a string, we don’t need the additional quotes there.

1 Like

Yes! that is working…the additional quotes seem to be unnecessary after all (and in fact are the trouble makers).

With the additional quotes removed and the Widget config changed to this, a nice multi-variable graph is produced showing Weight, Height & BMI:

image

However, if you observe the value of the BMI…it is 10x times more than the expected. But, that is a different issue altogether…and we will have to look through the function being used for this calculation and other pieces of codes.

I’m going to mark this thread as SOLVED!

Thanks a lot @ibacher !

2 Likes

That’s a weird one… 70 kg and 174 cm should give a BMI of 23.1 too.

1 Like