Skip to content

separate is_standard from new property is_classification #50

Description

@gkennos

Pre-flight

  • I searched existing issues and this has not been requested before.

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions