opensafely / post-covid-respiratory

MIT License
0 stars 0 forks source link

Update process_repeat_events.R #37

Closed A-Whitmarsh closed 4 weeks ago

A-Whitmarsh commented 1 year ago

Update code to include episodes that started before index_date. If patient is in episode at index_date, update index_date to be end of first episode and then remove first episode.

elsie-h commented 1 year ago

I've made a few changes:

@A-Whitmarsh please check your happy with these changes.

Additionally, please confirm whether patients can start an episode on index_date or end_date_outcome (as implemented in these lines)

elsie-h commented 1 year ago

@venexia - before merging this branch, we should discuss:

elsie-h commented 1 year ago

@venexia I've transformed the repeat events episodes data to wide before saving, as discussed on the call.

I do wonder whether it would be better to use survival::tmerge() to format the data with start/stop times at this stage, or whether that would cause problems when analysing it in Stata?