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

SW12STG2 #751

Closed WillLP-code closed 4 months ago

WillLP-code commented 8 months ago

Closes #680

I'm going to have to come back to this when I've done the other rules, it doesn't work and I need to think about how to calculate periods of non-respite care, separate them, and then calculate if SW episodes exist for each of them

codecov-commenter commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (15179c5) 95.27% compared to head (74191e7) 95.27%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #751 +/- ## ======================================= Coverage 95.27% 95.27% ======================================= Files 313 313 Lines 7717 7717 ======================================= Hits 7352 7352 Misses 365 365 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

SLornieCYC commented 4 months ago

The add_col_to_episodes_CONTINUOUSLY_LOOKED_AFTER function in lac_validator/utils.py may be of help with determining non-respite periods of care (the code logic within, not the actual function). E.g. using RNE = "S" and REC <> "X1" to identify breaks in periods of care.

I'm thinking something like this:

1) Make sure there is a SW episode where SW_DECOM <= episode DEC where REC <> "X1" 2) Make sure there is a SW episode where SW_DECOM >= episode DECOM where RNE = "S" 3) Exclude episodes from the above where LS = V3/V4

I'm assuming another rule somewhere is testing "has a SW episode if open at end of year".

WillLP-code commented 4 months ago

The add_col_to_episodes_CONTINUOUSLY_LOOKED_AFTER function in lac_validator/utils.py may be of help with determining non-respite periods of care (the code logic within, not the actual function). E.g. using RNE = "S" and REC <> "X1" to identify breaks in periods of care.

I'm thinking something like this:

  1. Make sure there is a SW episode where SW_DECOM <= episode DEC where REC <> "X1"
  2. Make sure there is a SW episode where SW_DECOM >= episode DECOM where RNE = "S"
  3. Exclude episodes from the above where LS = V3/V4

I'm assuming another rule somewhere is testing "has a SW episode if open at end of year".

@SLornieCYC I've made a further attempt at this, trying to take into account what you said. I haven't written a test yet because I wanted to check if this was along the lines of what you had in mind? I'm happy for you to change/completely re-do this if you want to and find you have time

SLornieCYC commented 4 months ago

@SLornieCYC I've made a further attempt at this, trying to take into account what you said. I haven't written a test yet because I wanted to check if this was along the lines of what you had in mind? I'm happy for you to change/completely re-do this if you want to and find you have time

I've added some more feedback and written some test data based on what I think should pass and fail! (But I could be wrong!)

WillLP-code commented 4 months ago

@SLornieCYC I can't believe how long I've worked at this only for you to manage it in an afternoon with a really elegant solution! Well done! I'm just getting it in and committing it, then, if you approve it, I'll work on getting a new version pushed with the new ingress and the last of these rules done!