Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data rounding on RiskProfiler #64

Open
plesueur opened this issue Sep 12, 2022 · 18 comments
Open

Data rounding on RiskProfiler #64

plesueur opened this issue Sep 12, 2022 · 18 comments
Assignees
Labels
Documentation Improvements or additions to documentation Priority: Should Have Severity: Major

Comments

@plesueur
Copy link

There are a few issues open pertaining to data rounding (#29, #46, #43), so I am making one issue that will cover them all.

Included below is a proposed rounding scheme for data presented on RiskProfiler. This should be implemented site-wide (maps and charts). I suspect some back and forth between the science and dev team will be needed to get this right, so consider this scheme as V1. Also, @phil-evans, as you implement this, if you notice the results are coming out weird, make a comment here so it can be addressed.

Scenario data
Dollars:
if x = 0, display '0'
if x < 1000, display 'less than 1000'
if x >= 1000 display two significant figures (e.g. 23,456 becomes 23 thousand; 234,567 becomes 230 thousand; 2,345,678 becomes 2.3 million)

Injuries/Building Damages:
if x = 0, display '0'
if 0 < x < 1, display '0'
if 1 <= x < 10, display 'less than 10'
if x >= 10, display two significant figures (e.g. 422 becomes 420, etc.)

Disaster Debris:
if x = 0, display '0'
if x < 100, display 'less than 100'
if x > 100 display two significant figures (as above).

Probabilistic Data
Probable Life Loss:
if x = 0, display '0'
if 0 < x < 0.01, display one significant figure.
if x > 0.01 display two significant figures.

Ratios:
if x = 0, display '0'
if x < 0.01, display one significant figure.
if 0.01 < x < 0, display two significant figures.

Capital Asset Loss:
Follow DRSA scheme for dollars
Building Damage:
Follow DSRA scheme for building damages

@phil-evans
Copy link

phil-evans commented Sep 14, 2022

this required a pretty extensive overhaul of the method of formatting/displaying figures - ready to review on both the scenarios and risks pages, please take a look and let me know if there are issues

@drotheram
Copy link
Contributor

@JulieVdV @plesueur @tieganh please review

@wkhchow
Copy link
Contributor

wkhchow commented Sep 29, 2022

I started looking into this yesterday and following @plesueur rounding scheme above comparing it on beta riskprofiler and against our postgis db (v1p4p3). Writing a specific query for each condition to match above scheme and picking a few spots to validate the results. Will compare 1 scenario assuming the method applies to all and look at the risks.

@wkhchow
Copy link
Contributor

wkhchow commented Oct 5, 2022

Gone through 1 scenario and everything looks fine. Only one possible mismatch I noticed is when rounding to 2 sig figs for values under 100. For example, 14.xx becomes 10, 27 becomes 30 etc. Technically that's 1 sig fig only so not sure if that needs to be changed or mentioned somewhere else that its ok. @plesueur @phil-evans

Will start looking at the probabilistic next.

@jvandevalk
Copy link

Hi, I notice that the scores given in the 'pop-out' on the left are not rounded for probabilistic, whereas the scores given on the pop-ups on the map are rounded. See screenshot below:

image

@phil-evans
Copy link

fixed today along with the eCr_Fatality bug - see #74

@wkhchow
Copy link
Contributor

wkhchow commented Oct 11, 2022

Just following up from our meeting on Thurs for small values that are >0 and mentioning display sig figs, it should still display the sig fig value and not 0. For example actual value 0.0022 should display 0.002 (1 sig fig, psra life loss rule) and not 0.

@plesueur
Copy link
Author

plesueur commented Oct 11, 2022

Hello Folks!

First of all, this looks awesome. Thank Habitat7 for all the effort on this one.

As a final check, I looked over the rounding results, and have a few edits below (listed in order of priority).

  • Highlighting Will C's observations about the 0 values being reported for probabilistic results. Please follow the scheme for rounding probabilistic values.

  • Need to apply the rounding scheme to the scenario overview side panels. In the below examples, Deaths should = 3.4 thousand; Damage should = 18 thousand buildings
    image
    image

  • I am proposing the following minor edit to the rounding scheme provided at the top of the page. The rationale for the change is that you can clearly see the exact values on the graphs when x < 100, and notice a discrepancy in what is reported. This will resolve that.

Scenario data - Injuries/Building Damages:
if x = 0, display '0'
if 0 < x <= 1, display '1 or less'
if 1 < x < 100, report a range to the nearest 10 (1 to 10, 10 to 20, 20 to 30, 30 to 40, 40 to 50, etc...).

if x >= 10, display two significant figures (e.g. 422 becomes 420, etc.)

  • Risk scores are rounded to the nearest ten currently (as requested, sorry about that!). Please round to the integer.

anthonyfok pushed a commit to anthonyfok/riskprofiler that referenced this issue Oct 13, 2022
Changes since 2022-09-12:
* wp-app 2bf917f...ad9132a (3):
  > data output formatting (OpenDRR#64)
  > WPML fix for page tour plugin
  > PSRA indicator descriptions
@phil-evans
Copy link

Risk scores are rounded to the nearest ten currently (as requested, sorry about that!). Please round to the integer.

this may have been addressed already - could you clarify where these figures are exactly?

@plesueur
Copy link
Author

RiskScores

@plesueur
Copy link
Author

plesueur commented Oct 13, 2022

Just reviewed. Looking so good! Thanks for all the effort. A few comments.

  • I'm not sure if I'm looking at the most recent version, but I don't see the scenario injuries/building damage data rounding scheme update. This includes reporting values between 1 < x < 100 as a range to the nearest 10 (e.g. if X is between 1 and 10 report '1 to 10' on the bars and map, if it's between 10 and 20, report it as '10 to 20' on the bars and map, and so forth up to x < 100). See example below. Let me know if you have questions.
    image

  • you may be working on this now, but if not, for the average annual fatalities and annual probability of fatality (probabilistic data), the values shown on the map should match those on the sidebar. In other words, use the same rounding rules. See examples below.
    -here average annual fatalities reported on the map should be 0.0008.
    image
    -here the annual probability of fatality reported on the map should be 0.000001.
    image

@phil-evans
Copy link

check it out now @plesueur - for the first one i misread the request and i had only made it round to the nearest 10 rather than a range.:

Screen Shot 2022-10-14 at 12 02 01 PM

@plesueur
Copy link
Author

Nice work Phil! Using a range to the nearest ten works great! No proposed edits on that one at this point.

@plesueur
Copy link
Author

plesueur commented Oct 14, 2022

Also nice work on matching the map and sidebar values. Looks good to me.

@wkhchow and @phil-evans , I'm getting some interesting results for the annual probability of fatality and average annual fatalities.
Example 1: showing 0 average annual fatalities even though the color shows its much higher.
image
Example 2: I get a 0 annual probability of fatality for Toronto. @wkhchow is that correct based on our database?
image

@wkhchow
Copy link
Contributor

wkhchow commented Oct 17, 2022

Also nice work on matching the map and sidebar values. Looks good to me.

@wkhchow and @phil-evans , I'm getting some interesting results for the annual probability of fatality and average annual fatalities. Example 1: showing 0 average annual fatalities even though the color shows its much higher. image Example 2: I get a 0 annual probability of fatality for Toronto. @wkhchow is that correct based on our database? image

The newest revision is being updated and should fix the 0 probabilities mentioned above.

  • Scenario data - Injuries/Building Damages:
    if x = 0, display '0'
    if 0 < x <= 1, display '1 or less'
    if 1 < x < 100, report a range to the nearest 10 (1 to 10, 10 to 20, 20 to 30, 30 to 40, 40 to 50, etc...).
    if x >= 10, display two significant figures (e.g. 422 becomes 420, etc.)

Following up again on this rule above.
It looks like the rules are applied to the PSRA as well for absolute damages/injuries, but when viewing the probability we see the actual 'rounding' applied. Just want to confirm we want that applied to PSRA side as well? @phil-evans @plesueur

image

image

@phil-evans
Copy link

phil-evans commented Oct 18, 2022

good catch @wkhchow - the sidebar indicators were formatting according to the rules of the current selected indicator, rather than the rules that should be applied for each individual figure. so it looked right when you were exploring 'annual fatalities' etc but not 'economic loss'. please review and let me know if you're still seeing bugs.

also see below:

Screen Shot 2022-10-18 at 11 25 42 AM

if a number is tiny enough javascript returns it as 'Xe-Y' - should we change that to display as 0.0000000X? @plesueur

@plesueur
Copy link
Author

@phil-evans. Annual probability of fatality is often reported in scientific notation, but I think you're right to report it as a decimal for this case. We may lose people when there are too many zeros, but we would probably lose more people to a number with a 'e' in the middle.

github-actions bot pushed a commit that referenced this issue Oct 18, 2022
Changes since 2022-10-17:
* wp-app 6808772...9cb3fb7 (1):
  > risks - fixed sidebar indicators using incorrect formatting rules (#64)
github-actions bot pushed a commit to anthonyfok/riskprofiler that referenced this issue Oct 18, 2022
Changes since 2022-10-17:
* wp-app 6808772...9cb3fb7 (1):
  > risks - fixed sidebar indicators using incorrect formatting rules (OpenDRR#64)
@phil-evans
Copy link

done!

Screen Shot 2022-10-18 at 4 10 35 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements or additions to documentation Priority: Should Have Severity: Major
Projects
None yet
Development

No branches or pull requests

7 participants