How To do patient alignment in survival analysis

Hello All,

I have a question regarding sample alignment for doing survival analysis. How do we do that? Is there any R or python package for doing that? How we should align the patient based on their failure event?

Any kind of help would be appreciated in advance.