cdisc-org / ddf-core-poc

This repository will contain the results from the Proof of Concept project.
MIT License
0 stars 1 forks source link

Create rule DDF00030: For classes with next and previous relationships, the next and previous relationships must establish an ordered list of instances of the class (valid EligibilityCriteria id values for nextId and previousId). #135

Closed ASL-rmarshall closed 7 months ago

ASL-rmarshall commented 10 months ago

Create rule to check for valid nextId and previousId values for EligibilityCriteria as defined for #79

ASL-rmarshall commented 10 months ago

@DianeWold This one is also ready for review. It's checking that the id values used in nextId and previousId in the EligibilityCritieria class are valid for both the study design and category.

DianeWold commented 10 months ago

Ran the negative test data. There were six errors, which it took me a while to understand. Row 1: EligibilityCriteria_0 is not an eligibility criterion for this study design. (doesn't exist in the data) Row 3: EligibilityCriteria_4 is not an eligibility criterion in the right category (C25532) Row 5: EligibilityCriteria_6 is not an eligibility criterion for this study design. (wrong study design) Row 7: EligibilityCriteria_1 is not an eligibility criterion for this study design (wrong study design) Row 9: EligibilityCriteria_8 is not an eligibiliity criterion in the right category (C25370) Row 10: EligibilityCriteria_11 is not an eligibility criterion for this study design (doesn't exist in the data) Will error messages eventually be more specific? Positive test data ran as expected.

BSnoeijerCD commented 9 months ago

@DianeWold @ASL-rmarshall The description of the core rule is not specific enough. It checks whether if a previous or next reference exists, then this reference is also existing in the list of eligibility criteria. Can we make it more specific?

From the actual check perspective, I think it would also be possible to include in this check that it does not reference to itself. or " previousID=id" or "nextId=id". Do you want to include that?

ASL-rmarshall commented 8 months ago

This rule has been updated to only report where rel_type = "definition". Associated test data have been updated and unit tests have been rerun successfully.

BSnoeijerCD commented 8 months ago

@DianeWold @ASL-rmarshall This check is now performed within a category: Inclusion / Exclusion However, we do not have to include that restriction as we can indicate the overall ordering of criteria without the limitation of category.

ASL-rmarshall commented 2 days ago

Saving a copy of the POC rule definition before deleting for DDF 4:

Authorities:
  - Organization: 'CDISC'
    Standards:
      - Name: USDM
        References:
          - Citations:
              - Cited Guidance: 'USDM'
                Document: 'USDM v2.6'
              - Cited Guidance: 'SDTMIG'
                Document: 'SDTMIG v3.4'
                Section: '7.2.1'
            Origin: USDM Conformance Rules
            Release Notes: ''
            Rule Identifier:
              Id: 'DDF00030'
              Version: '1'
            Validator Rule Message: ''
            Version: '1.0'
        Version: '3.0'
Check:
  all:
    - name: rel_type
      operator: equal_to
      value: 'definition'
    - any:
        - all:
            # An id value is specified for nextId
            - name: nextId
              operator: non_empty
            # And the specified nextId value is not a valid id for the StudyDesign ...
            - name: nextId
              operator: is_not_contained_by
              value: $el_crit_ids_for_study_design_cat
        # Or ...
        - all:
            # An id value is specified for previousId 
            - name: previousId
              operator: non_empty
            # And the specified previousId value is not a valid id for the StudyDesign ...
            - name: previousId
              operator: is_not_contained_by
              value: $el_crit_ids_for_study_design_cat
Core:
  Id: CORE-000422
  Status: Draft
  Version: '1'
Description: 'The eligibility criteria of a StudyDesign are ordered correctly
  according to the specifed nextId and previousId values.'
Executability: Fully Executable
Operations:
  - group:
      - parent_id
      - category.code
    id: $el_crit_ids_for_study_design_cat
    name: id
    operator: distinct
Outcome:
  Message: 'The eligibility criteria of a StudyDesign are not ordered correctly
    according to the specifed nextId and previousId values: the id value
    specified for nextId or previousId is not one of the eligibility criterion
    ids for the eligibility criteria category of the StudyDesign.'
  Output Variables:
    - parent_entity
    - parent_id
    - category.code
    - category.decode
    - id
    - nextId
    - previousId
    - $el_crit_ids_for_study_design_cat
Rule Type: Record Data
Scope:
  Entities:
    Include:
      - EligibilityCriteria
Sensitivity: Record