obiba / onyx

Web-based application that manages participant baseline interviews at assessment centres or clinics.
http://www.obiba.org/pages/products/onyx
GNU General Public License v3.0
6 stars 13 forks source link

ONYX-1748: zero returned when expected null magma variable #1563

Closed ymarcon closed 6 years ago

ymarcon commented 6 years ago

Jira issue originally created by user @inglis-dl:

instrument-descriptor.xml for Frax instrument: the following script computes an incorrect T-score value when the preceding Dual hip bone density measurement is missing. A zero value is returned when referencing the missing NECK_BMD variable instead of a null

        <script>
            var M_value = 0.849;
            var L_value = 1.0;
            var sigma = 0.111;
            var bmd = $('DualHipBoneDensity:Measure.RES*HIP_NECK*BMD');
            (bmd.isNull().not().value()) ?
             Number((bmd.value()/M*value - 1.0)*M*value/sigma).toFixed(1) : null;
        </script>
ymarcon commented 6 years ago

Comment created by @ymarcon:

Error happens only with repeated instrument measures: when the instrument stage was not run, the measure variable returns an empty list of values instead of an expected null sequence.

ymarcon commented 6 years ago

Issue was closed with resolution "Fixed"