Skip to content

Fix value-level greater_than comparator (used < instead of >) - #1822

Open
Rdag15 wants to merge 1 commit into
cdisc-org:mainfrom
Rdag15:fix/define-vlm-greater-than
Open

Fix value-level greater_than comparator (used < instead of >)#1822
Rdag15 wants to merge 1 commit into
cdisc-org:mainfrom
Rdag15:fix/define-vlm-greater-than

Conversation

@Rdag15

@Rdag15 Rdag15 commented Aug 12, 2026

Copy link
Copy Markdown

ValueLevelMetadata.greater_than() returns value < check_value — an exact copy of less_than() — so Define-XML value-level where-clauses with Comparator="GT" select the inverse set of rows. greater_than_or_equal_to() already uses >=, so the intended direction is clear.

Repro on main:

from unittest.mock import Mock
import pandas
from odmlib.define_2_1.model import CheckValue
from cdisc_rules_engine.models.define import ValueLevelMetadata

vlm = ValueLevelMetadata()
vlm.item = Mock(Name="TEST")
vlm.check_values = [CheckValue(_content="2")]
df = pandas.DataFrame.from_dict({"TEST": [3]})
print(vlm.greater_than()(df.iloc[0]))   # 3 > 2 -> should be True; on main prints False

Fix: change < to > in greater_than(). Added a test covering values above, at, and below the check value. One-line change plus test; no other comparator is affected.

ValueLevelMetadata.greater_than() returned `value < check` -- a copy of
less_than() -- so Define-XML value-level where-clauses with Comparator=GT
selected the inverse set of rows. greater_than_or_equal_to already uses >=.
Add a test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant