Exemplo n.º 1
0
 def user_download_data(data_requested):
     if data_requested:
         return {
             "filename": Path(self.data_path).name,
             "content": base64encode(get_data(self.data_path).to_csv()),
             "mime_type": "text/csv",
         }
     return None
Exemplo n.º 2
0
 def user_download_data(
     data_requested,
     radio_value,
     realizations_check,
     realizations_input,
 ):
     if data_requested:
         content = get_data(self.csv_file)
         if realizations_check:
             realizations = parse_range(realizations_input)
             if realizations:
                 content = content[content["realization"].isin(
                     realizations)]
         if radio_value == "Statistics":
             filename = "objective_statistics.csv"
             content = calculate_statistics(content)
         else:
             filename = "objective_values.csv"
         return {
             "filename": filename,
             "content": base64encode(content.to_csv()),
             "mime_type": "text/csv",
         }
     return None