tdfs4ds.agent.light_helpers¶
tdfs4ds.agent.light_helpers
¶
Pure pandas helpers shared by the consumer agent and the admin panels.
They live here, not in consumer_agent, because the panels (dashboard, Feature catalog) must
work without the agent packages (pip install tdfs4ds[agent]); consumer_agent re-exports
them under their old names.
_distinct_feature_count
¶
Count distinct (DATA_DOMAIN, ENTITY_NAME, FEATURE_NAME) feature identities.
A feature's identity in tdfs4ds is that triplet: the same name registered under two entities, or in two data domains, is two distinct features (the domain is used when the frame carries a DATA_DOMAIN column). This helper is robust to duplicate rows (e.g. a feature appearing in several datasets) and to frames that expose ENTITY_ID instead of ENTITY_NAME.
Across stores (0.3.6.13): a triplet held by several stores counts once, and the first
store wins (read_federation.keep_first_store); store_conflicts() lists them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
pandas DataFrame containing at least FEATURE_NAME and an entity column (ENTITY_NAME preferred, ENTITY_ID accepted). |
required | |
group_by
|
Optional[str]
|
When given, return a |
None
|
Returns:
| Type | Description |
|---|---|
|
int when |
_freshness_segments
¶
Per-segment freshness when a process runs segmented (FilterManager).
Groups the follow-up rows by their APPLIED_FILTER segment and returns one
freshness record per distinct segment. Business dates (VALIDTIME_DATE) are
not segments: they are reported by _business_date_lines (0.3.1.240).
Returns:
[{segment, last_successful_run, days_since_update, has_recent_failure}],
sorted stalest-first. Returns [] when there is a single segment / no
FilterManager (caller keeps the existing global aggregation unchanged).