<jupyter_start><jupyter_text>Updating the Feature Store<jupyter_code>def generate_dummy_data(size: int) -> List[Dict]:
    """ Generate dummy data """
    
    data = [
        {
            "user_id": i + 1, 
            "conv_rate": round(random(), 2),
            "acc_rate": round(random(), 2),
            "avg_daily_trips": randint(1, 10),
            "event_timestamp": (datetime.now() - timedelta(days=randint(1, 30),
                                                           hours=randint(1, 24),
                                                           minutes=randint(1, 60))),
            "created": (datetime.now() - timedelta(days=randint(1, 30),
                                                           hours=randint(1, 24),
                                                           minutes=randint(1, 60))),            
        } for i in range(size)
    ]
    
    return data
FILE_SOURCE = "../stores/staging/data/user_hourly_purchases.parquet"

df = pd.DataFrame(
        generate_dummy_data(size=100)
    )

df.to_parquet(FILE_SOURCE, index=False)

df
STORE = "../stores/staging"
VIEW_NAME = "user_hourly_purchases"

!cd {STORE} && feast materialize-incremental {datetime.now().isoformat()} --views {VIEW_NAME}<jupyter_output>Materializing [1m[32m1[0m feature views to [1m[32m2021-10-19 20:11:05-04:00[0m into the [1m[32msqlite[0m online store.

[1m[32muser_hourly_purchases[0m from [1m[32m2021-12-31 19:00:00-05:00[0m to [1m[32m2021-10-19 20:11:05-04:00[0m:
0it [00:00, ?it/s]<jupyter_text>Retrieving Features from Feature Store<jupyter_code>FEATURE_STORE_CONFIG = {
    "repo_path": "../stores/staging"
}

features = [
    "user_hourly_purchases:conv_rate",
    "user_hourly_purchases:acc_rate",
]

fs = FeatureStore(**FEATURE_STORE_CONFIG)
user_ids = (1, 2, 3)

online_features = fs.get_online_features(
                        features=features,
                        entity_rows=[{"user_id": u} for u in user_ids]
                    ).to_dict()
features = pd.DataFrame(online_features)

features<jupyter_output><empty_output><jupyter_text>Generating Predictions<jupyter_code>from random import randint

class DummyModel:
    """ Dummy Model """
    
    def predict(self, row):
        return randint(0, 1)    
model = DummyModel()
features["predictions"] = features.apply(model.predict)

features<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1340899537620849, 'fraction_numerical': 0.0487599831862127, 'mean_word_length': 2.4146341463414633, 'pattern_counts': {'":': 8, '<': 12, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '407273', 'license': 'MIT', 'n_tokens_mistral': 873, 'n_tokens_neox': 786, 'n_words': 132, 'path': 'notebooks/Feast Usage.ipynb', 'repo_name': 'MrHenryD/feature-store', 'size': '2379'}