Skip to content

Commit

Permalink
Update Match Datasets documentation (#212)
Browse files Browse the repository at this point in the history
* Update Match Datasets documentation

* Describe effect of left join
  • Loading branch information
ASL-rmarshall authored Mar 14, 2024
1 parent d9d2863 commit abf5a00
Showing 1 changed file with 68 additions and 4 deletions.
72 changes: 68 additions & 4 deletions docs/match_datasets.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Match Datasets (Merge)

## Non pivoted relationship - unique variable names
## Non pivoted relationship - unique check variable names

> MH.MHENDTC >= DM.RFSTDTC
> Matching on MH.USUBJID = DM.USUBJID: MH.MHENDTC >= DM.RFSTDTC
```yaml
Rule Type: Date Arithmetic
Expand All @@ -17,9 +17,9 @@ Match Datasets:
- USUBJID
```
## Non pivoted relationship - shared variable names
## Non pivoted relationship - shared check variable names
> --.VISITDY != TV.VISITDY
> Matching on --.VISITNUM = TV.VISITNUM: --.VISITDY != TV.VISITDY
```yaml
Check:
Expand All @@ -33,6 +33,70 @@ Match Datasets:
- VISITNUM
```
## Non pivoted relationship - non-matching key variable names
Allows for joining datasets with parent datasets using non-matching key variable names. The `Left` key is the name of the variable in the parent dataset and the `Right` key is the name of the variable in the dataset whose name is specified in `Name`.

> Condition: If specimen type is specified in RELSPEC and BS, the values should be the same in both datasets.

> Rule: Matching on RELSPEC.USUBJID = BS.USUBJID and RELSPEC.REFID = BS.BSREFID: RELSPEC.SPEC != BS.BSSPEC

```yaml
Check:
all:
- name: SPEC
operator: not_equal_to
value: BSSPEC
Match Datasets:
- Name: BS
Keys:
- USUBJID
- Left: REFID
Right: BSREFID
Scope:
Domains:
Include:
- RELSPEC
```

## Non pivoted relationship - left join

Allows for joining datasets with parent datasets, keeping all records from the parent dataset and only records with matching key values from the dataset whose name is specified in `Name`. `Join Type` may be `inner` or `left`. If `Join Type` is not specified, an inner join is performed (i.e., only records with matching key values in both datasets are kept).

> Condition: Extracted or aliquoted specimens should have a parent specimen identified in the RELSPEC dataset.

> Rule: Matching on BE.USUBJID = RELSPEC.USUBJID and BE.BEREFID = RELSPEC.REFID: BEDECOD in ("EXTRACTING", "ALIQUOTING") AND RELSPEC.PARENT is empty

Reports extracting/aliquoting records from BE where:

- There is a matching record in RELSPEC, but PARENT is empty
- There is no matching record in RELSPEC.

```yaml
Check:
all:
- any:
- name: BEDECOD
operator: equal_to
value: EXTRACTING
- name: BEDECOD
operator: equal_to
value: ALIQUOTING
- name: PARENT
operator: empty
Match Datasets:
- Name: RELSPEC
Keys:
- USUBJID
- Left: BEREFID
Right: REFID
Join Type: left
Scope:
Domains:
Include:
- BE
```

## Pivoted (Supp/VL) relationship

> Record present in SUPPAE where SUPPAE.QNAM=AESOSP and AESMIE != 'Y'
Expand Down

0 comments on commit abf5a00

Please sign in to comment.