Using foundation models to learn how to represent electronic health records