Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Internal transfers are counted as readmissions

Ouverte
#1,269 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 3 jours

@thebean27 y travaille déjà.

Depuis le 6/10/2026.

  • #1275 par @thebean27 — ouverte

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
python
Domaine
data

Piste de recherche

The issue provides a reproducer using admissions.csv.gz and points to the prior exclusion clause removed in PR #815; start by tracing the readmission-label logic and reviewing PR #815 and the open PR #1275. Compare how admissions less than an hour apart are labeled with the intended treatment of internal transfers. Done means the behavior is addressed or its intended configuration is clarified, with tests covering the relevant case.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Hi, first of all thank you for your repo; it has been useful for my research and very easy to use.

I have found an issue wherein internal transfers are counted as readmissions rather than treated as part of the same visit; which I think is surprising and probably not what most people want to model.

Reproduce (needs only admissions.csv.gz)

import polars as pl
pl.Config.set_fmt_str_lengths(60)   # print full admission_location strings

adm = (
    pl.read_csv("data/mimiciv/3.1/hosp/admissions.csv.gz", try_parse_dates=True)
       .sort("subject_id", "admittime")
       .with_columns(
              next_admit=pl.col("admittime").shift(-1).over("subject_id"),
              next_loc=pl.col("admission_location").shift(-1).over("subject_id")
       )
       .filter(pl.col("next_admit").is_not_null())
)
gap = pl.col("next_admit") - pl.col("dischtime")
pos = adm.filter(gap < pl.duration(days=30))          # the task's label rule
split = pos.filter(gap < pl.duration(hours=1))

print("total 30-day readmissions:", len(pos))     # 110k
print("readmissions within 1hr:  ", len(split))   # 10k (~9%)

# second admisison_location
print(split["next_loc"].value_counts(sort=True).head(5))
# ┌────────────────────────────────────────┬───────┐
# │ next_loc                               ┆ count │
# │ ---                                    ┆ ---   │
# │ str                                    ┆ u32   │
# ╞════════════════════════════════════════╪═══════╡
# │ INTERNAL TRANSFER TO OR FROM PSYCH     ┆ 5609  │
# │ PHYSICIAN REFERRAL                     ┆ 1844  │
# │ EMERGENCY ROOM                         ┆ 1451  │
# │ TRANSFER FROM SKILLED NURSING FACILITY ┆ 535   │
# │ WALK-IN/SELF REFERRAL                  ┆ 103   │
# └────────────────────────────────────────┴───────┘

Possibly related to https://patch-diff.githubusercontent.com/raw/sunlabuiuc/PyHealth/pull/815.diff
which removed a clause excluding admissions within 3hrs of a prev. admission.

-                if time_diff_hour <= 3:
-                    continue

A possible fix could be to merge admissions occuring within some time period and adding that as a configuration option and to emit some warning suggesting user's configure that value. I would imagine waiting for a major version change to change the default behaviour would be a good idea.

Environment: PyHealth 2.0.2, MIMIC-IV 3.1.

Langage dominant
Python
Étoiles
1.7k
Forks
803
Merge moyen
5 j 20 h
PR mergées (30 j)
56

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de sunlabuiuc/PyHealth

Toutes les issues de sunlabuiuc/PyHealth

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.