-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Road Impact Summary - Structure Impact Summary - Population Impact Summary - Polygon People Impact Summary Hide first: - Landcover Impact Summary
- Loading branch information
Showing
16 changed files
with
352 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# coding=utf-8 | ||
from collections import OrderedDict | ||
|
||
from geosafe.helpers.impact_summary.summary_base import ImpactSummary | ||
|
||
__author__ = 'Rizky Maulana Nugraha <[email protected]>' | ||
__date__ = '5/18/16' | ||
|
||
|
||
class StructureSummary(ImpactSummary): | ||
|
||
def total(self): | ||
return self.total_buildings() | ||
|
||
def total_buildings(self): | ||
return self.summary_dict().get('Total') | ||
|
||
def total_affected(self): | ||
if 'Affected buildings' in self.summary_dict().keys(): | ||
return self.summary_dict().get('Affected buildings') | ||
elif 'Not affected buildings' in self.summary_dict().keys(): | ||
not_affected = self.summary_dict().get('Not affected buildings') | ||
return int(self.total_buildings()) - int(not_affected) | ||
|
||
def breakdown_dict(self): | ||
ret_val = OrderedDict() | ||
for key, value in self.summary_dict().iteritems(): | ||
contain_total = 'total' in key.lower() | ||
contain_affected = 'affected' in key.lower() | ||
contain_not = 'not' in key.lower() | ||
if contain_total or (contain_affected and not contain_not): | ||
continue | ||
|
||
ret_val[key] = int(value) | ||
return ret_val | ||
|
||
def category_css_class(self, category): | ||
css_class = ImpactSummary.category_css_class(category) | ||
if not css_class: | ||
if 'flood' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'dry' in category.lower(): | ||
css_class = 'hazard-category-low' | ||
elif 'wet' in category.lower(): | ||
css_class = 'hazard-category-medium' | ||
elif 'radius' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
return css_class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# coding=utf-8 | ||
from collections import OrderedDict | ||
|
||
from geosafe.helpers.impact_summary.summary_base import ImpactSummary | ||
|
||
__author__ = 'Rizky Maulana Nugraha <[email protected]>' | ||
__date__ = '5/18/16' | ||
|
||
|
||
class PolygonPeopleSummary(ImpactSummary): | ||
|
||
def total(self): | ||
return self.total_people() | ||
|
||
def total_people(self): | ||
return int(self.summary_dict().get('Total people')) | ||
|
||
def total_affected(self): | ||
if 'Total affected people' in self.summary_dict().keys(): | ||
return int(self.summary_dict().get('Total affected people')) | ||
return 0 | ||
|
||
def breakdown_dict(self): | ||
ret_val = OrderedDict() | ||
for key, value in self.summary_dict().iteritems(): | ||
contain_total = 'total' in key.lower() | ||
contain_affected = 'affected' in key.lower() | ||
contain_not = 'not' in key.lower() | ||
contain_unaffected = 'unaffected' in key.lower() | ||
if (contain_total or | ||
(contain_affected and | ||
not contain_not and | ||
not contain_unaffected)): | ||
continue | ||
|
||
ret_val[key] = int(value) | ||
return ret_val | ||
|
||
def category_css_class(self, category): | ||
css_class = ImpactSummary.category_css_class(category) | ||
if not css_class: | ||
if 'people' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'fatalities' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'displaced' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'affected' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'floodprone' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'radius' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
return css_class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# coding=utf-8 | ||
from collections import OrderedDict | ||
|
||
from geosafe.helpers.impact_summary.summary_base import ImpactSummary | ||
|
||
__author__ = 'Rizky Maulana Nugraha <[email protected]>' | ||
__date__ = '5/18/16' | ||
|
||
|
||
class PopulationSummary(ImpactSummary): | ||
|
||
def total(self): | ||
return self.total_populations() | ||
|
||
def total_populations(self): | ||
return self.summary_dict().get('Total population') | ||
|
||
def total_affected(self): | ||
if 'Total affected population' in self.summary_dict().keys(): | ||
return int(self.summary_dict().get('Total affected population')) | ||
return 0 | ||
|
||
def breakdown_dict(self): | ||
ret_val = OrderedDict() | ||
for key, value in self.summary_dict().iteritems(): | ||
contain_total = 'total' in key.lower() | ||
contain_affected = 'affected' in key.lower() | ||
contain_not = 'not' in key.lower() | ||
contain_unaffected = 'unaffected' in key.lower() | ||
if (contain_total or | ||
(contain_affected and | ||
not contain_not and | ||
not contain_unaffected)): | ||
continue | ||
|
||
ret_val[key] = int(value) | ||
return ret_val | ||
|
||
def category_css_class(self, category): | ||
css_class = ImpactSummary.category_css_class(category) | ||
if not css_class: | ||
if 'people' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'fatalities' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'displaced' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'affected' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'floodprone' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
elif 'radius' in category.lower(): | ||
css_class = 'hazard-category-high' | ||
return css_class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
templates/geosafe/analysis/summary/polygon_people_report.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{% load geosafe_impact_summary %} | ||
{% load staticfiles %} | ||
<div class="impact-summary row"> | ||
<div class="summary col-xs-6"> | ||
<div class="row highlight"> | ||
<div class="col-xs-8"> | ||
<div class="number">{{ summary.total }}</div> | ||
<div class="category">Total Population</div> | ||
</div> | ||
<div class="col-xs-4"> | ||
{% with analysis.exposure_layer.metadata.category as c %} | ||
<img src="{% static "geosafe/img/"|add:c|add:".svg" %}" alt="{{ c }}" class="svg"/> | ||
{% endwith %} | ||
</div> | ||
</div> | ||
<div class="row highlight"> | ||
<div class="col-xs-8"> | ||
<div class="number">{{ summary.total_affected }}</div> | ||
<div class="category">Population Affected</div> | ||
</div> | ||
<div class="col-xs-4"> | ||
{% with analysis.hazard_layer.metadata.category as c %} | ||
<img src="{% static "geosafe/img/"|add:c|add:".svg" %}" alt="{{ c }}" class="svg"/> | ||
{% endwith %} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="category-breakdown col-xs-6"> | ||
<div class="title text-center">Hazard areas</div> | ||
<div class="content"> | ||
{% for category, value in summary.breakdown_dict.iteritems %} | ||
<div class="breakdown row {{ summary|category_css_class:category }}"> | ||
<div class="category col-xs-4 text-right">{{ category|lower|safe }}</div> | ||
<div class="value col-xs-4 text-right"> | ||
<div style="width: 100%">{{ value }}</div> | ||
</div> | ||
<div class="value col-xs-4 text-left"> | ||
{% with 84.5 as total_width %} | ||
<svg width="{{ total_width }}" height="20"> | ||
<rect x="0" rx="10" ry="10" height="20" width="{% widthratio value summary.total total_width %}"></rect> | ||
</svg> | ||
{% endwith %} | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{% load geosafe_impact_summary %} | ||
{% load staticfiles %} | ||
<div class="impact-summary row"> | ||
<div class="summary col-xs-6"> | ||
<div class="row highlight"> | ||
<div class="col-xs-8"> | ||
<div class="number">{{ summary.total }}</div> | ||
<div class="category">Total Population</div> | ||
</div> | ||
<div class="col-xs-4"> | ||
{% with analysis.exposure_layer.metadata.category as c %} | ||
<img src="{% static "geosafe/img/"|add:c|add:".svg" %}" alt="{{ c }}" class="svg"/> | ||
{% endwith %} | ||
</div> | ||
</div> | ||
<div class="row highlight"> | ||
<div class="col-xs-8"> | ||
<div class="number">{{ summary.total_affected }}</div> | ||
<div class="category">Population Affected</div> | ||
</div> | ||
<div class="col-xs-4"> | ||
{% with analysis.hazard_layer.metadata.category as c %} | ||
<img src="{% static "geosafe/img/"|add:c|add:".svg" %}" alt="{{ c }}" class="svg"/> | ||
{% endwith %} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="category-breakdown col-xs-6"> | ||
<div class="title text-center">Hazard areas</div> | ||
<div class="content"> | ||
{% for category, value in summary.breakdown_dict.iteritems %} | ||
<div class="breakdown row {{ summary|category_css_class:category }}"> | ||
<div class="category col-xs-4 text-right">{{ category|lower|safe }}</div> | ||
<div class="value col-xs-4 text-right"> | ||
<div style="width: 100%">{{ value }}</div> | ||
</div> | ||
<div class="value col-xs-4 text-left"> | ||
{% with 84.5 as total_width %} | ||
<svg width="{{ total_width }}" height="20"> | ||
<rect x="0" rx="10" ry="10" height="20" width="{% widthratio value summary.total total_width %}"></rect> | ||
</svg> | ||
{% endwith %} | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.