cdisc-org / cdisc-rules-engine

Open source offering of the cdisc rules engine
MIT License
45 stars 12 forks source link

Error when using non-string operator values with Match Datasets #738

Open ASL-rmarshall opened 1 week ago

ASL-rmarshall commented 1 week ago

If operators that have non-string (e.g., list) values for value (such as is_contained_by) are used with Match Datasets, the following error is reported:

'list' object has no attribute 'startswith'

The error occurs because the dataset preprocessor tries to remove domain prefixes from column references in target values without accounting for non-string target values.

This error can be prevented with a simple change - inserting a type check at line 79 of dataset_preprocessor.py:

                    if type(target) == str and target.startswith(f"{domain_name}.")
                       ^^^^^^^^^^^^^^^^^^^^^^^
ASL-rmarshall commented 1 week ago

I haven't (yet) reported this as blocking a rule because I have used a workaround for using is_contained_by with Match Datasets - in DDF00037, I have used any with equal_to instead.

ASL-rmarshall commented 1 week ago

If there are any operators that have a list of column references as a value, the fix would need to be a bit more complicated to handle that too.