audit_static¶
audit_static
¶
audit_static(stations: DataFrame, *, a7_scope: str = 'docked', a4_sigma: float = A4_SIGMA, a5_area_km2: float = A5_BBOX_MAX_KM2, a6_tau: float = A6_RATE_THRESHOLD, a7_tau: float = A7_RATE_THRESHOLD, n_min: int | None = None) -> DataFrame
Run the A1–A7 semantic audit on a canonical station-information frame.
All policy thresholds are exposed so the audit can be swept for sensitivity
analysis (see audit_sensitivity); every default equals
the published gbfs-audit-catalogue value, so calling with no keywords
reproduces the released verdicts exactly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stations
|
DataFrame
|
Canonical station inventory; requires
|
required |
a7_scope
|
('docked', 'all')
|
Scope of the A7 null-capacity rule. |
"docked"
|
a4_sigma
|
float
|
Multiplier of the robust (MAD-rescaled) scale in the A4 nearest-neighbour outlier rule. |
``3.0``
|
a5_area_km2
|
float
|
Bounding-box area (km²) above which a system trips the A5 out-of-perimeter rule. |
``50000``
|
a6_tau
|
float
|
Minimum share of zero-capacity docked stations for the A6 rule. |
``0.01``
|
a7_tau
|
float
|
Minimum share of null-capacity stations for the A7 rule. |
``0.50``
|
n_min
|
int
|
Override the minimum system size (number of stations) for the system-level
rules A2/A6/A7. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
One row per input station with boolean columns |
See Also
audit_dynamic : The companion D1-D3 audit of live availability payloads.
audit_frames : Run static and dynamic audits together on canonical frames.
drop_flagged : Keep only the stations that pass this audit, in one call.
audit_sensitivity : Sweep these thresholds to test conclusion robustness.
flag_rate_ci : Bootstrap a confidence interval on each class's flag rate.
Examples:
>>> import pandas as pd
>>> stations = pd.DataFrame({
... "system_id": "s", "station_id": ["a", "b"],
... "station_type": ["docked_bike", "carsharing"],
... "capacity": [20, 5], "lat": [48.85, 48.86], "lon": [2.35, 2.36],
... })
>>> audit_static(stations)[["station_id", "A1", "flagged"]]
station_id A1 flagged
0 a False False
1 b True True
Source code in src/gbfs_toolkit/audit/static.py
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | |