Dx code post-op / ICU delirium

Best answers
Attention Hospital Inpatient Coders! I need some help...am looking for the correct code in the following scenario:

Let's say an elderly patient has surgery, and after surgery, they go to the ICU for careful monitoring, and after a couple of days they show clinical signs of delirium (agitation, confusion, etc.)

I'm curious about diagnosis if the delirium is from meds but also if it's only situational - lack of sleep, linked to the primary dx, etc.

Any help and comments are appreciated!