Skip to main content

get_validation()

Get the validation of one dataset from a Validate-based report.

Usage

Source

get_validation(name)

The "validate" engine of the SubmissionPackage method validate_conformance() makes a Validate validation for each dataset. The get_validation() method gets one of them, so that its validation report or its failing rows can be looked at. Indexing the report (as in report["AE"]) does the same, but get_validation() gives a more helpful error for a name that isn’t in the report. Reports of the built-in rules and of CDISC CORE don’t have validations.

Parameters

name: str
The name of the dataset, such as "AE". This is case-insensitive.

Returns

Validate
The validation of the dataset.

Raises

KeyError
If the report has no validation for that dataset. The error message lists the datasets that it has validations for.

Examples

Let’s check a package where the AE dataset has a subject, STUDY01-009, who isn’t in DM:

import pointblank as pb
import polars as pl

dm = pl.DataFrame({"USUBJID": ["STUDY01-001", "STUDY01-002"], "DOMAIN": ["DM", "DM"]})
ae = pl.DataFrame(
    {
        "USUBJID": ["STUDY01-001", "STUDY01-009"],
        "DOMAIN": ["AE", "AE"],
        "AESEQ": [1, 1],
    }
)

study = pb.SubmissionPackage(datasets={"DM": dm, "AE": ae})
report = study.validate_conformance(engine="validate")

report.get_validation("ae")
STEP COLUMNS VALUES TBL EVAL UNITS PASS FAIL W E C EXT
#4CA64C 1
col_vals_not_null
col_vals_not_null()
DOMAIN — ✓ 2 2
1.00
0
0.00
— — — —
#4CA64C 2
col_vals_not_null
col_vals_not_null()
USUBJID — ✓ 2 2
1.00
0
0.00
— — — —
#4CA64C 3
col_vals_not_null
col_vals_not_null()
AESEQ — ✓ 2 2
1.00
0
0.00
— — — —
#4CA64C 4
col_vals_in_set
col_vals_in_set()
DOMAIN AE ✓ 2 2
1.00
0
0.00
— — — —
#4CA64C 5
col_vals_gt
col_vals_gt()
AESEQ 0 ✓ 2 2
1.00
0
0.00
— — — —
#4CA64C 6
col_vals_expr
col_vals_expr()

DOMAIN length <= 2

DOMAIN COLUMN EXPR ✓ 2 2
1.00
0
0.00
— — — —
#4CA64C 7
col_vals_expr
col_vals_expr()

USUBJID length <= 40

USUBJID COLUMN EXPR ✓ 2 2
1.00
0
0.00
— — — —
#4CA64C66 8
specially
specially()

USUBJID values exist in DM (AE → DM)

EXPR ✓ 2 1
0.50
1
0.50
— — — —

The last step checks that each USUBJID in AE is in DM, and it has one failing test unit. The validation is an ordinary Validate object, so methods such as get_step_report() can be used on it to see the failing record.