Explorar o código

Add oebb specific statement to flattening script

ogert %!s(int64=4) %!d(string=hai) anos
pai
achega
6a78c171a2
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  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: