You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the algorithm follows a compulsory order in which the seat configuration should be specified "seat designator should be in fixed order according to standard" However, sometimes SSIM files are received that do not stick to this fixed order. So e.g. J50O24Y202VV10 instead of J50Y202O24VV10. As a result, only part of the aircraft_configuration_string in _explode_aircraft_configuration_string() is being read.
I would recommend to focus on the aircraft_configuration_string instead of the fixed order in seat_class_designators. So replacing
string_remainder = aircraft_configuration_string.rstrip()
seat_class_designators = [
"P",
"F",
"A",
"J",
"C",
"D",
"I",
"Z",
"W",
"S",
"Y",
"B",
"H",
"K",
"L",
"M",
"N",
"Q",
"T",
"V",
"X",
"G",
"U",
"E",
"O",
"R",
]
cargo_designators = ["LL", "PP"] # unit load devices (containers) # pallets
integer_designators = {"seats": seat_class_designators, "cargo": cargo_designators}
acv_info = {}
# seat designator should be in fixed order according to standard
for designator_type, designators in integer_designators.items():
for designator in designators:
if string_remainder.startswith(designator) and ( # only continue if string starts with designator and...
len(designator) > 1
or not ( # either have a multi length designator
(len(string_remainder) > 1 and string_remainder[1] == string_remainder[0])
or string_remainder.startswith("V V")
)
): #
acv_info_key = designator_type + "_" + designator
# for next iteration, remove designator from beginning of string
string_remainder = string_remainder[len(designator):]
# standard specifies that there may be an int following. If not return empty string (to later on destinguish from NaN if data gets put in a data frame)
acv_info_val = ""
acv_regex = re.search(r"^\d*", string_remainder).group()
# if int found, add it to total and remove it from string to process as well
if acv_regex:
acv_info_val = int(acv_regex)
if designator_type == "seats":
if designator_type in acv_info.keys():
acv_info[designator_type] += acv_info_val
else:
acv_info[designator_type] = acv_info_val
string_remainder = string_remainder[len(acv_regex):]
# store found information
acv_info[acv_info_key] = acv_info_val
# remainer are general designators
if string_remainder.startswith("BB"):
acv_info["BB"] = ""
# aircraft type
if string_remainder.startswith("VV"):
acv_info["VV"] = string_remainder[2:]
elif string_remainder.startswith("V V"): # aircraft type alt. Assuming it won't appear together with VV.
acv_info["V V"] = string_remainder[3:]
elif len(string_remainder.strip()):
log_text = (
"After trying to process aircraft configuration string, there should be no remainder. However, the following string remains in this instance: (%s)"
% string_remainder
)
if raw_line:
log_text += "\n Raw slot line: " + raw_line
logging.warning(log_text)
by e.g.
string_remainder = aircraft_configuration_string.rstrip().replace(' ', '')
seat_class_designators = [
"P",
"F",
"A",
"J",
"C",
"D",
"I",
"Z",
"W",
"S",
"Y",
"B",
"H",
"K",
"L",
"M",
"N",
"Q",
"T",
"V",
"X",
"G",
"U",
"E",
"O",
"R",
]
# unit load devices (containers), number of pallets
cargo_designators = [
"LL",
"PP"
]
# general designators
general_designators = [
"VV",
"BB"
]
allowed_designators = {
**{x: "seats" for x in seat_class_designators},
**{y: "cargo" for y in cargo_designators},
**{z: "general" for z in general_designators}
}
acv_info = {}
included_designators = re.findall(r'(\w+?)(\d+)', string_remainder)
for designator_pair in included_designators:
assert len(designator_pair) == 2, \
"designator_pair does not contain type and number information"
designator = designator_pair[0]
acv_info_val = int(designator_pair[1])
if designator in allowed_designators.keys():
acv_info_type = allowed_designators[designator]
else:
log_text = (
"Designator (%s) is not recognised as valid type. Please check schedule"
% designator
)
if raw_line:
log_text += "\n Raw slot line: " + raw_line
logging.warning(log_text)
acv_info_type = "unknown"
acv_info_key = acv_info_type + "_" + designator
if acv_info_type == "seats":
if acv_info_type in acv_info.keys():
acv_info[acv_info_type] += acv_info_val
else:
acv_info[acv_info_type] = acv_info_val
# store found information
acv_info[acv_info_key] = acv_info_val
The text was updated successfully, but these errors were encountered:
Currently the algorithm follows a compulsory order in which the seat configuration should be specified "seat designator should be in fixed order according to standard" However, sometimes SSIM files are received that do not stick to this fixed order. So e.g. J50O24Y202VV10 instead of J50Y202O24VV10. As a result, only part of the aircraft_configuration_string in _explode_aircraft_configuration_string() is being read.

I would recommend to focus on the aircraft_configuration_string instead of the fixed order in seat_class_designators. So replacing
by e.g.
The text was updated successfully, but these errors were encountered: