Skip to content

Warning Tasks

ecoscope.platform.tasks.warning

Functions:

mixed_subtype_warning

mixed_subtype_warning(subject_obs: Annotated[SubjectGroupObservationsGDF | EmptyDataFrame | SkipJsonSchema[None], Field(), SkippedDependencyFallback(skip_gdf_fallback_to_none)]) -> str | None

Utility function to provide a warning string to a workflow spec in the event of a mixed subject subtype

Source code in ecoscope/platform/tasks/warning/_warning.py
@register()
def mixed_subtype_warning(
    subject_obs: Annotated[
        SubjectGroupObservationsGDF | EmptyDataFrame | SkipJsonSchema[None],
        Field(),
        SkippedDependencyFallback(skip_gdf_fallback_to_none),
    ],
) -> str | None:
    """
    Utility function to provide a warning string to a workflow spec in the event of a mixed subject subtype
    """
    warning = "This workflow was run with mixed subtypes"
    return (
        warning
        if subject_obs is not None
        and not subject_obs.empty
        and len(subject_obs["extra__subject__subject_subtype"].unique()) > 1
        else None
    )