hub/imports/usage/helpers/usage_helper.py

65 lines
1.8 KiB
Python
Raw Normal View History

"""
Usage helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
import helpers.constants as cte
class UsageHelper:
2021-08-27 12:51:30 -04:00
"""
Usage helper class
2021-08-27 12:51:30 -04:00
"""
usage_to_hft = {
cte.RESIDENTIAL: 'residential',
cte.INDUSTRY: 'industry',
cte.OFFICE_ADMINISTRATION: 'office and administration',
cte.HOTEL: 'hotel',
cte.HEALTH_CARE: 'health care',
cte.RETAIL: 'retail',
cte.HALL: 'hall',
cte.RESTAURANT: 'restaurant',
cte.EDUCATION: 'education'
}
hft_default_value = 'residential'
@staticmethod
def hft_from_usage(usage):
"""
Get HfT usage from the given internal usage key
:param usage: str
:return: str
"""
try:
return UsageHelper.usage_to_hft[usage]
except KeyError:
sys.stderr.write('Error: keyword not found. Returned default HfT usage "residential"\n')
return UsageHelper.hft_default_value
usage_to_comnet = {
cte.RESIDENTIAL: 'BA Multifamily',
cte.INDUSTRY: 'BA Manufacturing Facility',
cte.OFFICE_ADMINISTRATION: 'BA Office',
cte.HOTEL: 'BA Hotel',
cte.HEALTH_CARE: 'BA Hospital',
cte.RETAIL: 'BA Retail',
cte.HALL: 'BA Town Hall',
cte.RESTAURANT: 'BA Dining: Bar Lounge/Leisure',
cte.EDUCATION: 'BA School/University'
}
comnet_default_value = 'BA Multifamily'
@staticmethod
def comnet_from_usage(usage):
"""
Get Comnet usage from the given internal usage key
:param usage: str
:return: str
"""
try:
return UsageHelper.usage_to_comnet[usage]
except KeyError:
sys.stderr.write('Error: keyword not found. Returned default Comnet usage "BA Multifamily"\n')
return UsageHelper.comnet_default_value