diff --git a/comptages/comptages.py b/comptages/comptages.py index f892361a..475042da 100644 --- a/comptages/comptages.py +++ b/comptages/comptages.py @@ -20,7 +20,6 @@ from comptages.chart.chart_dialog import ChartDock from comptages.config.config_creator import ConfigCreatorCmd from comptages.plan.plan_creator import PlanCreator -from comptages.report.yearly_report_creator import YearlyReportCreator from comptages.report.yearly_report_bike import YearlyReportBike from comptages.ics.ics_importer import IcsImporter from comptages.ui.resources import * diff --git a/comptages/data/count_data.py b/comptages/data/count_data.py deleted file mode 100644 index 6322889b..00000000 --- a/comptages/data/count_data.py +++ /dev/null @@ -1,69 +0,0 @@ -from statistics import mean - - -class CountData(): - - def __init__(self): - self.day_data = [] - self.attributes = {} - self.month_data = [0]*12 - - def average_total(self, direction=None, days=None): - if days is None: - return round( - mean([i.total(direction) for i in self.day_data])) - return round( - mean([self.day_data[i].total(direction) for i in days])) - - def average_light_vehicles(self, direction=None, days=None): - if days is None: - return round( - mean([i.light_vehicles(direction) for i in self.day_data])) - return round( - mean([self.day_data[i].light_vehicles(direction) for i in days])) - - def average_heavy_vehicles(self, direction=None, days=None): - if days is None: - return round( - mean([i.heavy_vehicles(direction) for i in self.day_data])) - return round( - mean([self.day_data[i].heavy_vehicles(direction) for i in days])) - - def average_percent_heavy_vehicles(self, direction=None, days=None): - if days is None: - return round( - mean([i.percent_heavy_vehicles(direction) - for i in self.day_data]), 1) - return round( - mean([self.day_data[i].percent_heavy_vehicles(direction) - for i in days]), 1) - - def speed_cumulus(self, direction, days): - bin_size = len( - self.day_data[0].hour_data[0].direction_data[0].speed_data) - _ = [0]*bin_size - result = [_]*24 - for i in days: - day = self.day_data[i] - for j in range(24): - result[j] = [sum(pair) for pair in zip( - result[j], day.hour_data[j].speed(direction))] - return result - - def category_cumulus(self, direction, days): - bin_size = len( - self.day_data[0].hour_data[0].direction_data[0].category_data) - _ = [0]*bin_size - result = [_]*24 - for i in days: - day = self.day_data[i] - for j in range(24): - result[j] = [sum(pair) for pair in zip( - result[j], day.hour_data[j].category(direction))] - return result - - def total(self, direction, days): - return sum([self.day_data[i].total(direction) for i in days]) - - def __str__(self): - return str("Count data: {}".format(self.day_data)) diff --git a/comptages/data/data_loader.py b/comptages/data/data_loader.py deleted file mode 100644 index 8396b864..00000000 --- a/comptages/data/data_loader.py +++ /dev/null @@ -1,263 +0,0 @@ -from qgis.PyQt.QtSql import QSqlQuery - -from comptages.core.utils import connect_to_db -from comptages.data.count_data import CountData -from comptages.data.day_data import DayData -from comptages.data.hour_data import HourData -from comptages.data.direction_data import DirectionData - - -class DataLoader(): - - _monthly_coefficients = [93, 96, 100, 102, 101, 104, - 98, 98, 104, 103, 102, 98] - - def __init__(self, count_id, section_id, status): - self.db = connect_to_db() - self.count_id = count_id - self.section_id = section_id - self.status = status - self.categories = [] - self.light_vehicles = [] - self.populate_category_and_light_index() - self.attributes = {} - self.query = QSqlQuery(self.db) - - def load(self, count_data=None): - - self.attributes['aggregate'] = False - if self.is_data_aggregate(): - self.attributes['aggregate'] = True - - self.read_attributes() - if not count_data: - count_data = CountData() - - count_data.attributes = self.attributes - dates = self.get_count_dates() - self.attributes['dates'] = dates - for date in dates: - - if self.is_data_aggregate(): - day_data = DayData() - for hour in range(24): - hour_data = HourData() - for direction in range(1, 3): - direction_data = DirectionData(self.light_vehicles) - direction_data.speed_data, \ - direction_data.category_data = \ - self.get_aggregate_direction_data( - date[0], date[1], date[2], hour, direction) - hour_data.direction_data.append(direction_data) - day_data.hour_data.append(hour_data) - day_data.monthly_coefficient = self._monthly_coefficients[ - date[1]-1] - else: - day_data = self.get_detail_day_data( - date[0], date[1], date[2]) - - day_data.monthly_coefficient = self._monthly_coefficients[ - date[1]-1] - count_data.day_data.append(day_data) - - count_data.month_data[date[1]] += day_data.total() - self.db.close() - return count_data - - def get_aggregate_direction_data(self, year, month, day, hour, direction): - query = self.query - - query_str = ( - "select cou.type, sum(cls.value), cls.id_category, sum(spd.value) " - "from comptages.count_aggregate as cou " - "join comptages.lane as lan on cou.id_lane = lan.id " - "left join comptages.count_aggregate_value_cls as cls on " - "cls.id_count_aggregate = cou.id " - "left join comptages.count_aggregate_value_spd as spd on " - "spd.id_count_aggregate = cou.id " - "where " - "date_part('year', start) = {} and " - "date_part('month', start) = {} and " - "date_part('day', start) = {} and " - "date_part('hour', start) = {} and " - "cou.id_count = {} and " - "direction = {} and " - "id_section = '{}' and " - "import_status = {} " - "group by cou.type, cls.id_category, spd.low " - "order by cls.id_category, spd.low ".format( - year, month, day, hour, self.count_id, direction, - self.section_id, self.status)) - - query.exec_(query_str) - - speed_data = [0]*12 - category_data = [0]*len(self.categories) - - spd_index = 0 - while query.next(): - if query.value(0) == 'CLS': - category_data[self.category_index( - int(query.value(2)))] += int(query.value(1)) - elif query.value(0) == 'SPD': - speed_data[spd_index] = int(query.value(3)) - spd_index += 1 - - return speed_data, category_data - - def get_detail_day_data(self, year, month, day): - day_data = DayData() - query = self.query - - query_str = ( - "select cou.speed, cou.id_category, " - "date_part('hour', cou.timestamp), lan.direction from " - "comptages.count_detail as cou " - "join comptages.lane as lan on cou.id_lane = lan.id " - "where date_part('year', timestamp) = {} " - "and date_part('month', timestamp) = {} " - "and date_part('day', timestamp) = {} " - "and id_count = {} " - "and id_section = '{}' " - "and import_status = {};".format( - year, month, day, self.count_id, - self.section_id, self.status)) - query.exec_(query_str) - - hour_datas = [] - - for _ in range(25): - hour_data = HourData() - direction_data_1 = DirectionData(self.light_vehicles) - direction_data_1.speed_data = [0]*13 - direction_data_1.category_data = [0]*len(self.categories) - - direction_data_2 = DirectionData(self.light_vehicles) - direction_data_2.speed_data = [0]*13 - direction_data_2.category_data = [0]*len(self.categories) - - hour_data.direction_data.append(direction_data_1) - hour_data.direction_data.append(direction_data_2) - hour_datas.append(hour_data) - - while query.next(): - - hour = int(query.value(2)) - direction = int(query.value(3))-1 - speed = int(query.value(0)) - - if speed > 120: - speed = 121 - - hour_datas[hour].direction_data[direction].speed_data[ - int(speed/10)] += 1 - - hour_datas[hour].direction_data[direction].category_data[ - self.category_index(int(query.value(1)))] += 1 - - day_data.hour_data = hour_datas - return day_data - - def category_index(self, category_id): - return self.categories.index(category_id) - - def populate_category_and_light_index(self): - query = QSqlQuery(self.db) - - query_str = ( - "select cat.id, cat.light from comptages.count as cou " - "join comptages.class_category as cc on " - "cou.id_class = cc.id_class " - "join comptages.category as cat on cat.id = cc.id_category " - "where cou.id = {};".format(self.count_id) - ) - query.exec_(query_str) - i = 0 - while query.next(): - self.categories.append(int(query.value(0))) - if query.value(1): - self.light_vehicles.append(i) - i += 1 - - def get_count_dates(self): - query = QSqlQuery(self.db) - - query_str = ( - "select start_process_date, end_process_date " - "from comptages.count where id = {};".format(self.count_id) - ) - query.exec_(query_str) - - result = [] - while query.next(): - start_date = query.value(0) - end_date = query.value(1) - - i = 0 - while True: - date = start_date.addDays(i) - if date <= end_date: - result.append(( - int(date.toString('yyyy')), - int(date.toString('MM')), - int(date.toString('dd')))) - i += 1 - else: - break - - return result - - def is_data_aggregate(self): - query = QSqlQuery(self.db) - - query_str = ( - "select id from comptages.count_aggregate " - "where id_count = {}".format(self.count_id)) - - query.exec_(query_str) - if query.next(): - return True - return False - - def read_attributes(self): - query = QSqlQuery(self.db) - - query_str = ( - "select cou.remarks, sty.name, mdl.name, cla.name " - "from comptages.count as cou " - "join comptages.sensor_type as sty on cou.id_sensor_type = sty.id " - "join comptages.model as mdl on cou.id_model = mdl.id " - "join comptages.class as cla on cou.id_class = cla.id " - "where cou.id = {} ".format(self.count_id)) - - query.exec_(query_str) - - query.next() - self.attributes['remarks'] = query.value(0) - self.attributes['sensor_type'] = query.value(1) - self.attributes['model'] = query.value(2) - self.attributes['class'] = query.value(3) - - query_str = ( - "select sec.owner, sec.road, sec.way, sec.start_pr, sec.end_pr, " - "sec.start_dist, sec.end_dist, sec.place_name, " - "lan.direction, lan.direction_desc " - "from comptages.section as sec " - "inner join comptages.lane as lan on sec.id = lan.id_section " - "where sec.id = '{}' ".format(self.section_id)) - - query.exec_(query_str) - - while query.next(): - self.attributes['owner'] = query.value(0) - self.attributes['road'] = query.value(1) - self.attributes['way'] = query.value(2) - self.attributes['start_pr'] = query.value(3) - self.attributes['end_pr'] = query.value(4) - self.attributes['start_dist'] = query.value(5) - self.attributes['end_dist'] = query.value(6) - self.attributes['place_name'] = query.value(7) - if int(query.value(8)) == 1: - self.attributes['dir1'] = query.value(9) - elif int(query.value(8)) == 2: - self.attributes['dir2'] = query.value(9) diff --git a/comptages/data/day_data.py b/comptages/data/day_data.py deleted file mode 100644 index bfdf424d..00000000 --- a/comptages/data/day_data.py +++ /dev/null @@ -1,25 +0,0 @@ - - -class DayData(): - - def __init__(self): - self.hour_data = [] - self.monthly_coefficient = 0 - - def total(self, direction=None): - return sum([i.total(direction) for i in self.hour_data]) - - def light_vehicles(self, direction=None): - return sum([i.light_vehicles(direction) for i in self.hour_data]) - - def heavy_vehicles(self, direction=None): - return sum([i.heavy_vehicles(direction) for i in self.hour_data]) - - def percent_heavy_vehicles(self, direction=None): - if self.total(direction) * self.heavy_vehicles(direction) == 0: - return 0 - return round(100 / self.total(direction) * - self.heavy_vehicles(direction), 1) - - def __str__(self): - return str(self.hour_data) diff --git a/comptages/data/direction_data.py b/comptages/data/direction_data.py deleted file mode 100644 index 54fc28eb..00000000 --- a/comptages/data/direction_data.py +++ /dev/null @@ -1,28 +0,0 @@ - - -class DirectionData(): - - def __init__( - self, light_indexes=[]): - self.light_indexes = light_indexes - self.speed_data = [] - self.category_data = [] - - def total(self): - result = sum(self.category_data) - if result == 0: - result = sum(self.speed_data) - return result - - def light_vehicles(self): - return sum([self.category_data[i] for i in self.light_indexes]) - - def heavy_vehicles(self): - return self.total() - self.light_vehicles() - - def percent_heavy_vehicles(self): - return round(100 / self.total() * self.heavy_vehicles(), 1) - - def __str__(self): - return str("Speed_data: {}, category_data: {}".format( - self.speed_data, self.category_data)) diff --git a/comptages/data/hour_data.py b/comptages/data/hour_data.py deleted file mode 100644 index 7f8a0b9c..00000000 --- a/comptages/data/hour_data.py +++ /dev/null @@ -1,36 +0,0 @@ - - -class HourData(): - - def __init__(self): - self.direction_data = [] - - def total(self, direction=None): - if direction is None: - return sum([i.total() for i in self.direction_data]) - return self.direction_data[direction].total() - - def light_vehicles(self, direction=None): - if direction is None: - return sum([i.light_vehicles() for i in self.direction_data]) - return self.direction_data[direction].light_vehicles() - - def heavy_vehicles(self, direction=None): - if direction is None: - return sum([i.heavy_vehicles() for i in self.direction_data]) - return self.direction_data[direction].heavy_vehicles() - - def percent_heavy_vehicles(self, direction=None): - if self.total(direction) * self.heavy_vehicles(direction) == 0: - return 0 - return round(100 / self.total(direction) * - self.heavy_vehicles(direction), 1) - - def speed(self, direction): - return self.direction_data[direction].speed_data - - def category(self, direction): - return self.direction_data[direction].category_data - - def __str__(self): - return str(self.direction_data) diff --git a/comptages/report/yearly_report_creator.py b/comptages/report/yearly_report_creator.py deleted file mode 100644 index ac006806..00000000 --- a/comptages/report/yearly_report_creator.py +++ /dev/null @@ -1,314 +0,0 @@ -import os -import datetime -from openpyxl import load_workbook - -from qgis.PyQt.QtCore import QDate -from comptages.core.settings import Settings - -from comptages.data.data_loader import DataLoader -from comptages.data.count_data import CountData -from comptages.core.layers import Layers - - -class YearlyReportCreator(): - def __init__(self, file_path, layers, year, section_id, clazz): - self.file_path = file_path - self.layers = layers - self.year = year - self.section_id = section_id - self.clazz = clazz - - def run(self): - - # Get the list of all the count_is of the section for the year - counts = self.layers.get_counts_of_section_by_year( - self.section_id, self.year) - - merged_count_data = CountData() - - for count in counts: - count_id = count.attribute('id') - class_of_count = self.layers.get_class_name_of_count(count_id) - if not class_of_count == self.clazz: - continue - data_loader = DataLoader( - count_id, self.section_id, - Layers.IMPORT_STATUS_DEFINITIVE) - merged_count_data = data_loader.load(merged_count_data) - - self._export_report(merged_count_data) - - def _export_report(self, count_data): - current_dir = os.path.dirname(os.path.abspath(__file__)) - class_name = self._translate_class_name(count_data.attributes['class']) - if class_name in ['ARX Cycle', 'SPCH-MD 5C']: - template = os.path.join(current_dir, 'template_yearly_arx.xlsx') - else: - template = os.path.join(current_dir, 'template_yearly.xlsx') - wb = load_workbook(filename=template) - - self._set_data_count(wb, count_data) - self._set_data_day(wb, count_data) - self._set_data_month(wb, count_data) - self._set_data_speed(wb, count_data) - - self._set_data_category(wb, count_data) - self._remove_useless_sheets(wb, count_data) - - # Save the file - output = os.path.join( - self.file_path, '{}_{}_r.xlsx'.format(self.section_id, self.year)) - - wb.save(filename=output) - - def _set_data_count(self, workbook, count_data): - - ws = workbook['Data_count'] - - ws['B3'] = ('Poste de comptage : {} Axe : {}:{}{} ' - 'PR {} + {} m à PR {} + {} m').format( - self.section_id, - count_data.attributes['owner'], - count_data.attributes['road'], - count_data.attributes['way'], - count_data.attributes['start_pr'], - int(round(count_data.attributes['start_dist'])), - count_data.attributes['end_pr'], - int(round(count_data.attributes['end_dist']))) - - ws['B4'] = 'Periode de comptage du 01/01/{0} au 31/12/{0}'.format( - self.year) - - ws['B5'] = 'Comptage {}'.format(self.year) - - ws['B6'] = 'Type de capteur : {}'.format( - count_data.attributes['sensor_type']) - ws['B7'] = 'Modèle : {}'.format( - count_data.attributes['model']) - ws['B8'] = 'Classification : {}'.format( - count_data.attributes['class']) - - ws['B9'] = 'Comptage véhicule par véhicule' - if count_data.attributes['aggregate']: - ws['B9'] = 'Comptage par interval' - - ws['B11'] = count_data.attributes['place_name'] - - ws['B12'] = 'Remarque : {}'.format( - count_data.attributes['remarks'] - if type(count_data.attributes['remarks']) == str else '') - - ws['B13'] = count_data.attributes['dir1'] - - if 'dir2' in count_data.attributes: - ws['B14'] = count_data.attributes['dir2'] - - def _set_data_day(self, workbook, count_data): - ws = workbook['Data_day'] - - # TODO: aggregate days - days = count_data.day_data[0:7] - - day_cols_tot = ['B', 'C', 'D', 'E', 'F', 'G', 'H'] - section_start_cell = 5 - coefficient_cell = 31 - dir1_start_cell = 35 - dir1_light_cell = 61 - dir1_heavy_cell = 62 - dir2_start_cell = 66 - dir2_light_cell = 92 - dir2_heavy_cell = 93 - for i, day_data in enumerate(days): - for j in range(24): - ws['{}{}'.format(day_cols_tot[i], j+section_start_cell)] = \ - day_data.hour_data[j].total() - ws['{}{}'.format(day_cols_tot[i], j+dir1_start_cell)] = \ - day_data.hour_data[j].total(0) - ws['{}{}'.format(day_cols_tot[i], j+dir2_start_cell)] = \ - day_data.hour_data[j].total(1) - - ws['{}{}'.format(day_cols_tot[i], coefficient_cell)] = \ - '{}%'.format(day_data.monthly_coefficient) - ws['{}{}'.format(day_cols_tot[i], dir1_light_cell)] = \ - day_data.light_vehicles(0) - ws['{}{}'.format(day_cols_tot[i], dir2_light_cell)] = \ - day_data.light_vehicles(1) - ws['{}{}'.format(day_cols_tot[i], dir1_heavy_cell)] = \ - day_data.heavy_vehicles(0) - ws['{}{}'.format(day_cols_tot[i], dir2_heavy_cell)] = \ - day_data.heavy_vehicles(1) - - def _set_data_month(self, workbook, count_data): - ws = workbook['Data_month'] - - month_cols_tot = ['B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M'] - section_start_cell = 4 - for i in range(12): - ws['{}{}'.format(month_cols_tot[i], section_start_cell)] = count_data.month_data[i] - - def _set_data_speed(self, workbook, count_data): - ws = workbook['Data_speed'] - - speed_cols = ['B', 'C', 'D', 'E', 'F', 'G', 'H', - 'I', 'J', 'K', 'L', 'M', 'N'] - dir1_start_cell = 5 - dir2_start_cell = 33 - average_class_speeds_row = 60 - - average_class_speeds = [] - if count_data.attributes['aggregate']: - average_class_speeds = [12.5, 22.5, 35, 45, - 55, 65, 75, 85, 95, - 105, 115, 125] - - for i, speed in enumerate(average_class_speeds): - ws['{}{}'.format( - speed_cols[i], average_class_speeds_row)] = speed - - #days_idx = [x for x in range(start_day, end_day+1)] - days_idx = [x for x in range(8)] - dir1 = count_data.speed_cumulus(0, days=days_idx) - dir2 = count_data.speed_cumulus(1, days=days_idx) - - start_timestamp = datetime.date(self.year, 1, 1).strftime('%Y-%m-%d') - - end_timestamp = (datetime.date(self.year, 1, 1).strftime('%Y-%m-%d')) - - for i, hour in enumerate(dir1): - for j, speed in enumerate(hour): - ws['{}{}'.format(speed_cols[j], i+dir1_start_cell)] = speed - - # if not count_data.attributes['aggregate']: - # # Average and characteristic speed - # char_speed = self.layers.get_characteristic_speeds( - # self.count_id, i, 1, start_timestamp, end_timestamp, - # self.section_id) - # ws['P{}'.format(i+dir1_start_cell)] = char_speed[0] - # ws['Q{}'.format(i+dir1_start_cell)] = char_speed[1] - # ws['R{}'.format(i+dir1_start_cell)] = char_speed[2] - # ws['S{}'.format(i+dir1_start_cell)] = char_speed[3] - - for i, hour in enumerate(dir2): - for j, speed in enumerate(hour): - ws['{}{}'.format(speed_cols[j], i+dir2_start_cell)] = speed - - # if not count_data.attributes['aggregate']: - # # Average and characteristic speed - # char_speed = self.layers.get_characteristic_speeds( - # self.count_id, i, 2, start_timestamp, end_timestamp, - # self.section_id) - # ws['P{}'.format(i+dir2_start_cell)] = char_speed[0] - # ws['Q{}'.format(i+dir2_start_cell)] = char_speed[1] - # ws['R{}'.format(i+dir2_start_cell)] = char_speed[2] - # ws['S{}'.format(i+dir2_start_cell)] = char_speed[3] - - def _set_data_category(self, workbook, count_data): - if self._translate_class_name(count_data.attributes['class']) == 'Volume': - return - - ws = workbook['Data_category'] - - cat_cols = ['B', 'C', 'D', 'E', 'F', 'G', 'H', - 'I', 'J', 'K'] - - dir1_start_cell = 5 - dir2_start_cell = 33 - - days_idx = [x for x in range(8)] - dir1 = count_data.category_cumulus(0, days=days_idx) - dir2 = count_data.category_cumulus(1, days=days_idx) - - for i, hour in enumerate(dir1): - # The report is configurated for SWISS7 or SWISS10 data. - # If the data is in another class, we need to translate it to - # SWISS7 or SWISS10 - hour = self._translate_class_hour(count_data, hour) - for j, cat in enumerate(hour): - # Don't consider cat 0 (TRASH) in the report - if j == 0: - continue - - ws['{}{}'.format(cat_cols[j-1], i+dir1_start_cell)] = cat - - for i, hour in enumerate(dir2): - hour = self._translate_class_hour(count_data, hour) - for j, cat in enumerate(hour): - # Don't consider cat 0 (TRASH) in the report - if j == 0: - continue - - ws['{}{}'.format(cat_cols[j-1], i+dir2_start_cell)] = cat - - def _remove_useless_sheets(self, workbook, count_data): - - class_name = self._translate_class_name(count_data.attributes['class']) - - if class_name == 'SWISS10': - workbook.remove_sheet(workbook['SWISS7_H']) - workbook.remove_sheet(workbook['SWISS7_G']) - elif class_name == 'SWISS7': - workbook.remove_sheet(workbook['SWISS10_H']) - workbook.remove_sheet(workbook['SWISS10_G']) - elif class_name == 'Volume': - workbook.remove_sheet(workbook['SWISS7_H']) - workbook.remove_sheet(workbook['SWISS7_G']) - workbook.remove_sheet(workbook['SWISS10_H']) - workbook.remove_sheet(workbook['SWISS10_G']) - elif class_name in ['ARX Cycle', 'SPCH-MD 5C']: - workbook.remove_sheet(workbook['SWISS7_H']) - workbook.remove_sheet(workbook['SWISS7_G']) - workbook.remove_sheet(workbook['SWISS10_H']) - workbook.remove_sheet(workbook['SWISS10_G']) - - if count_data.attributes['aggregate']: - workbook.remove_sheet(workbook['Vit_Hd']) - else: - workbook.remove_sheet(workbook['Vit_H']) - - def _translate_class_hour(self, count_data, hour): - """Convert a class to another one e.g. FHWA13 - should be converted in SWISS7 in order to fill the - report cells""" - - if count_data.attributes['class'] == 'SWISS10': - return hour - - if count_data.attributes['class'] == 'SWISS7': - return hour - - if count_data.attributes['class'] in ['ARX Cycle', 'SPCH-MD 5C']: - new_hour = [0] * 7 - return new_hour - - if count_data.attributes['class'] == 'FHWA13': - new_hour = [0] * 8 - - new_hour[0] = hour[0] - new_hour[1] = hour[4] - new_hour[2] = hour[1] - new_hour[3] = hour[2] - new_hour[4] = hour[3] - new_hour[5] = hour[5] + hour[6] + hour[7] - new_hour[6] = hour[11] + hour[12] - new_hour[7] = hour[8] + hour[9] + hour[10] + hour[13] + hour[14] - return new_hour - - def _translate_class_name(self, name): - - if name == 'SWISS10': - return name - - if name == 'SWISS7': - return name - - if name == 'ARX Cycle': - return name - - if name == 'SPCH-MD 5C': - return name - - if name == 'FHWA13': - return 'SWISS7' - - if name is None: - return 'Volume'