def case_handler_2nd_pass()

in sitewise_export_tools/asset_model_exporter.py [0:0]


def case_handler_2nd_pass(k,v):
    #Find the HierarchyLogicalId and PropertyLogicalId keys inside Value dictionary. We need to use our lookup tables we populated in the first pass to replace IDs with logical IDs. 
    if k == 'Value' and isinstance(v, dict):
          if 'HierarchyLogicalId' in v and 'PropertyLogicalId' in v:
              return {'PropertyLogicalId':property_logical_id_lookup[v['PropertyLogicalId']], 'HierarchyLogicalId':hierarchy_logical_id_lookup[v['HierarchyLogicalId']]}  
          if 'PropertyLogicalId' in v:
              return {'PropertyLogicalId':property_logical_id_lookup[v['PropertyLogicalId']]}
          else:
                return v
    else:
          return v