simulate_ehr_events: Generate simulated events tables
Description
This function can generate events for clinical, referral and therapy tables. These are based on
the consultation tables generated by simulate_ehr_consultations
.
Usage
simulate_ehr_events(ehr_def, consultation, event_type = c("clinical", "referral", "therapy"), cores = 1, therapy_lookup = NULL)
Arguments
ehr_def
an object of class link{EHR_definition}
consultation
a dataframe of simulated patient consultations
event_type
Type of events to be generated
cores
number of processor cores to use in generating the data
therapy_lookup
lookup table for drug therapy events e.g. link{product}
Details
This function is relatively basic - for clinical and referral tables, it generates
events according to the comorbidities defined in the ehr_def
, with the mean number of events
for each consultation being defined in the ehr_def for that event_type.
For therapy events, the function simply samples the therapy_lookup table, with the mean number
of events for each consultation being defined in the ehr_def for therapy. Therefore, at the
moment, the therapies bear no relationship to the conditions the patient has and are only for
the purposes of explaining the functioning of the package.
The random sampling is based on a poisson distribution