from typing import List


def is_valid_spec(spec: List) -> bool:
    """
    Helper function to filter out obviously invalid specs
    """
    _, treatment_spec, outcome_spec, model_spec, estimator_spec = spec
    if (
        (treatment_spec["variable"] != model_spec["treatment"])
        or (outcome_spec["variable"] != model_spec["outcome"])
        or (
            not model_spec["confounders"]
            and not model_spec["effect_modifiers"]
            and estimator_spec["require_propensity_score"]
        )
    ):
        return False
    else:
        return True