code: def save_data(self):
          
  
          state = ""
          try:
  
              state = "create_json_archive"
              log.info("creating json archive")
              self.create_json_archive()
  
              state = "building_unique_keys"
              log.info("processing all unique keys")
              self.build_all_keys_dict()
  
              state = "flattening"
              log.info("flattening all data")
              self.flatten_all()
  
              state = "converting"
              log.info("converting to df")
              self.convert_to_df()
  
              state = "saving"
              log.info("saving to df")
              self.save_df_as_csv()
  
              if ANTINEX_PUBLISH_ENABLED:
                  log.info(("publishing stream to rest={}")
                           .format(
                              ANTINEX_URL))
                  self.publish_predictions_to_core()
              # end of if publishing to the core
  
          except Exception as e:
              log.error(("Failed state={} with ex={} to "
                         "save={}")
                        .format(state,
                                e,
                                self.save_to_file))
docs: save_data