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

Bug: Overlapping episode fix can create episodes that are too old for the returns #169

Open
2 tasks
MichaelHanksSF opened this issue Feb 17, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@MichaelHanksSF
Copy link
Contributor

Depending on how bad the input data is, this piece of code:

# If a child has overlapping episodes, shorten the earlier one decom_next = combined.groupby("CHILD")["DECOM"].shift(-1) change_ix = combined["DEC"].isna() | combined["DEC"].gt(decom_next) combined.loc[change_ix, "DEC"] = decom_next[change_ix]

lines 180-183 in datacontainer.py

can create a DEC which is smaller than the first date of the earliest return. This happens prior to the derivation of datacontainer.data_start_date so it could push this date earlier than it should be. This will have the knock-on effect of the historic graph starting too early and the default transition rates being skewed.

Possible fixes could be:

  • calculate datacontainer.data_start_date before this fix is put in plac
  • remove episodes that are impacted by code above that have DEC older than oldest return

Probably the second?

@MichaelHanksSF MichaelHanksSF added the bug Something isn't working label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant