Added per-profile baseline readiness.
This commit is contained in:
@@ -182,6 +182,16 @@ class BaselineStore:
|
||||
output[entity].append(evidence)
|
||||
return output
|
||||
|
||||
def profile_readiness(self, profiles: dict[str, object]) -> list[dict[str, object]]:
|
||||
rows: list[dict[str, object]] = []
|
||||
with self._connect() as connection:
|
||||
for stream_id, profile in profiles.items():
|
||||
fields = [*getattr(profile, "categorical_fields", ()), *getattr(profile, "numeric_fields", ())]
|
||||
for field in fields:
|
||||
count = connection.execute("select count(distinct bucket_start) from profile_buckets where stream_id=? and field=?", (stream_id, str(field).lower())).fetchone()[0]
|
||||
rows.append({"stream_id": stream_id, "field": str(field), "buckets": count, "ready": count >= 12})
|
||||
return rows
|
||||
|
||||
def profiles(self, source_ips: set[str]) -> dict[str, dict[str, object]]:
|
||||
profiles: dict[str, dict[str, object]] = {}
|
||||
with self._connect() as connection:
|
||||
|
||||
Reference in New Issue
Block a user