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

Rule blocked: CORERULES-1689

Open
#587 0 comments 0 reactions 1 assignee Claimed by @aniemes View on GitHub
ADaM
Dominant language
Python
Stars
113
Forks
43
Avg merge
14h 51m
Merged PRs (30d)
14

Description

-
- ADaM Rule 64 Jira ID CORERULES-1689
- Fill in the following information

**Links to related JIRA Tickets**

**Rule Information**
- **Standard**: ADaM
- **Rule ID**: 64
- **Rule Description**: The rule checks for presence of TRTxxAN and non presence of TRTxxA in ADSL

**Describe the problem**
How to handle the subscripts on the variable names metadata, which xx ranges from 01-99. If the numerical variable is present e.g TRT01AN then TRT01A must also be present.

**Describe the solution**
Solution was discussed at weekly meet, where variables would be extracted and compared to/matched to a regular expression to confirm presence. This would use the exisiting reg_match operator to compare against general pattern e.g 'value: ^TRT[0-9]{2}AN*' . This part currently exists.

However the solution proposes a new operation using regex via a find and replace operation using regex capture buffers to extract the xx value from the primary variable and use this to create the shorten name (minus the "n") of the second variable. This will then be used to define the second predicate in the rule logic.

**Proposed rule logic**
```yaml```

Check:
all:
- name: variable_name # e.g. TRT11AN
operator: matches_regex # test 1 exist clause
value: ^TRT[0-9]{2}AN*$
#new test clause using the new operation
- name: $generated_variable_name # TRT11A
operator: is_not_contained_by
value: variable_name # e.g. returns column vector [TRT11AN, ABCDE, FGHIJ]
Operations:
- find: ^TRT([0-9]{2})AN*$
id: $generated_variable_name
name: variable_name
operator: regex_find_replace
replace: TRT\1A # uses capture buffer to extract xx and create secondary variable.

**Screenshots**
If applicable, add screenshots to help explain your problem and solution.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.