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

Python-side code for the Quality LAC Data Beta frontend
https://903.datatoinsight.org
MIT License
8 stars 4 forks source link

Bug: Rule 359 - Wrong row highlighted in FE #746

Open SLornieCYC opened 8 months ago

SLornieCYC commented 8 months ago

Describe the bug When runing the tool in-year for a client who turns 18 before 31 March, but after today, and the client has more than one episode in the year, the wrong episode is flagged in the Front End (FE).

To Reproduce 1) Have a client in the Header file with a birthdate that means they will become 18 in March. 2) Have the same client in the Episodes file with two episodes. One episode with DECOM and DEC before today's date, and a second episode DECOM on the same day as the previous episode DEC, but with no DEC (and neither of which are the V2/K2 LS/PL combo excluded by the validation rule). 3) Upload these files to the FE (make sure to select the right return year!) and note that the first, ended, episode is marked up as in-error, even though that episode ended before the client's 18th birthday, and the second, active, episode is not in error.

Expected behavior The episode flagged as in-error should be the open episode (no DEC) because, in terms of the return/validation logic, that episode is "open at 31 March" which is after the client turns 18 (even though we're running this in-year and their 18th birthday is still currently in the future).

Screenshots Example using a dummy client:

image

WillLP-code commented 4 months ago

I'm having a look at this back end and I can't replicate it, I am wondering if it's finding the error and then highlighting the first row with the same child id. Back end, I get the correct row as the error: https://github.com/data-to-insight/csc-validator-be-903/compare/main...bug/359

SLornieCYC commented 4 months ago

Agree, I can't replicate it in the back either. But I don't understand how the FE processes the data it receives to try and unpick that side of things! I'll try a couple of other straightforward rules in the FE using multi-row sample data and see if they have the same issue.

SLornieCYC commented 4 months ago

Yep @WillLP-code seems to be something in the FE that isn't applying the highlights to correct table rows. Definitely applies to Episodes and Reviews files. See attached sample data for examples where rules 144, 167, INT17, 143, 392b, 145, 178, 392d, 504 are all highlighting the first row when the actual data in error is on the second+ row. SSDA903_Episodes.csv SSDA903_Header.csv SSDA903_Reviews.csv

(Note 169 and 179 currently don't highlight any rows or fields because the relevant field is internal only and therefore not in the FE table; I'll make a separate issue to amend these to highlight the postcode field from which the internal data is derived).