def make_predictions():
    #today = pd.to_datetime("today").strftime("%Y-%m-%d")
    #yesterday = pd.to_datetime("today") - pd.Timedelta(days=1)
    #yesterday = yesterday.strftime("%Y-%m-%d")
    today = "2022-01-05"
    yesterday = "2022-01-04"

    data = load_data(yesterday, today)
    data = create_features(data)

    validated_data = schema.validate(data)

    #print(data.columns)

    #print("validado", validated_data.columns)

    model = joblib.load("model.joblib")
    predictions = model.predict(validated_data)

    predictions_df = pd.DataFrame(predictions,
                                  columns=["prediction"],
                                  index=data["index"])
    predictions_df.to_sql("predictions",
                          "sqlite:///data.db",
                          if_exists="append")
 def test_route_to_image_schema_validation(self):
     flexmock(image_schema).should_receive('validate').once()
     validate('images/my-image.yml', 'data')
 def test_unsupported_schema(self):
     err = validate('unknown/my-file.yml', 'data')
     self.assertEqual(err, ('Could not determine a schema\n'
                            'Supported schemas: image, rpm\n'
                            'Make sure the file is placed in either dir '
                            '"images" or "rpms"'))
 def test_route_to_rpm_schema_validation(self):
     flexmock(rpm_schema).should_receive('validate').once()
     validate('rpms/my-rpm.yml', 'data')