Closed WillLP-code closed 1 year ago
Hi Will, Thank you for this level of detail. Let me push a release out and then I can go through this a bit later.
Might be one to revisit in the DFE portal once it opens again in April for the live return (the familiarisation blade closed last week) to properly test different tag combinations and see whether there is any difference in how they are treated by the validation rule.
E.g.
<Reviews/>
<Reviews><CPPreviewdate/></Reviews>
<Reviews><CPPreviewdate></CPPreviewdate></Reviews>
Another thing to consider is that although we know the DFE xml generator creates those self-closing <Reviews/>
tags which seem to not trigger errors in the portal (only my word for that so far!), not all LAs produce their CIN xml in the same way. Some use xml files generated directly by their social care CMS which may behave differently.
8842Q says:
@SLornieCYC @tab1tha I'm tagging you both in this as I think it needs some thought. First, a TL;DR: DFE XML generator builds Review blocks as empty where there is no CPPreviewDate, the DFE validator also lets empty Review blocks pass 8842Q -thus the DFE validator won't fail data where the original data had no CPPreviewDate.
Now in detail:
8842Q raises false positives where XMLs have a self closing block with no CPPreviewDate.
Lets start from the beginning to explain why this happens:
1 . When using the DFE XML generator, the generator will make things called short_empty_elements where a block would be, but there's nothing to go in it. These are self closing elements and look like
<Reviews/>
rather than<Reviews></Reviews>
.Now, we can avoid building these Review blocks for children with an empty Reviews block by using the XPath [tag] syntax, replacing [tag] with [CPPreviewDate]. This means that it will only build Review blocks for children where there is a CPPreviewDate child to the Reviews block. That's what I've done in this PR. This, as afar as I can see, mirrors what the DFE validator does and only builds review blocks to validate where it would have built a review block in the fist place: where there is a CPPreviewDate. However, this looks really really silly, based on our current interpretation of the rule, if, in cases where a Reviews block has no CPPreviewDate, isn't that what the rule is supposed to check? Surely then this way of coding things would not raise these issues? That's right, but we might be interpreting the rule right.
It's possible to interpret the rule as, instead of saying 'Is there a CPPreviewDate', instead it's saying, if there's a non-empty review block, is the CPPreviewDate valid/right? The reasoning behind this interpretation is that the DFE XML generator, where there is no CPPreviewDate, will make a self closing element, and will then not raise the error. So, where LAs have submitted data to the XML generator where there is no CPPreviewDate, the XML generator will generate the self closing block, these blocks are passed over in the DFEs generator, and thus, where there is no CPPreviewDate, the DFE validator will never fail it.
The DFE guidance on what's right is here:
(potentially) closes #384