Browse Source

Add oebb specific statement to flattening script

ogert 4 years ago
parent
commit
6a78c171a2
1 changed files with 5 additions and 1 deletions
  1. 5 1
      cdplib/FlattenData.py

+ 5 - 1
cdplib/FlattenData.py

@@ -133,8 +133,12 @@ class FlattenData():
             key = incoming_key
             if incoming_key is not None:
                 # OEBB SPECIFIC IF STATEMENT
-                if type(data_list[iteration]) is dict and 'stationsnummer' in data_list[iteration].keys() and 'stage' in data_list[iteration].keys() :
+                if type(data_list[iteration]) is dict and 'stationsnummer' in data_list[iteration].keys():
+                        key = incoming_key + '_' + str(data_list[iteration]['stationsnummer'])
+                
+                elif type(data_list[iteration]) is dict and 'stationsnummer' in data_list[iteration].keys() and 'stage' in data_list[iteration].keys() :
                         key = incoming_key + '_' + str(data_list[iteration]['stationsnummer']) + '_' + str(data_list[iteration]['stage'])
+                
                 else:
                     key = incoming_key + '_' + str(iteration)
             else: