Cox model: advice on constructing time varying exposure to drugs I am performing a survival analysis on medical registry data and would like to model drug exposure to estimate a continuous dose-response curve. I have drug data like this:

where ATC is the unqiue code of the drug, and DDD_pack is the number of days the pack of medication will cover assuming the person is taking the standard dose for that particular drug. Actual dose is unknown.
I'm having problems deciding the best way to construct the exposure variable for the dose response. My initial thoughts are to somehow include DDD pack as a time varying variable in a Cox model. However, I am unsure of how to decide on the time step / interval periods. For example, I could consider interval periods of length 90 days and compute the total DDD out of those 90 days as a proportion. Or I could chose 180 day intervals, or shorter ones. Is there a way to decide? There is also the problem that some people may actually be on a smaller or larger dose than the "standard" and hence the "real" DDD_pack might be somewhat less than or larger than the estimated values in the table. I thought perhaps of looking for patterns in the date dispensed column but it then got confusing since some people might be taking several drugs at once.
I would very much appreciate some advice for my analysis, in particlar how to chose the interval / period length for constructing the time depednant variable (drug exposure) for the Cox model.

I agree with @Edm answer, but I want to add something as I worked on a similar dataset some years ago. The first approach is naturally to investigate your outcome (which, if I am not wrong, you don't report in your question) using the full exposure history and investigate complex temporal dependencies trying different exposure definitions, temporal windows and lags.
Nonetheless, there is a different approach that might be useful and complementary to the former. This is by using sequence mining and that can be used to have a look at patterns of prescriptions as a whole. Let's say your exposure to a medication can defined as a categorical time-varying variable (e.g. binary: 1=presence, o=absence) across a daily timescale or whatever timescale you eventually decide to define. Imagine that, for each subject you then define a sequence of days coded as 0 or 1 (in the binary case). This represents the entire exposure history of the subjects. With it you can explore patterns sequences within and between individuals using sequence mining tools that are already developed for other research areas such as genomics. You can compute distances among sequences, explore the most recurring patterns, cluster and so on. It also carries interesting visualizations tools!
I am claiming that this approach does miracles, but it's a nice complementary way to describe and investigate this complex categorical time-series.
I wrote a small paper on the topics called "Use of State Sequence Analysis in Pharmacoepidemiology: A Tutorial", which is a very very simple intro to it (it was my undergrad thesis after all), but includes a lot of references to other works (very recommended). I also found a more detailed introduction in a recent pre-print ("Mining and evaluation of patients' diagnostic therapeutic paths through state sequences analysis") that came out in the end of last year. In any case, the most straightforward implementation of this method uses the R package TraMineR and, once you get the hang of it, it is much simpler than any time-varying survival/case-control analysis you are planning to work on.  Just be mindful the list of publications on the package website it's not very updated.
Regarding your idea of using dlnm I recommend this example of code (on Git Hub 2014_gasparrini_StatMed_Rcodedata) the author of dlnm package ( Gasparrini A.) used to carry out the analyses for the paper "Modeling exposure–lag–response associations with distributed lag non-linear models". If you delve into the functions he created and used to define asbestos exposure, you might find some helpful stuff!
