|
17 | 17 | from feast.feature_logging import LoggingConfig |
18 | 18 | from feast.infra.offline_stores.file_source import FileLoggingDestination |
19 | 19 | from feast.on_demand_feature_view import on_demand_feature_view |
20 | | -from feast.types import Float32, Float64, Int64 |
| 20 | +from feast.types import Float32, Float64, Int64, Json, Map, String, Struct |
21 | 21 |
|
22 | 22 | # Define a project for the feature repo |
23 | 23 | project = Project(name="%PROJECT_NAME%", description="A project for driver statistics") |
|
52 | 52 | Field(name="conv_rate", dtype=Float32), |
53 | 53 | Field(name="acc_rate", dtype=Float32), |
54 | 54 | Field(name="avg_daily_trips", dtype=Int64, description="Average daily trips"), |
| 55 | + Field( |
| 56 | + name="driver_metadata", |
| 57 | + dtype=Map, |
| 58 | + description="Driver metadata as key-value pairs", |
| 59 | + ), |
| 60 | + Field( |
| 61 | + name="driver_config", dtype=Json, description="Driver configuration as JSON" |
| 62 | + ), |
| 63 | + Field( |
| 64 | + name="driver_profile", |
| 65 | + dtype=Struct({"name": String, "age": String}), |
| 66 | + description="Driver profile as a typed struct", |
| 67 | + ), |
55 | 68 | ], |
56 | 69 | online=True, |
57 | 70 | source=driver_stats_source, |
58 | 71 | # Tags are user defined key/value pairs that are attached to each |
59 | 72 | # feature view |
60 | 73 | tags={"team": "driver_performance"}, |
| 74 | + enable_validation=True, |
61 | 75 | ) |
62 | 76 |
|
63 | 77 | # Define a request data source which encodes features / information only |
@@ -119,6 +133,9 @@ def transformed_conv_rate(inputs: pd.DataFrame) -> pd.DataFrame: |
119 | 133 | Field(name="conv_rate", dtype=Float32), |
120 | 134 | Field(name="acc_rate", dtype=Float32), |
121 | 135 | Field(name="avg_daily_trips", dtype=Int64), |
| 136 | + Field(name="driver_metadata", dtype=Map), |
| 137 | + Field(name="driver_config", dtype=Json), |
| 138 | + Field(name="driver_profile", dtype=Struct({"name": String, "age": String})), |
122 | 139 | ], |
123 | 140 | online=True, |
124 | 141 | source=driver_stats_push_source, # Changed from above |
|
0 commit comments