Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add with_at_least_one_day_in_critical_care filter to admitted_to_hospital #854

Merged
merged 1 commit into from
Aug 10, 2022

Conversation

rebkwok
Copy link
Contributor

@rebkwok rebkwok commented Aug 10, 2022

Fixes #828

Copy link
Contributor

@evansd evansd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One small suggestion which I'll leave to your judgement as to whether it's helpful or not.

@@ -2548,6 +2549,9 @@ def patients_admitted_to_hospital(
value_sql = ", ".join(map(quote, to_list(column_value)))
conditions.append(f"{supported_columns[column_name]} IN ({value_sql})")

if with_at_least_one_day_in_critical_care:
conditions.append("APCS_Der.Spell_PbR_CC_Day > 0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit superfluous because MSSQL will spot that we're comparing to an int and CAST the string column automatically, but it might be clearer to do this explicitly e.g.

Suggested change
conditions.append("APCS_Der.Spell_PbR_CC_Day > 0")
conditions.append("CAST(APCS_Der.Spell_PbR_CC_Day AS int) > 0")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - while I was adding the tpp_backend code I'd thought about that and meant to come back to it, but I was kind of expecting the tests to compain and remind me :)

@rebkwok rebkwok force-pushed the critical-care-days-filter branch from 49a9a2f to eeeed90 Compare August 10, 2022 10:27
@rebkwok rebkwok merged commit 76eb09f into main Aug 10, 2022
@rebkwok rebkwok deleted the critical-care-days-filter branch August 10, 2022 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add with_at_least_one_day_in_critical_care filter to admitted_to_hospital
2 participants