results/fetch_forecasts_script/fetch_forecasts.py
def run(self):
        """
        After data source, input, output directory have been set.
        Read "{source}.txt" to fetch the forecast reports' filenames.
        Generate the truth data set and forecast data set,
        and write down formatted forecast reports into csv.
        """
        forecasts = []
        with open(self.source + ".txt") as f:
            for line in f:
                forecasts.append(line.strip())
    
        observed = self.fetch_truth_cumulative_deaths()
        for forecast_filename in forecasts:
            try:
                forecast_date = datetime.datetime.strptime(forecast_filename[:10],"%Y-%m-%d")
                model_name = forecast_filename[11:-4]
                predicted = self.fetch_forecast_inc_deaths(self.input_directory + forecast_filename)
                self.write_report(model_name, forecast_date, observed,predicted)
            except:
                print("fail to read file " + forecast_filename + ".")

        After data source, input, output directory have been set.
        Read "{source}.txt" to fetch the forecast reports' filenames.
        Generate the truth data set and forecast data set,
        and write down formatted forecast reports into csv.
        
After data source, input, output directory have been set.
Read "{source}.txt" to fetch the forecast reports' filenames.
Generate the truth data set and forecast data set,
and write down formatted forecast reports into csv.
After data source input output directory have been set . Read " { source } . txt " to fetch the forecast reports ' filenames . Generate the truth data set and forecast data set and write down formatted forecast reports into csv .
def run(self):
        forecasts = []
        with open(self.source + ".txt") as f:
            for line in f:
                forecasts.append(line.strip())
        observed = self.fetch_truth_cumulative_deaths()
        for forecast_filename in forecasts:
            try:
                forecast_date = datetime.datetime.strptime(forecast_filename[:10],"%Y-%m-%d")
                model_name = forecast_filename[11:-4]
                predicted = self.fetch_forecast_inc_deaths(self.input_directory + forecast_filename)
                self.write_report(model_name, forecast_date, observed,predicted)
            except:
                print("fail to read file " + forecast_filename + ".")
def run ( self ) : forecasts = [ ] with open ( self . source + ".txt" ) as f : for line in f : forecasts . append ( line . strip ( ) ) observed = self . fetch_truth_cumulative_deaths ( ) for forecast_filename in forecasts : try : forecast_date = datetime . datetime . strptime ( forecast_filename [ : 10 ] , "%Y-%m-%d" ) model_name = forecast_filename [ 11 : - 4 ] predicted = self . fetch_forecast_inc_deaths ( self . input_directory + forecast_filename ) self . write_report ( model_name , forecast_date , observed , predicted ) except : print ( "fail to read file " + forecast_filename + "." )
After data source, input, output directory have been set.
After data source input output directory have been set .
"""
        After data source, input, output directory have been set.
        Read "{source}.txt" to fetch the forecast reports' filenames.
        Generate the truth data set and forecast data set,
        and write down formatted forecast reports into csv.
        """
self