This function should be used to recreate therapy episodes and therapy combinations, for example in order to try new transitive_closure_controls parameters.

create_therapy_episodes(
  conn,
  transitive_closure_controls = transitive_closure_control(),
  silent = FALSE
)

Arguments

conn

a connection to a database containing a drug_prescriptions table previously created with load_medications())

transitive_closure_controls

parameters controlling (see transitive_closure_control())

silent

if TRUE, the progress bar will be hidden. The default is FALSE.

Overview

Electronic prescribing and administration systems do not usually define:

  • combination therapy: prescribing two or more antimicrobials concurrently for the same indication

  • therapy episodes: the set of antimicrobial prescriptions administered consecutively or concurrently and corresponding to a single indication and intent.

When loading medication records, load_medications() first examines all prescriptions authored in a given hospital admission to ascertain such links between prescriptions. This involves looking at patterns of overlap and succession of prescriptions, and using a graph theory method known as 'transitive closure'.

Ramses links prescriptions together if:

  • prescriptions share the same antiinfective_type: antibacterials are linked with antibacterials, antifungals with antifungals, etc.

  • prescription_status is *not* 'cancelled', 'draft', 'entered-in-error', or 'unknown'.

Operations

This function performs the following operations:

  1. verify that a valid drug_prescriptions table exists

  2. delete any existing drug_prescription_edges and drug_therapy_episodes table

  3. recreate the drug_prescription_edges table

  4. overwrite therapy_id and combination_id fields in drug_prescriptions table

  5. recreate the drug_therapy_episodes table

See also

For more details please consult vignette("therapy-episodes", package = "Ramses")