Date formats when providing your own dummy data #499
-
I'm creating my own dummy data using this R script and am trying to run it using the following action:
However, when I include date variables, I'm getting the following error:
I get the same error when using csv as the output format. I assume I need to convert the date-time strings to a different class in R before writing to feather format (or csv)? I've tried |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Also worth noting: I got the above error when I used a date variable that was derived using
But I just tried swapping the above date variable to one derived like this:
And got the following (different) error:
Where row 377 is the first non-missing date for that variable. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your question, @elsie-h. The The I'd suggest modifying the script that generates the dummy data to convert I appreciate that this explanation isn't easy to understand; it's taken me a reasonable amount of time to understand the issue. If you'd like to discuss it further, then please feel free to message on Slack. *The I had to modify project.yaml and the study definition to recreate the issue. Notes to self:
|
Beta Was this translation helpful? Give feedback.
Thanks for your question, @elsie-h.
The
generate_cohort
sub-command expects theelig_date
column in the generated dummy data to match its entry in the study definition. Notice that theelig_date
column in the study definition is the result of calling thepatients.categorised_as
function, and that this function accepts a dictionary with string keys and string values as its first argument: the keys are categories and the values are expressions of logic. It isn't possible to tell this function that the string keys are dates that correspond to a format, such asYYYY-MM-DD
. Other functions, such aspatients.with_these_clinical_events
, accept adate_format
argument. Not so,patients.categorised_as