Example #1
0
def get_analysis_question(hazard, exposure):
    """Construct analysis question based on hazard and exposure.

    :param hazard: A hazard definition.
    :type hazard: dict

    :param exposure: An exposure definition.
    :type exposure: dict

    :returns: Analysis question based on reporting standards.
    :rtype: str
    """
    # First we look for a translated hardcoded question.
    question = specific_analysis_question(hazard, exposure)
    if question:
        return question

    if hazard == hazard_generic:
        # Secondly, if the hazard is generic, we don't need the hazard.
        question = tr(
            'In each of the hazard zones {exposure_measure} {exposure_name} '
            'might be affected?').format(
                exposure_measure=exposure['measure_question'],
                exposure_name=exposure['name'])
        return question

    # Then, we fallback on a generated string on the fly.
    question = tr(
        'In the event of a {hazard_name}, {exposure_measure} {exposure_name} '
        'might be affected?').format(
            hazard_name=hazard['name'],
            exposure_measure=exposure['measure_question'],
            exposure_name=exposure['name'])
    return question
Example #2
0
def get_analysis_question(hazard, exposure):
    """Construct analysis question based on hazard and exposure.

    :param hazard: A hazard definition.
    :type hazard: dict

    :param exposure: An exposure definition.
    :type exposure: dict

    :returns: Analysis question based on reporting standards.
    :rtype: str
    """
    # First we look for a translated hardcoded question.
    question = specific_analysis_question(hazard, exposure)
    if question:
        return question

    if hazard == hazard_generic:
        # Secondly, if the hazard is generic, we don't need the hazard.
        question = tr(
            'In each of the hazard zones {exposure_measure} {exposure_name} '
            'might be affected?').format(
            exposure_measure=exposure['measure_question'],
            exposure_name=exposure['name'])
        return question

    # Then, we fallback on a generated string on the fly.
    question = tr(
        'In the event of a {hazard_name}, {exposure_measure} {exposure_name} '
        'might be affected?').format(
            hazard_name=hazard['name'],
            exposure_measure=exposure['measure_question'],
            exposure_name=exposure['name'])
    return question