cdisc-org / cdisc-rules-engine

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

Rule blocked: CORERULES-FDAB054.6 #651

Open bdevriendt opened 3 months ago

bdevriendt commented 3 months ago

Links to related JIRA Tickets not existing at the moment

Rule Information

Describe the problem The FDAB054 rule can be broken down in multiple sub-rules, one of them being: For a same POOLDEF.POOLID, there should be more than one value for POOLDEF.USUBJID Positive
|| POOLID || USUBJID ||
|| 0001 || B0001 || || 0001 || B0003 || || 0001 || B0005 || || 0001 || B0006 || || 0002 || B0001 ||
|| 0002 || B0002 ||
|| 0002 || B0003 || || 0002 || B0005 || Negative || POOLID || USUBJID ||
|| 0001 || B0001 || || 0002 || B0001 || || 0002 || B0002 || || 0002 || B0003 || || 0002 || B0005 || Currently we do not have a way to count the number of distinct values in a specific subset of data.

Describe the solution We would need to be able to retrieve a list of USUBJIDs per POOLID and count how many are present in each list

Proposed rule logic

Check:
  all:
    - value: '$count'
      operator: 'greater_than'
      value: '1'  
Operation:
  - operator: "count_distinct_values_in_subset"
    domain: "POOLDEF"
    name: "USUBJID"
    id: "$count"
    group:
      - POOLID