inasafe/inasafe-realtime

EQ: Error in fatality range report

Closed this issue · 2 comments

problem

There is an error in the fatality range reported in InaSAFE realtime earthquake reports.
the ranges says 100 - 10000 when it should be 100 - 1000. This error is seen in the recent Java earthquake report.
http://realtime.inasafe.org/media/reports/earthquake/pdf/20171216000321-en.pdf

See rounding.py

def fatalities_range(number):
    """A helper to return fatalities as a range of number.

    See https://github.com/inasafe/inasafe/issues/3666#issuecomment-283565297

    :param number: The exact number. Will be converted as a range.
    :type number: int, float

    :return: The range of the number.
    :rtype: str
    """
    range_format = '{min_range} - {max_range}'
    more_than_format = '> {min_range}'
    ranges = [
        [0, 100],
        [100, 1000],
        [1000, 10000],
        [10000, 100000],
        [100000, float('inf')]
    ]
    for r in ranges:
        min_range = r[0]
        max_range = r[1]

        if max_range == float('inf'):
            return more_than_format.format(
                min_range=add_separators(min_range))
        elif min_range <= number <= max_range:
            return range_format.format(
                min_range=add_separators(min_range),
                max_range=add_separators(max_range))

proposed solution

please check that ranges are being applied correctly in realtime.

cc
@RikkiWeber @hadighasemi @timlinux

I see, the old realtime reports ranges for a multiply of hundreds instead of 10 in the new InaSAFE v4. We also should also make sure these changes also being used later after migrations.

@lucernae I think if we use v4, we will already use this range since the report is generated by InaSAFE itself. We will only play in the template.