data-to-insight / csc-validator-be-cin

1 stars 1 forks source link

Bug: Rule 2885 - Incorrect fails against CINdetails DateOfInitialCPC #429

Closed SLornieCYC closed 1 year ago

SLornieCYC commented 1 year ago

Describe the bug Some records are failing this rule (revised in #355) where CPPstartDate matches the DateOfInitialCPC in CINdetails but there is no S47 record.

For example:

<CINdetails>
<DateOfInitialCPC>SAMEDATE</DateOfInitialCPC>
<ChildProtectionPlans>
<CPPstartDate>SAMEDATE</CPPstartDate>
</ChildProtectionPlans>
# Note there is no Section47 module!
</CINdetails>

Expected behavior These cases should pass the rule as the CPPstartDate has a matching DateOfInitialCPC in CINdetails.

tab1tha commented 1 year ago

What happened here is that when a record wasn't found in the section47 table, its NaN date failed when compared with the CPPstartDate. Such that if it later passed in the CIN table, it would have already been recorded as a record that fails the rule.

I've changed the merge of cpp and section47 to only consider records that are in both tables. Now, the pass/fail of any record not found in the Section47 table will solely be determined by the records pass/fail status in the CIN table, as we expect.