Well it depends on whether you mean a nominal duration, e.g. 6 weeks, prescribed by a some standard RCHOPS guideline, or the duration of treatment ultimately prescribed for patient 123 - let’s say her doc decided that a longer period of 8 weeks would help her recover from each round; or the actual duration patient 123 had in reality - let’s say that her treatment was stopped after 5 weeks due to whatever factors.
For the first and second, they should be visible as a ‘constant’ value in the DLM. For the actual duration, we could either:
- define subject variables for treatment start and treatment end (behind which would be specific queries that are easy enough to write in openEHR, and I would think against FHIR, CDA, etc), and generate the duration with a simple rule that takes the difference; OR
- just define a single subject variable whose back-end query encodes obtaining the difference, which is also easy to do in future versions of AQL in which server-side functions will be possible in the SELECT part of the query.
This value can clearly change if the underlying data changes, and the DLM rule is re-executed.
Well from my point of view, no options are off the table. However, my impression is that experiences by other groups in the past with Drools is that they are harder to use than they look, because you have to create all the connections to subject variables yourself; the rules language does not necessarily contain all the desired primitives or syntax approach (since we are aiming at a domain-friendly syntax, not a programmer’s syntax). However, I have not looked at what you can do in Drools in recent times - maybe it does everything needed - it would need someone to have a good look.
Generally speaking, the tools for building new languages are much better today than in previous times, so I am more inclined to look at building a new language either from the ground up (i.e. build a parser and interpreter), or a cross-compiler, or with tools such as JetBrains MPS or others (e.g. from Eclipse). I don’t have a strong opinion on the best way forward right now, but in terms of specification, we have nearly the whole language meta-model in BMM + DL. An Antlr4 parser spec will not be too hard - these things will at least provide a guiding model if some other technology is used.