Question special

So let's talk specifics. No matter what residency we are in, we've all likely had to ask a patient about their code status. I'd argue that documenting code status is one of the few important tasks in the hospital that is reserved for housestaff. But there often isn't a "right" time in the H&P to ask it, and I get confused when a patient's clinical status runs counter to their code status preference (for example, a man with metastatic lung cancer wishes to be full code). How do you recommend residents systematically approach the code status discussion?