Code and Datasets for the paper "A deep learning framework for drug repurposing via emulating clinical trials on real-world patient data", published on Nature Machine Intelligence in 2021.