Pre-flight
Problem or motivation
Concept.is_standard and Concept.is_standard_expr() are named for standardness but test membership of StandardConceptFlag.values through frozenset({'S', 'C'}).
Classification concepts therefore satisfy a predicate called is_standard
@property
def is_standard(self) -> bool:
value = self.standard_concept.strip() if self.standard_concept is not None else ""
return bool(value) and value in StandardConceptFlag.values
@classmethod
def is_standard_expr(cls) -> sa.SQLColumnExpression[bool]:
"""SQL-side counterpart to :attr:`is_standard`, for use in query filters."""
return normalised_flag_expr(cls.standard_concept).in_(StandardConceptFlag.values)
Proposed solution
Classification concepts are not valid mapping targets therefore they must be separable in downstream consumers
Replace ambiguous predicate with separate, correctly named ones
is_standard / is_standard_expr - 'S' only
is_classification / is_classification_expr - 'C' only
Important note:
negation must return the complement (~is_standard_expr() counts total − standard), and the Python and SQL halves must agree across None/''/' '/'S'/'C'/junk
Pre-flight
Problem or motivation
Concept.is_standardandConcept.is_standard_expr()are named for standardness but test membership ofStandardConceptFlag.valuesthroughfrozenset({'S', 'C'}).Classification concepts therefore satisfy a predicate called
is_standardProposed solution
Classification concepts are not valid mapping targets therefore they must be separable in downstream consumers
Replace ambiguous predicate with separate, correctly named ones
Important note:
negation must return the complement (~is_standard_expr() counts total − standard), and the Python and SQL halves must agree across None/''/' '/'S'/'C'/junk