Skip to content

adds filter to remove long los (data quality) - #226

Merged
tomjemmett merged 2 commits into
mainfrom
filter_out_long_los
Nov 21, 2025
Merged

adds filter to remove long los (data quality)#226
tomjemmett merged 2 commits into
mainfrom
filter_out_long_los

Conversation

@tomjemmett

Copy link
Copy Markdown
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
Copy Markdown
Member Author

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/nhp/data/nhp_datasets/apc.py

@yiwen-h yiwen-h left a comment

Copy link
Copy Markdown
Member

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