Wavemind / liwi-backend

Other
0 stars 1 forks source link

"Z score" and "Weight for age" hardcoded ? #183

Open GregMart1n opened 1 year ago

GregMart1n commented 1 year ago

Describe the bug

It appears that BC95 will always be the result seen on the reader, even though we remove it from the diagram to put BC135 instead. So, fs BC140 is now linked to BC135, once used in the reader, it seems to keep BC95's results/answers.

Same for BC7 that seem to take over BC134 in the reader.

I don't know if this is like hardcoded somewhere.

https://medalcreator.unisante.ch/algorithms/6/versions/72/diagram

image
GregMart1n commented 1 year ago

@quentingirard Here is the URL and ID to test on the tablet. Manu will get you up to speed on the issue :) URL : http://195.15.219.241/ ID : 1810

I'm still waiting on the answer from the field wether the calculation is done properly and this is a display issue or if the calcuation is wrong.

GregMart1n commented 1 year ago

The user confirm this is only a display issue.

ManuBarchich commented 1 year ago

Device ID : 1822

quentingirard commented 1 year ago

Hello,

I confirm this is hard coded in the reader.

Translations :

reference_table: {
    more: 'more than {{number}}',
    less: 'less than {{number}}',
    between: 'Between {{number_1}} and {{number_2}}',
  },

Code logic :

switch (value) {
      case 5:
        return i18n.t('reference_table.more', { number: 5 })
      case 4:
        if (5 in Object.values(reference)[0]) {
          return i18n.t('reference_table.between', {
            number_1: 4,
            number_2: 5,
          })
        } else {
          return i18n.t('reference_table.more', { number: 4 })
        }
      case 3:
        if (4 in Object.values(reference)[0]) {
          return i18n.t('reference_table.between', {
            number_1: 3,
            number_2: 4,
          })
        } else {
          return i18n.t('reference_table.more', { number: 3 })
        }
      case 2:
        return i18n.t('reference_table.between', {
          number_1: 2,
          number_2: 3,
        })
      case 1:
        return i18n.t('reference_table.between', {
          number_1: 1,
          number_2: 2,
        })
      case 0:
        return i18n.t('reference_table.between', {
          number_1: -1,
          number_2: 1,
        })
      case -5:
        return i18n.t('reference_table.less', { number: -5 })
      case -4:
        if (-5 in Object.values(reference)[0]) {
          return i18n.t('reference_table.between', {
            number_1: -5,
            number_2: -4,
          })
        } else {
          return i18n.t('reference_table.less', { number: -4 })
        }
      case -3:
        if (-4 in Object.values(reference)[0]) {
          return i18n.t('reference_table.between', {
            number_1: -4,
            number_2: -3,
          })
        } else {
          return i18n.t('reference_table.less', { number: -3 })
        }
      case -2:
        return i18n.t('reference_table.between', { number_1: -3, number_2: -2 })
      case -1:
        return i18n.t('reference_table.between', { number_1: -2, number_2: -1 })
    }
  }