Skip to content

Longitudinal tutorial shortened#55

Merged
agerardy merged 9 commits intomainfrom
longitudinal_tutorial_shorten
Apr 10, 2026
Merged

Longitudinal tutorial shortened#55
agerardy merged 9 commits intomainfrom
longitudinal_tutorial_shorten

Conversation

@agerardy
Copy link
Copy Markdown
Collaborator

@agerardy agerardy commented Apr 1, 2026

See theislab/ehrapy#1042 for details

@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@eroell
Copy link
Copy Markdown
Collaborator

eroell commented Apr 1, 2026

Also the reviewNB seems kind of useless here, it just shows the two NBs one after the other

Yeah this can happen unfortunately if you don't start cleanly from the latest commit on main . ReviewNB can't handle earlier edits and subsequent merges from main into the branch too well

Copy link
Copy Markdown
Member

@Zethson Zethson left a comment

Choose a reason for hiding this comment

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

Thanks!

If you're new to `ehrapy` and `ehrdata`, we strongly recommend reading [Getting started with ehrdata](https://ehrdata.readthedocs.io/en/latest/tutorials/getting_started.html) and [Introduction to ehrapy](https://ehrapy.readthedocs.io/en/latest/tutorials/notebooks/ehrapy_introduction.html).

should be sphinx or myst refs and not links.

  1. ehrapy's CohortTracker

Proper ref here as well, please.

  1. ehrapy provides ep.pl.timeseries.

Same here.

  1. One row per sentence in markdown, please. It's messy to review like this.

  2. See

X = edata.layers["locf_data"]
mean_rep = np.nanmean(X, axis=2)
std_rep = np.nanstd(X, axis=2)
edata.obsm["temporal_rep"] = np.hstack([mean_rep, std_rep])

this looks a bit off. Too complex and why do we need to define a X here?

  1. See
import logging
logging.getLogger().setLevel(logging.ERROR)

I think that's an ehrapy.setting thing as well, no?

When these are addressed I might spend a few minutes to clean up some minor things.

Thank you!

@review-notebook-app
Copy link
Copy Markdown

review-notebook-app bot commented Apr 7, 2026

View / edit / reply to this conversation on ReviewNB

eroell commented on 2026-04-07T15:33:17Z
----------------------------------------------------------------

the output of this cell can be removed.


@review-notebook-app
Copy link
Copy Markdown

review-notebook-app bot commented Apr 7, 2026

View / edit / reply to this conversation on ReviewNB

eroell commented on 2026-04-07T15:33:18Z
----------------------------------------------------------------

twice "such as" is not so pretty to read

Also, the "Remember we consider ..." does not make much sense, as it was not introduced earlier


@review-notebook-app
Copy link
Copy Markdown

review-notebook-app bot commented Apr 7, 2026

View / edit / reply to this conversation on ReviewNB

eroell commented on 2026-04-07T15:33:19Z
----------------------------------------------------------------

Why is the entire intro to CohortTracker removed? it just appears without context now right after the variable plot. Before in the notebook there was a brief introduction and I'd keep this unless there's strong reasons against it?

Also, there was a sentence after the cohort tracker plot "We can observe that on average, patients are 64.5 years old upon ICU entry, with slightly more females (0) than males (1)." which helps to understand what this figure even means


agerardy commented on 2026-04-08T12:14:25Z
----------------------------------------------------------------

i was trying to shorten the whole tutorial, might have overdone it with cutting this, true

@review-notebook-app
Copy link
Copy Markdown

review-notebook-app bot commented Apr 7, 2026

View / edit / reply to this conversation on ReviewNB

eroell commented on 2026-04-07T15:33:20Z
----------------------------------------------------------------

Is it really robust scale normalization? or Just scale normalization?


agerardy commented on 2026-04-08T12:13:55Z
----------------------------------------------------------------

it is standardscaler, so just scale normalization, you're right

@review-notebook-app
Copy link
Copy Markdown

review-notebook-app bot commented Apr 7, 2026

View / edit / reply to this conversation on ReviewNB

eroell commented on 2026-04-07T15:33:21Z
----------------------------------------------------------------

When measurements do exist, they tend to persist until the next reading

This phrase does not make sense


@review-notebook-app
Copy link
Copy Markdown

review-notebook-app bot commented Apr 7, 2026

View / edit / reply to this conversation on ReviewNB

eroell commented on 2026-04-07T15:33:22Z
----------------------------------------------------------------

Great explanation helping to understand what happened :)


Copy link
Copy Markdown
Collaborator Author

agerardy commented Apr 8, 2026

it is standardscaler, so just scale normalization, you're right


View entire conversation on ReviewNB

Copy link
Copy Markdown
Collaborator Author

agerardy commented Apr 8, 2026

i was trying to shorten the whole tutorial, might have overdone it with cutting this, true


View entire conversation on ReviewNB

@agerardy agerardy requested a review from Zethson April 10, 2026 09:21
Copy link
Copy Markdown
Member

@Zethson Zethson 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!

Longitudinal Data Analysis with ehrapy

Maybe we should remove the "with ehrapy"? Kind of implied.

Image

Something is off here. Both the same header level? Please stick to how it's done in the other tutorials and if necessary, harmonize it. Consistency is key!

Why is

from pypots.classification import SAITS

in its own cell?

The Physionet 2012 challenge dataset is one of the built-in, ready-to-use datasets of ehrdata and can be loaded with one line of code:

that's just noise.

Let’s inspect the static data:

I think that's more metadata than static data - although not wrong.

And have a look at the dynamic variables:

IDK what's meant with dynamic variables here. This seems a bit off.

Scrolling from

Exploratory Data Analysis

to

Quality control metrics with ehrapy

does not expand the TOC on the right.

Let us examine the static information of the cohort in more detail.

See above.

The "Machine Learning with SAITS" TOC also doesn't expand.

This concludes our tutorial on analyzing longitudinal clinical data with ehrapy.

Just noise.

Resources

Why does this not show up in the TOC on the right?

I'd move up the whole doc up. Maybe after the MIMIC-II ones?

@eroell
Copy link
Copy Markdown
Collaborator

eroell commented Apr 10, 2026

Why is
from pypots.classification import SAITS
in its own cell?

Because it produces a horribly long output, and we cannot remove the output of the cell which ehrapy is imported since otherwise the holoviews plot don't render.

So we import pypots separately, then remove its ugly output

@eroell eroell self-requested a review April 10, 2026 09:57
Copy link
Copy Markdown
Collaborator

@eroell eroell 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 for incorporating all my earlier requests!

After having added @Zethson 's comments, please ping him when you're ready such that he can add his small additions mentioned above, and then this is good to go!

@Zethson
Copy link
Copy Markdown
Member

Zethson commented Apr 10, 2026

No need to ping me again, please just merge your PRs then. Thank you!

@agerardy agerardy merged commit 00ff133 into main Apr 10, 2026
@agerardy agerardy deleted the longitudinal_tutorial_shorten branch April 10, 2026 13:10
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.

3 participants