cdisc-org / cdisc-org/cdisc-rules-engine

dataframe_operator harmonization

Open
#1,809 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
113
Forks
43
Avg merge
14h 51m
Merged PRs (30d)
14

Description

Currently there are 4 ways comparators and targets are accessed in operators:

**Direct column access, whole dataset**: ```self.value[target]``` — used by less_than, contains, is_contained_by, matches_regex, is_ordered_by, etc. Strict — raises KeyError on missing column. This is target-fetching in the majority of operators.

**Row-wise access inside .apply()**: ```row[target]``` / ```row[comparator]``` — used only by _check_equality/_check_inequality (equal_to/not_equal_to family). Strict for target, lenient-with-literal-fallback for comparator.

**Column access via get_comparator_data**: ```self.value.get(comparator, comparator)``` — lenient, bug.

**custom comparator exceptions**: value_is_reference (row[comparator] gives a column name, then row[that_column_name] — double indirection),
prefix_equal_to's if comparator == "DOMAIN": ...column_prefix_map["--"] hardcoded branch
list-valued comparators in contains_all/is_unique_set/is_contained_by_case_insensitive.

it would be good to harmonize the base fetching logic for both target and comparator to prevent differences in rule execution based on operator choice

Contributor guide

Open the contributing guide

Research direction

Start by reading the operator implementations that use direct column access, row-wise access, get_comparator_data, and the listed custom comparator paths such as _check_equality and value_is_reference. Trace how targets and comparators are fetched, then verify that the harmonized behavior preserves the documented strict, fallback, indirection, and list-valued cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.