audit_dynamic¶
audit_dynamic
¶
audit_dynamic(availability: DataFrame, *, ttl_seconds: float | None = None, stale_after_minutes: float = 60.0, buffer_seconds: float = 60.0) -> DataFrame
Logic checks on a live availability frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
availability
|
DataFrame
|
A status frame (ideally joined with info for |
required |
ttl_seconds
|
float
|
The feed's advertised TTL. When given, staleness is
|
None
|
stale_after_minutes
|
float
|
Fallback staleness window when |
60
|
buffer_seconds
|
float
|
Grace period added to |
60
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
See Also
audit_static : The companion A1-A7 audit of the static inventory.
audit_frames : Run the static and dynamic audits together on canonical frames.
Examples:
A negative bike count trips D1; the healthy station passes:
>>> import pandas as pd
>>> avail = pd.DataFrame({
... "station_id": ["a", "b"],
... "num_bikes_available": [5, -1],
... "num_docks_available": [10, 4],
... })
>>> audit_dynamic(avail)[["station_id", "D1_negative", "flagged"]]
station_id D1_negative flagged
0 a False False
1 b True True