insightsengineering / teal.slice

Reproducible slice module for teal applications
https://insightsengineering.github.io/teal.slice/
Other
11 stars 5 forks source link

[Question]: Setting rules on when to use scientific notation for filter card summary display #251

Open lcd2yyz opened 1 year ago

lcd2yyz commented 1 year ago

Filter card summary design https://github.com/insightsengineering/teal.slice/issues/220#issuecomment-1514102912 proposes to display by scientific notation, using some rules based on significant digits.

Team need to decide on

Quick google results in the following definition on "significant digits" (link)

RULES FOR SIGNIFICANT FIGURES

  1. All non-zero numbers ARE significant.
  2. Zeros between two non-zero digits ARE significant.
  3. Leading zeros are NOT significant.
  4. Trailing zeros to the right of the decimal ARE significant.
  5. Trailing zeros in a whole number with the decimal shown ARE significant.
  6. Trailing zeros in a whole number with no decimal shown are NOT significant.
  7. Exact numbers have an INFINITE number of significant figures.
  8. For a number in scientific notation: N x 10x, all digits comprising N ARE significant by the first 6 rules; "10" and "x" are NOT significant.
lcd2yyz commented 1 year ago

For a variable with really large range (eg. labs or biomarkers), we currently see this in active filter image

If we move slider to the upper half, we'd see something like "640,000 - 1,440,000" in the filter card summary line. Don't have any example for really small decimals on hand, but similar issue with really long numbers.

Propose to display as x.xxEx - x.xxEx for numbers with >4 significant digits. Which will be 6.40E5 - 1.44E6 for the example above. But I'm curious to hear other's thoughts, and something we can request feedback during our expert user group meeting.

chlebowa commented 1 year ago

Would this be satisfactory? image

lcd2yyz commented 1 year ago

@chlebowa Yes! Exactly what I had in mind.