πŸ—ΊοΈ {{ t.section_headers.impact_summary_map|default('Impact Summary Map') }}

{% set summary_map_section = sections.summary_map|default({}) %} {% if summary_map_section and summary_map_section.image_base64|default('') %} {{ t.page_meta.alt_summary_map|default('IBF Summary Map') }} {% else %}
πŸ“ {{ t.map_captions.map_not_available|default('Map visualization not available') }}
{% endif %}
{% if narrative_text %} {# ===== SENTENCE-LEVEL NARRATIVE (new path) ===== Built in Python (core/report_narrative.py) from full-sentence templates in t.report_narrative β€” used by report-only languages (hi/ta/si/dv). Languages without that section (en/ru) keep the legacy fragment assembly below, unchanged. #} {{ narrative_text }} {% set _tc_forecast_dt_n = ((analysis_details.tc_forecast_datetime|default(tc_forecast_datetime|default('')))|trim) %} {% set _haz_sub_n = (analysis_details.hazard_subtype|default('')|string|lower) %} {% if ('tropical cyclone' in _haz_sub_n) and _tc_forecast_dt_n %}

{{ (t.map_captions.tc_forecast_validity_statement|default('This analysis is based on the tropical cyclone forecast valid for {forecast_datetime}, derived from maximum sustained quadrant wind speed forecast data.'))|replace('{forecast_datetime}', _tc_forecast_dt_n) }}

{% endif %} {% else %} {% set total_areas = summary_stats.total_areas|default(0) %} {% set impacted_areas = summary_stats.impacted_areas|default(0) %} {% set total_impact_pct = summary_stats.total_impact_pct|default(0) %} {% set avg_exposure_impact_pct = summary_stats.avg_exposure_impact_pct|default(0) %} {% set total_exposure = summary_stats.total_exposure|default(0) %} {% set impacted_exposure = summary_stats.impacted_exposure|default(0) %} {# ===== EXPOSURE PHRASING CONFIGURATION ===== #} {# Determine proper unit name, article, verb, and percentage suffix based on exposure type #} {% if exposure_type == "Population" %} {% set unit_name = "people" %} {% set unit_singular = "person" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "population" %} {% set pct_suffix = "of total population" %} {% elif exposure_type == "Elderly Population" %} {% set unit_name = "elderly people" %} {% set unit_singular = "elderly person" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "elderly population" %} {% set pct_suffix = "of total population" %} {% elif exposure_type == "Female Population" %} {% set unit_name = "women and girls" %} {% set unit_singular = "woman/girl" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "female population" %} {% set pct_suffix = "of total population" %} {% elif exposure_type == "Health Facilities" %} {% set unit_name = "health facilities" %} {% set unit_singular = "health facility" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "health facility" %} {% set pct_suffix = "of total no. of facilities" %} {% elif exposure_type == "Education Facilities" %} {% set unit_name = "education facilities" %} {% set unit_singular = "education facility" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "education facility" %} {% set pct_suffix = "of total no. of facilities" %} {% elif exposure_type == "Power Plants" %} {% set unit_name = "power plants" %} {% set unit_singular = "power plant" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "power plant" %} {% set pct_suffix = "of total no. of plants" %} {% elif exposure_type == "Power Plants - Hydro" %} {% set unit_name = "hydro power plants" %} {% set unit_singular = "hydro power plant" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "hydro power plant" %} {% set pct_suffix = "of total no. of plants" %} {% elif exposure_type == "Power Plants - Solar" %} {% set unit_name = "solar power plants" %} {% set unit_singular = "solar power plant" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "solar power plant" %} {% set pct_suffix = "of total no. of plants" %} {% elif exposure_type == "Road Network" %} {% set unit_name = "km of road network" %} {% set unit_singular = "km of road network" %} {% set article = "the " %} {% set verb = "is" %} {% set category_label = "road network" %} {% set pct_suffix = "of total length" %} {% elif exposure_type == "Railways" %} {% set unit_name = "km of railways" %} {% set unit_singular = "km of railway" %} {% set article = "the " %} {% set verb = "are" %} {% set category_label = "railway" %} {% set pct_suffix = "of total length" %} {% elif exposure_type == "Sea and River Ports" %} {% set unit_name = "ports" %} {% set unit_singular = "port" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "port" %} {% set pct_suffix = "of total no. of ports" %} {% elif exposure_type == "Airports" %} {% set unit_name = "airports" %} {% set unit_singular = "airport" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "airport" %} {% set pct_suffix = "of total no. of airports" %} {% elif exposure_type == "Fibre-optic ICT" %} {% set unit_name = "km of fibre-optic network" %} {% set unit_singular = "km of fibre-optic network" %} {% set article = "the " %} {% set verb = "is" %} {% set category_label = "fibre-optic network" %} {% set pct_suffix = "of total length" %} {% elif exposure_type == "Agricultural Production Quantity" %} {% set unit_name = "tonnes of agricultural production" %} {% set unit_singular = "tonne of agricultural production" %} {% set article = "" %} {% set verb = "is" %} {% set category_label = "agricultural production" %} {% set pct_suffix = "of total production" %} {% elif exposure_type == "Agricultural Production Value" %} {% set unit_name = "in agricultural value" %} {% set unit_singular = "in agricultural value" %} {% set article = "" %} {% set verb = "is" %} {% set category_label = "agricultural value" %} {% set pct_suffix = "of total value" %} {% elif exposure_type == "Economic Stock" %} {% set unit_name = "in economic stock" %} {% set unit_singular = "in economic stock" %} {% set article = "" %} {% set verb = "is" %} {% set category_label = "economic stock" %} {% set pct_suffix = "of total value" %} {% elif exposure_type == "Mangroves" %} {% set unit_name = "hectares of mangroves" %} {% set unit_singular = "hectare of mangroves" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = "mangrove area" %} {% set pct_suffix = "of total area" %} {% else %} {% set unit_name = exposure_type|lower if exposure_type else "exposure units" %} {% set unit_singular = exposure_type|lower if exposure_type else "exposure unit" %} {% set article = "" %} {% set verb = "are" %} {% set category_label = exposure_type|lower if exposure_type else "exposure" %} {% set pct_suffix = "of total " + (exposure_type|lower if exposure_type else "") %} {% endif %} {# ===== FORMAT IMPACTED EXPOSURE VALUE ===== #} {% if is_line_exposure %} {# Line exposure: convert meters to km #} {% set display_value = impacted_exposure / 1000 %} {% if display_value >= 1000000 %} {% set formatted_value = "{:,.1f}".format(display_value/1000000) + "M" %} {% elif display_value >= 1000 %} {% set formatted_value = "{:,.1f}".format(display_value/1000) + "K" %} {% else %} {% set formatted_value = "{:,.1f}".format(display_value) %} {% endif %} {% elif exposure_type in ["Agricultural Production Value", "Economic Stock"] %} {# Monetary values: add $ prefix #} {% if impacted_exposure >= 1000000000 %} {% set formatted_value = "$" + "{:,.1f}".format(impacted_exposure/1000000000) + "B" %} {% elif impacted_exposure >= 1000000 %} {% set formatted_value = "$" + "{:,.1f}".format(impacted_exposure/1000000) + "M" %} {% elif impacted_exposure >= 1000 %} {% set formatted_value = "$" + "{:,.1f}".format(impacted_exposure/1000) + "K" %} {% else %} {% set formatted_value = "$" + "{:,.0f}".format(impacted_exposure) %} {% endif %} {% else %} {# Standard numeric formatting #} {% if impacted_exposure >= 1000000 %} {% set formatted_value = "{:,.1f}".format(impacted_exposure/1000000) + "M" %} {% elif impacted_exposure >= 1000 %} {% set formatted_value = "{:,.1f}".format(impacted_exposure/1000) + "K" %} {% else %} {% set formatted_value = "{:,.0f}".format(impacted_exposure) %} {% endif %} {% endif %} {# ===== MAIN SUMMARY TEXT ===== #} {% if total_areas > 0 %} {% if total_areas == 1 or (total_areas % 10 == 1 and total_areas % 100 != 11) %}{{ (t.map_captions.evaluates_area_singular|default('The analysis covers {count} administrative area'))|replace('{count}', total_areas|string) }}{% elif total_areas % 10 in [2, 3, 4] and total_areas % 100 not in [12, 13, 14] %}{{ (t.map_captions.evaluates_area_few|default('The analysis covers {count} administrative areas'))|replace('{count}', total_areas|string) }}{% else %}{{ (t.map_captions.evaluates_area_plural|default('The analysis covers {count} administrative areas'))|replace('{count}', total_areas|string) }}{% endif %}{% if impacted_areas > 0 %}{% set _wa = (t.map_captions.with_affected|default('of which {count} are affected by {hazard_type}'))|replace('{count}', impacted_areas|string)|replace('{hazard_type}', (analysis_details.translated_hazard_subtype|default(analysis_details.hazard_subtype))|lower) %}{{ ('' if _wa.lstrip().startswith(',') else ' ') ~ _wa.lstrip() }}{% endif %}. {% if has_exposure and impacted_exposure > 0 %} {# ===== EXPOSURE IMPACT SENTENCE ===== #} {{ (t.map_captions.exposed_pattern|default('{value} {unit_name} {verb} exposed'))|replace('{value}', formatted_value)|replace('{unit_name.genitive}', translated_unit_name_genitive|default(translated_unit_name)|default(unit_name))|replace('{unit_name}', translated_unit_name|default(unit_name))|replace('{verb}', translated_verb|default(verb)) }} {%- if is_single_class_hazard|default(false) -%} {%- set _wz = (t.map_captions.within_hazard_zone|default('within the hazard zone'))|trim -%} {{ ('' if _wz.startswith(',') else ' ') ~ _wz }} {%- elif class_definitions and class_definitions|length > 1 -%} {#- Build class breakdown list - need to track first class with data -#} {%- set ns = namespace(first_with_data=true, class_count=0) -%} {%- for class_def in class_definitions -%} {%- set class_data = class_summary.get(class_def.class_id) -%} {%- if class_data and class_data.total > 0 -%} {%- set ns.class_count = ns.class_count + 1 -%} {%- endif -%} {%- endfor -%} {%- if ns.class_count > 0 -%} . {% set _ote = t.map_captions.of_those_exposed|default('Of those exposed') %}{{ _ote }}{{ '' if _ote.rstrip().endswith(':') else ',' }} {%- set ns.output_count = 0 -%} {%- for class_def in class_definitions -%} {%- set class_data = class_summary.get(class_def.class_id) -%} {%- if class_data and class_data.total > 0 -%} {%- set ns.output_count = ns.output_count + 1 -%} {%- set _cl = (class_label_translations.get(class_def.label or class_def.name, class_def.label or class_def.name))|lower -%} {%- set _range_display = ((tc_wind_range_labels or {}).get(class_def.class_id) or class_def.display_rule or format_class_range(class_def.min_value, class_def.max_value, class_def.unit)) -%} {%- set _is_tc = ((analysis_details.hazard_subtype|default('')|string|lower) == 'tropical cyclone') -%} {%- if _is_tc and _range_display -%} {%- set _wp = (t.map_captions.within_tc_winds|default('in areas with {range}')) |replace('{range}', _range_display) -%} {%- else -%} {%- set _wp = (t.map_captions.within_class_area|default('within {class_name} hazard affected area ({range})')) |replace('{class_name}', _cl) |replace('{range}', _range_display) |replace('{min}-{max} {unit}', _range_display) |replace('{min}', format_class_value(class_def.min_value)) |replace('{max}', format_class_value(class_def.max_value)) |replace('{unit}', class_def.unit or '') -%} {%- endif -%} {%- set _and_text = (t.map_captions.and_connector|default('and'))|trim -%} {%- if ns.output_count == 1 -%} {{ ' ' }} {%- elif ns.output_count == ns.class_count -%} {{ ' ' ~ _and_text ~ ' ' }} {%- else -%} {{ ', ' }} {%- endif -%} {#- Format class value based on exposure type -#} {%- if is_line_exposure -%} {%- set class_display = class_data.total / 1000 -%} {%- if class_display >= 1000 -%} {{ format_pct_comprehensive_exposure(class_data.percentage, class_data.total) }}% ({{ "{:,.1f}".format(class_display/1000) }}K km) {{ translated_verb|default(verb)|default('are') }} {{ _wp }} {%- else -%} {{ format_pct_comprehensive_exposure(class_data.percentage, class_data.total) }}% ({{ "{:,.1f}".format(class_display) }} km) {{ translated_verb|default(verb)|default('are') }} {{ _wp }} {%- endif -%} {%- elif exposure_type in ["Agricultural Production Value", "Economic Stock"] -%} {%- if class_data.total >= 1000000 -%} {{ format_pct_comprehensive_exposure(class_data.percentage, class_data.total) }}% (${{ "{:,.1f}".format(class_data.total/1000000) }}M) {{ translated_verb|default(verb)|default('are') }} {{ _wp }} {%- elif class_data.total >= 1000 -%} {{ format_pct_comprehensive_exposure(class_data.percentage, class_data.total) }}% (${{ "{:,.1f}".format(class_data.total/1000) }}K) {{ translated_verb|default(verb)|default('are') }} {{ _wp }} {%- else -%} {{ format_pct_comprehensive_exposure(class_data.percentage, class_data.total) }}% (${{ "{:,.0f}".format(class_data.total) }}) {{ translated_verb|default(verb)|default('are') }} {{ _wp }} {%- endif -%} {%- else -%} {%- if class_data.total >= 1000000 -%} {{ format_pct_comprehensive_exposure(class_data.percentage, class_data.total) }}% ({{ "{:,.1f}".format(class_data.total/1000000) }}M) {{ translated_verb|default(verb)|default('are') }} {{ _wp }} {%- elif class_data.total >= 1000 -%} {{ format_pct_comprehensive_exposure(class_data.percentage, class_data.total) }}% ({{ "{:,.1f}".format(class_data.total/1000) }}K) {{ translated_verb|default(verb)|default('are') }} {{ _wp }} {%- else -%} {{ format_pct_comprehensive_exposure(class_data.percentage, class_data.total) }}% ({{ "{:,.0f}".format(class_data.total) }}) {{ translated_verb|default(verb)|default('are') }} {{ _wp }} {%- endif -%} {%- endif -%} {%- endif -%} {%- endfor -%} {%- endif -%} {%- endif -%} . {% set _imp_fmt = "{:,.1f}".format(impacted_exposure/1000000) + "M" if impacted_exposure >= 1000000 else ("{:,.1f}".format(impacted_exposure/1000) + "K" if impacted_exposure >= 1000 else "{:,.0f}".format(impacted_exposure|int)) %} {% set _tot_fmt = "{:,.1f}".format(total_exposure/1000000) + "M" if total_exposure >= 1000000 else ("{:,.1f}".format(total_exposure/1000) + "K" if total_exposure >= 1000 else "{:,.0f}".format(total_exposure|int)) %} {% set _hazard_area_sentence = ((t.map_captions.total_hazard_area_pct|default('Overall, hazard-affected area is {pct}% of total area'))|replace('{pct}', format_pct_adaptive(total_impact_pct)))|trim %} {% set _total_exposed_sentence = ((t.map_captions.total_exposed_statement|default('Total exposed {category} is {impacted} of {total} ({pct}%)'))|replace('{category.genitive}', translated_category_genitive|default(translated_exposure_category)|default(category_label))|replace('{category}', translated_exposure_category|default(category_label))|replace('{impacted}', _imp_fmt)|replace('{total}', _tot_fmt)|replace('{pct}', format_pct_adaptive(avg_exposure_impact_pct)))|trim %} {{ ' ' ~ _hazard_area_sentence ~ '. ' ~ _total_exposed_sentence ~ '.' }} {# ===== TOP IMPACTED AREAS ===== #} {% if aggregation_results and aggregation_results|length > 0 %} {# Sort by impacted_exposure when exposure data is available, otherwise by area coverage #} {%- if has_exposure -%} {%- set sorted_results = aggregation_results|sort(attribute='impacted_exposure', reverse=True) -%} {%- else -%} {%- set sorted_results = aggregation_results|sort(attribute='impact_pct', reverse=True) -%} {%- endif -%} {#- Filter to only include areas with actual impact, then take top 3 -#} {%- set ns = namespace(valid_areas=[]) -%} {%- for area in sorted_results -%} {%- if (has_exposure and area.impacted_exposure is defined and area.impacted_exposure > 0) or (not has_exposure and area.impact_pct > 0) -%} {%- set ns.valid_areas = ns.valid_areas + [area] -%} {%- endif -%} {%- endfor -%} {%- set top_areas = ns.valid_areas[:3] -%} {% if top_areas and top_areas|length > 0 %} {{ ' ' }}{{ ((t.map_captions.top_exposed_intro|default('Top exposed areas are')) if has_exposure else (t.map_captions.top_impacted_intro|default('Top impacted areas are'))) ~ ' ' }} {%- set _list_and_text = (t.map_captions.and_connector|default('and'))|trim -%} {% for area in top_areas %} {#- Format area's impacted exposure -#} {%- if area.impacted_exposure is defined and area.impacted_exposure > 0 -%} {%- if is_line_exposure -%} {%- set area_display = area.impacted_exposure / 1000 -%} {%- if area_display >= 1000 -%} {%- set area_formatted = "{:,.1f}".format(area_display/1000) + "K km" -%} {%- else -%} {%- set area_formatted = "{:,.1f}".format(area_display) + " km" -%} {%- endif -%} {%- elif exposure_type in ["Agricultural Production Value", "Economic Stock"] -%} {%- if area.impacted_exposure >= 1000000 -%} {%- set area_formatted = "$" + "{:,.1f}".format(area.impacted_exposure/1000000) + "M" -%} {%- elif area.impacted_exposure >= 1000 -%} {%- set area_formatted = "$" + "{:,.1f}".format(area.impacted_exposure/1000) + "K" -%} {%- else -%} {%- set area_formatted = "$" + "{:,.0f}".format(area.impacted_exposure) -%} {%- endif -%} {%- else -%} {%- if area.impacted_exposure >= 1000000 -%} {%- set area_formatted = "{:,.1f}".format(area.impacted_exposure/1000000) + "M" -%} {%- elif area.impacted_exposure >= 1000 -%} {%- set area_formatted = "{:,.1f}".format(area.impacted_exposure/1000) + "K" -%} {%- else -%} {%- set area_formatted = "{:,.0f}".format(area.impacted_exposure) -%} {%- endif -%} {%- endif -%} {%- else -%} {%- set area_formatted = "" -%} {%- endif -%} {%- if loop.first -%} {{ area.area_name }} ({{ area_formatted if has_exposure else ("%.1f"|format(area.impact_pct) ~ "% area") }}) {%- else -%} {{ (", " ~ _list_and_text ~ " ") if loop.last else ", " }}{{ area.area_name }} ({{ area_formatted if has_exposure else ("%.1f"|format(area.impact_pct) ~ "% area") }}) {%- endif -%} {%- if loop.last -%}.{%- endif -%} {% endfor %} {% endif %} {%- endif -%} {% endif %} {% set _tc_forecast_dt = ((analysis_details.tc_forecast_datetime|default(tc_forecast_datetime|default('')))|trim) %} {% set _haz_sub = (analysis_details.hazard_subtype|default('')|string|lower) %} {% set _is_tc_summary = ('tropical cyclone' in _haz_sub) %} {% if _is_tc_summary and _tc_forecast_dt %}

{{ (t.map_captions.tc_forecast_validity_statement|default('This analysis is based on the tropical cyclone forecast valid for {forecast_datetime}, derived from maximum sustained quadrant wind speed forecast data.'))|replace('{forecast_datetime}', _tc_forecast_dt) }}

{% endif %} {% else %} {{ (t.map_captions.default_caption|default('Impact areas showing {hazard_subtype} analysis results across administrative boundaries.'))|replace('{hazard_subtype}', (analysis_details.translated_hazard_subtype|default(analysis_details.hazard_subtype))|lower) }} {% endif %} {% endif %}

{{ t.section_headers.analytics|default('Analytics') }}

{% if sections.population_chart and sections.population_chart.svg_content %}
{{ sections.population_chart.svg_content|safe }}
{% if not is_single_class_hazard|default(false) and class_definitions and class_definitions|length > 1 %}
{{ t.chart_labels.hazard_class_ranges|default('Hazard Class Ranges:') }}
{% set chart_context = sections.population_chart.context %} {% set chart_colors = chart_context.colors %} {% set chart_data = chart_context.data %} {% set chart_total = chart_context.total_value %} {% set _is_tc_hazard = ((analysis_details.hazard_subtype|default('')|string|lower) == 'tropical cyclone') %} {% for class_def in class_definitions %} {% set class_idx = loop.index0 %} {% set class_color = chart_colors[class_idx] if class_idx < chart_colors|length else "#cccccc" %} {% set class_value = chart_data[class_idx] if class_idx < chart_data|length else 0 %} {% set class_percentage = (class_value / chart_total * 100) if chart_total > 0 else 0 %} {% set _class_rule_display = ((tc_wind_range_labels or {}).get(class_def.class_id) or class_def.display_rule or format_class_range(class_def.min_value, class_def.max_value, class_def.unit)) %} {% set _is_tc_raw_class = _is_tc_hazard and ((tc_wind_range_labels or {}).get(class_def.class_id) or class_def.display_rule) %}
{% if _is_tc_raw_class %} {{ _class_rule_display }} {% else %} {{ ((class_label_translations or {}).get(class_def.label or class_def.name) or class_def.label or class_def.name) }}: {% endif %}
{% if not _is_tc_raw_class and not class_def.display_rule %}
{{ format_class_range(class_def.min_value, class_def.max_value, class_def.unit) }}
{% endif %}
{% if class_value >= 1000000 %} {{ "%.2f"|format(class_value / 1000000) }}M {% elif class_value >= 1000 %} {{ "%.1f"|format(class_value / 1000) }}K {% else %} {{ "%.0f"|format(class_value) }} {% endif %} {% if chart_context.unit %} {{ chart_context.unit }}{% endif %} ({{ format_pct_comprehensive_exposure(class_percentage, class_value) }}%)
{% endfor %}
{%- set _legend_is_km = chart_context.unit and chart_context.unit == "km" %} {%- set _legend_line = t.chart_labels.legend_line_km if _legend_is_km else t.chart_labels.legend_line %} {%- if _legend_line %} {{ _legend_line }} {%- else %} {{ t.chart_labels.legend_title|default('Legend:') }} {{ t.chart_labels.legend_thousand|default('K = Thousand (1,000)') }}, {{ t.chart_labels.legend_million|default('M = Million (1,000,000)') }} {%- if _legend_is_km %} β€’ {{ t.chart_labels.legend_km_note|default('Values shown in kilometers (km)') }}{% endif %} {%- endif %}
{% endif %}
{% endif %} {% if sections.impact_distribution_chart and sections.impact_distribution_chart.status == 'success' %}
{{ t.section_headers.impact_distribution|default('Impact Distribution') }}
{{ sections.impact_distribution_chart.svg_content|safe }}
{% endif %}