Skip to content

Conversation

@tomjemmett
Copy link
Member

spells with over a 2 year length of stay are incredibly rare, outside of mental health. this filter aims to remove any long length of stay that is likely caused by a data quality issue

spells with over a 2 year length of stay are incredibly rare, outside of mental health. this filter aims to remove any long length of stay that is likely caused by a data quality issue
@tomjemmett tomjemmett marked this pull request as ready for review November 20, 2025 11:58
@tomjemmett tomjemmett requested a review from a team as a code owner November 20, 2025 11:58
@tomjemmett tomjemmett self-assigned this Nov 20, 2025
@tomjemmett tomjemmett added the enhancement New feature or request label Nov 20, 2025
@tomjemmett
Copy link
Member Author

checked counts on databricks, is removing an expected number of rows

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a data quality filter to remove hospital spells with excessively long lengths of stay (over 2 years) that are likely caused by data quality issues. The filter excludes long stays except for mental health cases or cases with 10 or more episodes.

  • Filters out spells with duration > 2 years that are likely data quality errors
  • Preserves mental health specialty spells (specialty codes starting with "7")
  • Preserves complex cases with many episodes (10 or more)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@yiwen-h yiwen-h left a comment

Choose a reason for hiding this comment

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

Thank you! Note to self: add to project info as well

@tomjemmett tomjemmett merged commit 957576b into main Nov 21, 2025
3 checks passed
@tomjemmett tomjemmett deleted the filter_out_long_los branch November 21, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants