Conversation
|
Check behavior for commented doses. |
The previous two commits covered most of the data.frame() calls. Adjust two more spots to resolve the remaining test failures under R 3.6.
|
Thanks for help with |
|
Waiting on @andersone1 @graceannobrien @michaelmcd18 to review behavior and either confirm or propose alternate behavior. |
|
@kyleam This is ready for review; I'd be happy to talk through any of the C++ code. |
kyleam
left a comment
There was a problem hiding this comment.
Some of the conceptual details you laid out in the PR description are a bit beyond me, but it looks like you did a very thorough job of documenting those in inst/test-data/occ/occ-data.R, the lastdose docstring, and tests/testthat/test-occ.R.
Aside from my few comments inline, this looks good to me code-wise (and inline with what I expect from inspecting the surrounding code).
|
All of @kyleam review comments have been resolved (I believe); only waiting on input from Metrum datascience (@andersone1 , @michaelmcd18 , @graceannobrien ) on behavior. |
Optionally include occasion (
OCC) inlastdose()(and friends) output. In general, a new occasion happens when there is a dose with "observation" records following before the next dose.Status: work in progress; PR opened for review from the team. I'm working up these "Examples" so we can get a set of test cases that sufficiently cover the the range of behavior; this is tricky.
What we have so far:
OCCstarts at 0; it doesn't increment until we have a dose with following observationsOCCat 1 or maybe letting the user decide how to do itEVID==0;EVID==2don't count at this timeEVID==2but IMO it makes it more difficult to define the occasionOCCincrements at the dose record by looking ahead for following observation records; this was done intentionallyQuestions:
OCCto show up automatically by default? or do you have to opt in?OCCbe for records prior to the first dose?How are BLQ observations handled?
EVID==0and uncommented, they will be considered as observations forOCCdeterminationEVID==2and uncommented, they will not be considered as observations forOCCdeterminationOCCdeterminationOCCcalculation) through thecommentargumentSome examples are included below and will form the test cases for the unit tests (not written yet).
Examples
Single dose
OCCstarts at zeroOCCincrements to 1 at the time of the first doseHere,
OCCstarts at 1 because it was the first recordMulti-dose, with doses explicit in the data set
OCCstarts at 0 again, increments with the first doseOCCincrements at the time of the second dose because we have obserations followingMulti-dose, with doses coded via addl
OCCincrements at 12 hours, the time of the second doseNotice that we’ve (intentionally) made
OCCto increment at 12 hours, eventhough the
TADbehavior is different withdose_firstMulti-dose via addl, but no observations after the doses
OCCdoesn’t increment at the time of the dose atTIME==0;(intentionally) don’t increment
OCCat that pointWe can see this explicitly here
The rule is:
OCCdoesn’t increment unless there are observations after the doseEVID 2 or 3
These currently don’t count for establishing an occasion dose
But if we find an observation before the next dose, we start the occasion
there
Multiple subjects
Created on 2025-01-02 with reprex v2.1.1