1 Create a dMeasure object

library(dMeasure)
packageVersion("dMeasure")
#> [1] '0.9.6'

# creates a dMeasure object named 'a'. Could be named something else.
a <- dMeasure::dMeasure$new()

2 Configuration file

2.1 Configuration file location

The location of the .sqlite configuration file is stored in "“~/.DailyMeasure_cfg.yaml”

The .sqlite file contains information required to access the Best Practice database. By default, the .sqlite file location is “~/.DailyMeasure_cfg.sqlite”

a$configuration_file_path
#> [1] "~/.DailyMeasure_cfg.sqlite"

The location of the .sqlite file can be changed. If the specified file does not exist, the .sqlite file will be created.

a$configuration_file_path <- "~/.MySpecialConfig.sqlite"
a$configuration_file_path
#> [1] "~/.MySpecialConfig.sqlite"

2.2 Opening and reading the configuration file

a$open_configuration_db()
a$read_configuration_db()

3 Best Practice Database Server configuration

Add a server definition, and show server definitions.

a$server.insert(list(Name = "MyServer", Address = "127.0.0.1\\BPSINSTANCE",
                     Database = "BPSSAMPLES", UserID = "bpsrawdata",
                     dbPassword = "mypassword"))
id Name Address Database UserID Driver
1 Main DAVIDLENOVOPC bpssamples bpsrawdata SQL Server
2 testXY 127.0.0.1 bpssamples bpsrawdata SQL Server Native Client 11.0
3 chuckles vkelim.3322.org bpssamples bpsrawdata SQL Server
4 chuck norris hello bpsrawdata
5 chuckx norris hello bpsrawdata
6 MyServer 127.0.0.1 BPSSAMPLES bpsrawdata
a$server.list()
id Name Address Database UserID Driver
1 Main DAVIDLENOVOPC bpssamples bpsrawdata SQL Server
2 testXY 127.0.0.1 bpssamples bpsrawdata SQL Server Native Client 11.0
3 chuckles vkelim.3322.org bpssamples bpsrawdata SQL Server
4 chuck norris hello bpsrawdata
5 chuckx norris hello bpsrawdata
6 MyServer 127.0.0.1 BPSSAMPLES bpsrawdata

A description of many methods can be shown using the package’s help documentation, as shown for server.insert below. Note that the function server.insert includes an initial argument dMeasure_obj which is not used in the method server.insert.

?dMeasure::server.insert
server.insert R Documentation

server.insert

Description

insert a new server description

Usage

server.insert(dMeasure_obj, description)

Arguments

dMeasure_obj

dMeasure R6 object

description

list object : $Name, $Driver, $Address, $Database, $UserID, $dbPassword

‘Driver’ will be the MSSQL driver to use. If left blank or not defined, then ‘SQL Server’ will be used. Other possible choices include “ODBC Driver 11 for SQL Server” or “ODBC Driver 13 for SQL Server”. A list of available drivers can be seen (in R) with odbc::odbcListDrivers()

‘Address’ will typically be of the form COMPUTERNAME and BPSINSTANCE, with two backslashes in between.

‘Address’ will require ‘two’ backslashes in the address, because the backslash needs to be ‘escaped’ with a preceding backslash (see examples).

‘Database’ will typically be BPSPATIENTS. the samples database will be BPSSAMPLES

‘UserID’ will always be ‘bpsrawdata’

dbPassword will be immediately encrypted

Value

dataframe - full list of database descriptions can also return error (stop) if description is invalid

Examples

a <- dMeasure::dMeasure$new()
a$open_configuration_db()
a$read_configuration_db()
a$server.insert(list(Name = "MyServer", Address = "127.0.0.1\\BPSINSTANCE",
                     Database = "BPSSAMPLES", UserID = "bpsrawdata",
                     dbPassword = "mypassword"))

3.1 Modify and delete server descriptions

Current server descriptions can be modified

id <- a$server.list() %>% dplyr::filter(Name == "MyServer") %>% dplyr::pull(id)
a$server.update(list(id = id, Database = "BPSPATIENTS"))
id Name Address Database UserID Driver
1 Main DAVIDLENOVOPC bpssamples bpsrawdata SQL Server
2 testXY 127.0.0.1 bpssamples bpsrawdata SQL Server Native Client 11.0
3 chuckles vkelim.3322.org bpssamples bpsrawdata SQL Server
4 chuck norris hello bpsrawdata
5 chuckx norris hello bpsrawdata
6 MyServer 127.0.0.1 BPSPATIENTS bpsrawdata

or deleted

id <- a$server.list() %>% dplyr::filter(Name == "MyServer") %>% dplyr::pull(id)
if (length(id) == 1) {
  a$server.delete(list(id = id))
}
id Name Address Database UserID Driver
1 Main DAVIDLENOVOPC bpssamples bpsrawdata SQL Server
2 testXY 127.0.0.1 bpssamples bpsrawdata SQL Server Native Client 11.0
3 chuckles vkelim.3322.org bpssamples bpsrawdata SQL Server
4 chuck norris hello bpsrawdata
5 chuckx norris hello bpsrawdata

3.2 Use server descriptions

The server description can be chosen, which will automatically try to use the chosen server description.

a$BPdatabaseChoice <- "None" # set to null choice
a$BPdatabaseChoice # returns the current database description choice
#> [1] "None"
a$BPdatabaseChoice <- "Main" # this will also open the 'Main' database description, if possible
#> [1] "Opening EMR database"
#> [1] "Re-initializing databases"
#> [1] "dbversion: 1"

Database connections can be ‘manually’ closed.

The most recent Best Practice database choice will be ‘remembered’ in the .sqlite configuration file.

a$close() # closes the database connections

4 Opening the Best Practice database connection

a <- dMeasure::dMeasure$new()
a$open_emr_db() # this will try to open the most recent database description choice, in this case, 'Main'
#> [1] "ChosenServerName: Main"
#> [1] "Opening EMR database"
#> [1] "Re-initializing databases"
#> [1] "dbversion: 1"
#> [1] "Main"

5 User configuration

# a$UserConfig
# shows user configuration as stored in dMeasure's configuration file
DT::datatable(a$UserConfig,
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))
# a$UserConfigLicense
# decodes the 'License'/(subscription) to a 'License (Expiry) Date'
DT::datatable(a$UserConfigLicense,
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))
# a$UserFullConfig
# shows user configuration
# information combined from dMeasure's configuration file and the EMR (Best Practice) database
# includes the 'decoded' license date
DT::datatable(a$UserFullConfig,
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))

A ‘manual entry’ of subscription/license information can be done…

DrIvorCureIdentifier <- 
  a$UserFullConfig %>% dplyr::collect() %>%
  dplyr::filter(Fullname == "Dr Ivor Cure") %>%
  dplyr::pull(Identifier)
?dMeasure::verify_license
verify_license R Documentation

verify license/subscription

Description

verify license/subscription

Usage

verify_license(License, Identifier)

Arguments

License

an encoded character string

Identifier

a character string Identifier is converted to upper case

Value

a date object ‘LicenseDate’. returns NA if not valid

dMeasure::verify_license(DrIvorCureIdentifier, License = "not_a_real_license")
#> [1] NA
?dMeasure::update_subscription
update_subscription R Documentation

Update subscription database

Description

Update subscription database

Usage

update_subscription(
  dMeasure_obj,
  Fullname = NA,
  License = NA,
  Identifier = NA,
  verify = TRUE
)

Arguments

dMeasure_obj

dMeasure object

Fullname

name of the user to change license

License

the (undecoded) license string

Identifier

the identifier of the user

verify

verify before changing

Value

TRUE if license written, FALSE if not only meaningful if Verify is TRUE, in which case FALSE indicates the license was not valid

a$update_subscription(Identifier = DrIvorCureIdentifier,
                      License = "not_a_real_license", verify = TRUE)
#> [1] FALSE

The correct way to remove a subscription is to set to ‘NA’

a$update_subscription(Identifier = DrIvorCureIdentifier,
                      Fullname = "Dr Ivor Cure",
                      License = NA, verify = FALSE)
#> [1] TRUE

DT::datatable(a$UserConfigLicense,
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))

Subscription information can be read from the GPstat!/DailyMeasure database.

Note that reading the database will send (encrypted) details of the health care providers over the Internet. Those details are the names of the providers, and either the provider number or the name of the clinic.

?dMeasure::read_subscription_db
read_subscription_db R Documentation

read the subscription database

Description

also update the configuration database with new Licenses (if available) and the date of checks

Usage

read_subscription_db(dMeasure_obj, forcecheck = FALSE, users = NULL)

Arguments

dMeasure_obj

dMeasure object

forcecheck

check, even if already checked ‘today’. TRUE/FALSE

users

vector of user names. if NULL (the default) then all user in $UserFullConfig

UserFullConfig

updated UserFullConfig (includes subscription information) returns warning if RMariaDB module is not available to open database returns warning if unable to open subscription database

Examples

dMeasure_obj$read_subscription_db()
DT::datatable(a$read_subscription_db(forcecheck = TRUE),
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))
#> [1] "Subscription database opened"

6 Appointment list examples

By default, no clinicans are selected, and the date of searches will be the current date (in this case 2020-04-18).

a$choose_clinicians()
#> character(0)
a$choose_date()
#> [[1]]
#> [1] "2020-04-18"
#> 
#> [[2]]
#> [1] "2020-04-18"

The list of available clinicians can be shown…

a$clinician_choice_list
#> [1] "Dr Frederick Findacure"      "Dr Ivor Cure"               
#> [3] "Miss Jenny Reception"        "Ms. Nadine Nurse"           
#> [5] "Ms.  Susan Senior Reception" "Mr. IT Technician"          
#> [7] "Mrs. Psychology Specialist"  "Mrs. Diabetes Educator"

…some clinicians chosen:

a$choose_clinicians(c("Ms Nadine Nurse", "Mrs. Psychology Specialist",
                      "Dr Frederick Findacure", "Dr Ivor Cure"))
#> [1] "Mrs. Psychology Specialist" "Dr Frederick Findacure"    
#> [3] "Dr Ivor Cure"

…and dates chosen:

a$choose_date(date_from = as.Date("2000-01-01"), date_to = as.Date("2020-01-01"))
#> [[1]]
#> [1] "2000-01-01"
#> 
#> [[2]]
#> [1] "2020-01-01"

Just one of date_from or date_to can be defined.

It is also assumed (if the argument are not ‘named’), that the first argument of choose_date will be date_from, and the second argument (if supplied) will be date_to.

Subsequent calls to many methods, such as those named list_* will, by default, assume the chosen clinicians and dates are those defined by the choose_clinicians and choose_date methods above.

a$list_appointments() %>% head() # 'head' just displays the first few appointments
Patient InternalID AppointmentDate AppointmentTime Status Provider DOB Age
Jason Ahern 36 2006-02-23 12:30 Booked Dr Frederick Findacure 1977-05-31 28
Jason Ahern 36 2006-02-24 09:30 Booked Dr Frederick Findacure 1977-05-31 28
Janelle Allen 9 2010-11-10 13:22 Completed Dr Frederick Findacure 1965-01-24 45
Alan Abbott 2 2011-03-25 10:15 Completed Dr Frederick Findacure 1945-06-30 65
Madeline Abbott 4 2011-05-20 14:59 At billing Dr Frederick Findacure 1978-02-14 33
Janelle Allen 9 2011-07-04 15:14 At billing Dr Frederick Findacure 1965-01-24 46

6.1 Billed appointments list

Billing methods and fields are provided by the billings module https://github.com/DavidPatShuiFong/dMeasureBillings.

?dMeasureBillings::billed_appointments
billed_appointments R Documentation

List of appointments with billings

Description

Filtered by date, and chosen clinicians

Usage

billed_appointments(
  dMeasureBillings_obj,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  status = NA,
  lazy = FALSE
)

Arguments

dMeasureBillings_obj

dMeasureBillings R6 object

date_from

start date, inclusive (date object)

date_to

end date, inclusive (date object) default of date_from and date_to defined by choose_date method of dMeasure

clinicians

(default $clinicians of dMeasure object) list of clinicians to view

status

(default NA) filter by ‘status’ if not NA permissible values are ‘Booked’, ‘Completed’, ‘At billing’, ‘Waiting’, ‘With doctor’

lazy

(default FALSE) if lazy=TRUE, then don’t re-calculate appointments_filtered to calculate

Details

Billings for patients who have displayed appointments

collects ALL billings for patients who have displayed appointments used by CDM billings view

Value

list of appointments

billings <- dMeasureBillings::dMeasureBillings$new(a)

billings$billed_appointments() %>% 
  dplyr::mutate(Description = iconv(Description, "latin1", "ASCII", sub = "")) %>%
  # removes an invalid ASCII character from Description
  head()
Patient InternalID AppointmentDate AppointmentTime Status Provider DOB Age ServiceDate MBSItem Description
Jason Ahern 36 2006-02-23 12:30 Booked Dr Frederick Findacure 1977-05-31 28 2006-05-26 23 Surgery consultation, Level B
Jason Ahern 36 2006-02-23 12:30 Booked Dr Frederick Findacure 1977-05-31 28 2006-05-26 10990 Bulk-Billing Incentive
Jason Ahern 36 2006-02-23 12:30 Booked Dr Frederick Findacure 1977-05-31 28 2012-03-05 0 WCO001 - Medical Certificate - Cost of initial medical certificate only
Jason Ahern 36 2006-02-23 12:30 Booked Dr Frederick Findacure 1977-05-31 28 2012-03-05 23 Surgery consultation, Level B
Jason Ahern 36 2006-02-23 12:30 Booked Dr Frederick Findacure 1977-05-31 28 2012-03-07 0 WCO002 - Report/case conference - A service defined by WorkCover as time based fees paid to medical practitioner for reports, communications with employer/insurer/workplace rehabilitation provider. It is expected that doctors should maintain records of conferences including the details and duration of discussions - $22.25 per 5 min or $242.90 per hour
Jason Ahern 36 2006-02-23 12:30 Booked Dr Frederick Findacure 1977-05-31 28 2012-03-07 23 Surgery consultation, Level B

7 Billings methods

Billings matched up to appointments and visits.

?dMeasureBillings::list_billings
list_billings R Documentation

Billings, appointments and visit combined view

Description

filter to chosen date range and practitioners

Usage

list_billings(
  dMeasureBillings_obj,
  date_from,
  date_to,
  clinicians,
  own_billings,
  lazy,
  screentag,
  screentag_print
)

Arguments

dMeasureBillings_obj

dMeasureBillings R6 object

date_from

(default date_a field) start date

date_to

(default date_b field) end date (inclusive)

clinicians

(default clinicians field) list of clinicians to view

own_billings

(default own_billings field) logical TRUE/FALSE

only show billings done by the specified provider on the contact (visit/appointment/billing) day.

if FALSE, the all billings done on the patient on that day are shown.

lazy

if TRUE, then do not recalculate appointment list. otherwise, re-calculate

screentag

(default FALSE) optionally add a fomantic/semantic HTML description of ‘action’

screentag_print

(default TRUE) optionally add a ‘printable’ description of ‘action’

Details

billings are aggregated/group to patient/day

Value

list of appointments (with patient details)

print(billings$own_billings) # by default is TRUE, and shows only billings attributable to the provider
#> [1] TRUE

a$choose_date(date_from = as.Date("2019-05-01"), date_to = as.Date("2019-05-30")) # restrict date range
#> [[1]]
#> [1] "2019-05-01"
#> 
#> [[2]]
#> [1] "2019-05-30"
a$choose_clinicians(a$clinician_choice_list) # choose all clinicians
#> [1] "Dr Frederick Findacure"      "Dr Ivor Cure"               
#> [3] "Miss Jenny Reception"        "Ms. Nadine Nurse"           
#> [5] "Ms.  Susan Senior Reception" "Mr. IT Technician"          
#> [7] "Mrs. Psychology Specialist"  "Mrs. Diabetes Educator"

billings$list_billings() %>% head() # an aggregated version of $appointments_billings_sameday()
Patient InternalID Date AppointmentTime Status VisitType Provider DOB Age billingtag_print
Mitchell Allen 12 2019-05-16 09:00 At billing NA Dr Ivor Cure 2018-03-15 1 NA
Benjamin Abbott 3 2019-05-16 10:00 At billing NA Dr Frederick Findacure 2013-01-26 6 NA
Kenneth Allen 11 2019-05-16 10:15 At billing NA Ms. Nadine Nurse 1928-06-10 90 NA
Anastasia Abbott 1 2019-05-16 10:30 At billing NA Mrs. Diabetes Educator 2014-02-25 5 NA
Jessica Allen 10 2019-05-28 11:00 At billing NA Dr Ivor Cure 1992-01-08 27 NA
Anastasia Abbott 1 2019-05-28 11:30 At billing NA Dr Ivor Cure 2014-02-25 5 NA

Show ALL billings for the patient on that day, whether or not attributable to the provider.

billings$own_billings <- FALSE
billings$list_billings() %>% head()
Patient InternalID Date AppointmentTime Status VisitType Provider DOB Age billingtag_print
Mitchell Allen 12 2019-05-16 09:00 At billing NA Dr Ivor Cure 2018-03-15 1 NA
Benjamin Abbott 3 2019-05-16 10:00 At billing NA Dr Frederick Findacure 2013-01-26 6 NA
Kenneth Allen 11 2019-05-16 10:15 At billing NA Ms. Nadine Nurse 1928-06-10 90 NA
Anastasia Abbott 1 2019-05-16 10:30 At billing NA Mrs. Diabetes Educator 2014-02-25 5 NA
Jessica Allen 10 2019-05-28 11:00 At billing NA Dr Ivor Cure 1992-01-08 27 NA
Anastasia Abbott 1 2019-05-28 11:30 At billing NA Dr Ivor Cure 2014-02-25 5 NA
a$choose_date(as.Date("2001-01-01"), Sys.Date()) # reset dates
#> [[1]]
#> [1] "2001-01-01"
#> 
#> [[2]]
#> [1] "2020-04-18"

8 Chronic disease management

Chronic disease management methods are contained within the dMeasureCDM module https://github.com/DavidPatShuiFong/dMeasureCDM.

cdm <- dMeasureCDM::dMeasureCDM$new(a, billings)
# the dMeasureCDM object requires access to both the dMeasure ('a') object
# and the dMeasureBillings ('billings') object
cdm$billings_cdm() %>% head() # chronic disease management opportunities based on chronic conditions
#> Warning in self$dM$check_subscription(clinicians, date_from, date_to,
#> adjustdate = TRUE, : A chosen user has no subscription for chosen date
#> range. Dates changed (minimum one week old).
#> Warning in cdm$billings_cdm(): A chosen user has no subscription for chosen
#> date range. Dates changed (minimum 7 days old).
InternalID AppointmentDate AppointmentTime Provider cdm_print
1 2012-01-11 16:23 Dr Frederick Findacure DiabetesSIP (History : Diabetes), GPMP (History : Diabetes)
1 2019-01-09 09:30 Dr Frederick Findacure GPMP (2012-03-08) Overdue, DiabetesSIP (History : Diabetes), GPMP R/V (GPMP: 2012-03-08) Overdue
1 2019-05-16 10:30 Mrs. Diabetes Educator GPMP (2012-03-08) Overdue, DiabetesSIP (History : Diabetes), GPMP R/V (GPMP: 2012-03-08) Overdue
1 2019-05-28 11:30 Dr Ivor Cure GPMP (2012-03-08) Overdue, DiabetesSIP (History : Diabetes), GPMP R/V (GPMP: 2012-03-08) Overdue
1 2019-07-29 09:00 Dr Ivor Cure GPMP (2012-03-08) Overdue, DiabetesSIP (History : Diabetes), GPMP R/V (GPMP: 2012-03-08) Overdue
1 2019-12-02 08:30 Ms. Nadine Nurse GPMP (2012-03-08) Overdue, DiabetesSIP (History : Diabetes), GPMP R/V (GPMP: 2012-03-08) Overdue

Chronic disease management opportunities based on a a large number of condition lists, such diabetes_list_cdm. These active condition lists look at appointments_list (which is set by list_appointments method), and determine if a chronic disease management billing has occurred in a time period prior to the appointment.

intID_list <- a$appointments_list %>>%
  dplyr::select(InternalID, AppointmentDate, AppointmentTime, Provider, Age)
cdm$diabetes_list_cdm(intID_list) %>% head()
InternalID AppointmentDate AppointmentTime Provider MBSName Description ServiceDate MBSItem
9 2010-11-10 13:22 Dr Frederick Findacure DiabetesSIP History : Diabetes NA NA
2 2011-03-25 10:15 Dr Frederick Findacure DiabetesSIP History : Diabetes NA NA
4 2011-05-20 14:59 Dr Frederick Findacure DiabetesSIP History : Diabetes NA NA
9 2011-07-04 15:14 Dr Frederick Findacure DiabetesSIP History : Diabetes NA NA
16 2011-07-28 10:15 Dr Ivor Cure DiabetesSIP History : Diabetes NA NA
16 2011-08-04 10:15 Dr Ivor Cure DiabetesSIP History : Diabetes NA NA

The diabetes_list_cdm method in turn calls upon the diabetes_list method, which given a dataframe of $InternalID and $Date returns a vector of InternalID which corresponds to the $InternalID which have a history of diabetes.

?dMeasure::diabetes_list
diabetes_list R Documentation

list of patients with diabetes

Description

list of patients with diabetes

Usage

diabetes_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

If no dataframe provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

a$diabetes_list()
#> [1]  2  4 33  5  9  1 34 16  7

9 Immunization methods

?dMeasure::list_vax()
list_vax R Documentation

List of patients potentially eligible for vaccines

Description

Includes patients who may have already had the vaccine, date of previous vaccine is included.

Usage

list_vax(
  dMeasure_obj,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  intID = NULL,
  intID_Date = Sys.Date(),
  appointments_list = NULL,
  include_uptodate = TRUE,
  lazy = FALSE,
  vaxtag = FALSE,
  vaxtag_print = TRUE,
  chosen = self$vaccine_choices
)

Arguments

dMeasure_obj

dMeasure R6 object

date_from

from date range (default $date_a)

date_to

to date range (default $date_b)

clinicians

list of clinicians (default $clinicians)

intID

list of internal ID (default is NULL, in which case appointments_list is used)

intID_Date

if intID is not NULL, then date to check (default is Sys.Date())

appointments_list

provide an appointment list (default $appointments_list)

include_uptodate

include those who are up-to-date (‘green’ tag)

lazy

(default FALSE) recalculate an appointment list

vaxtag

(default FALSE) HTML/browser version of tags

vaxtag_print

(default TRUE) printable version of tags

chosen

list of vaccine names (default is all)

Details

Optionally added a HTML (‘vaxtag’) or printable (‘vaxtag_print’)

Value

dataframe list of influenza eligible patients

a$list_vax() %>% head()
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age vaxtag_print
Alan Abbott 2 2011-03-25 10:15 Dr Frederick Findacure 1945-06-30 65 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2011-09-22 14:35 Dr Frederick Findacure 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2011-10-27 15:12 Dr Frederick Findacure 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2012-02-13 11:45 Dr Frederick Findacure 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2012-04-18 09:00 Dr Frederick Findacure 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2012-04-18 09:00 Ms. Nadine Nurse 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
a$list_influenza() %>% head()
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age vaxtag_print
Alan Abbott 2 2011-03-25 10:15 Dr Frederick Findacure 1945-06-30 65 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2011-09-22 14:35 Dr Frederick Findacure 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2011-10-27 15:12 Dr Frederick Findacure 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2012-02-13 11:45 Dr Frederick Findacure 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2012-04-18 09:00 Dr Frederick Findacure 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
Alan Abbott 2 2012-04-18 09:00 Ms. Nadine Nurse 1945-06-30 66 Influenza (DUE) (Age 65 years or greater, Aboriginal or Torres Strait Islander, Diabetes, Asthma, BMI>30)
a$list_zostavax() %>% head()
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age vaxtag_print
Gwenda Alfreds 32 2012-03-02 08:59 Dr Frederick Findacure 1933-02-16 79 Zostavax (DUE) (Age 70 to 79 years)
Fay Allen 8 2012-03-07 09:30 Dr Frederick Findacure 1940-07-12 71 Zostavax (Removed from herpes zoster immunization reminders)
Rhonda Ahern 35 2012-03-14 14:30 Dr Frederick Findacure 1938-06-06 73 Zostavax (DUE) (Age 70 to 79 years)
Fay Allen 8 2012-03-16 14:30 Dr Frederick Findacure 1940-07-12 71 Zostavax (Removed from herpes zoster immunization reminders)
Gwenda Alfreds 32 2012-04-02 14:30 Dr Frederick Findacure 1933-02-16 79 Zostavax (Given : 2012-03-15)
Fay Allen 8 2012-04-18 15:00 Dr Frederick Findacure 1940-07-12 71 Zostavax (Removed from herpes zoster immunization reminders)
a$list_measlesVax() %>% head()
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age vaxtag_print
Jason Ahern 36 2006-02-23 12:30 Dr Frederick Findacure 1977-05-31 28 Measles (DUE) (Born 1966 to 1997 inclusive)
Jason Ahern 36 2006-02-24 09:30 Dr Frederick Findacure 1977-05-31 28 Measles (DUE) (Born 1966 to 1997 inclusive)
Madeline Abbott 4 2011-05-20 14:59 Dr Frederick Findacure 1978-02-14 33 Measles (DUE) (Born 1966 to 1997 inclusive)
Tegan Amos 13 2011-09-23 10:09 Dr Frederick Findacure 1984-04-11 27 Measles (Contra-indication : pregnancy)
Madeline Abbott 4 2011-10-27 15:17 Dr Frederick Findacure 1978-02-14 33 Measles (DUE) (Born 1966 to 1997 inclusive)
Jason Ahern 36 2012-03-05 11:26 Dr Frederick Findacure 1977-05-31 34 Measles (DUE) (Born 1966 to 1997 inclusive)

10 Cancer screening methods

10.1 Breast cancer screening

?dMeasure::list_mammogram
list_mammogram R Documentation

Breast cancer screening list

Description

Breast cancer screening list

Usage

list_mammogram(
  dMeasure_obj,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  appointments_list = NULL,
  lazy = FALSE,
  action = FALSE,
  screentag = FALSE,
  screentag_print = TRUE
)

Arguments

dMeasure_obj

dMeasure R6 object

date_from

from date range (default $date_a)

date_to

to date range (default $date_b)

clinicians

list of clinicians (default $clinicians)

appointments_list

dataframe, list of appointments to search

if not provided, use $appointments_list

needs fields Age, InternalID

lazy

recalculate an appointment list

action

includes ‘OutOfDate’ field

screentag

optionally add a fomantic/semantic HTML description of ‘action’

screentag_print

optionally add a ‘printable’ description of ‘action’

Value

list of appointments (with patient details) adds the following fields

TestDate

(date object) - date

TestName

description of the most recent breast cancer screening test (if any)

OutOfDateTest

1 = never done, 2 = overdue, 3 = ‘up-to-date’

a$list_mammogram() %>% head()
#> Created a temporary table named: ##dbplyr_194
#> Joining, by = c("Patient", "InternalID", "AppointmentDate", "AppointmentTime", "Status", "Provider", "DOB", "Age")
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age screentag_print
Janelle Allen 9 2010-11-10 13:22 Dr Frederick Findacure 1965-01-24 45 Mammogram (Never Done)
Janelle Allen 9 2011-07-04 15:14 Dr Frederick Findacure 1965-01-24 46 Mammogram (Never Done)
Kathleen Costello 16 2011-07-28 10:15 Dr Ivor Cure 1962-11-03 48 Mammogram (Never Done)
Kathleen Costello 16 2011-08-04 10:15 Dr Ivor Cure 1962-11-03 48 Mammogram (Never Done)
Kathleen Costello 16 2011-08-11 10:15 Dr Ivor Cure 1962-11-03 48 Mammogram (Never Done)
Kathleen Costello 16 2011-08-18 10:15 Dr Ivor Cure 1962-11-03 48 Mammogram (Never Done)

10.2 Cervical cancer screening

a$list_cst() %>% tail()
#> Created a temporary table named: ##dbplyr_203
#> Joining, by = c("Patient", "InternalID", "AppointmentDate", "AppointmentTime", "Status", "Provider", "DOB", "Age")
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age screentag_print
Jessica Allen 10 2020-04-09 11:00 Dr Frederick Findacure 1992-01-08 28 Cervical screening (Never Done)
Janelle Allen 9 2020-04-09 14:45 Mrs. Diabetes Educator 1965-01-24 55 CST (Date:2019-12-10)
Fay Allen 8 2020-04-10 09:30 Ms. Nadine Nurse 1940-07-12 79 Cervical screening (Never Done)
Maree Ackermann 42 2020-04-10 10:15 Mrs. Diabetes Educator 1981-08-06 38 PAP (OVERDUE) (Date:2016-04-10)
Jessica Allen 10 2020-04-10 11:30 Mrs. Psychology Specialist 1992-01-08 28 Cervical screening (Never Done)
Frances Barrett 41 2020-04-11 15:00 Dr Frederick Findacure 1972-09-16 47 Cervical screening (Never Done)

10.3 Bowel cancer screening

a$list_fobt() %>% head()
#> Joining, by = c("Patient", "InternalID", "AppointmentDate", "AppointmentTime", "Status", "Provider", "DOB", "Age")
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age screentag_print
Alan Abbott 2 2011-03-25 10:15 Dr Frederick Findacure 1945-06-30 65 FOBT (Never Done)
David Allen 7 2011-08-12 10:04 Dr Frederick Findacure 1960-10-06 50 FOBT (Never Done)
David Allen 7 2011-09-01 16:40 Dr Frederick Findacure 1960-10-06 50 FOBT (Never Done)
Alan Abbott 2 2011-09-22 14:35 Dr Frederick Findacure 1945-06-30 66 FOBT (Never Done)
Alan Abbott 2 2011-10-27 15:12 Dr Frederick Findacure 1945-06-30 66 FOBT (Never Done)
Alan Abbott 2 2012-02-13 11:45 Dr Frederick Findacure 1945-06-30 66 FOBT (Never Done)

11 Data Quality methods

11.1 Overall

?dMeasure::list_dataQuality()
list_dataQuality R Documentation

List of patients for data quality check

Description

Optionally added a HTML (‘qualitytag’) or printable (‘qualitytag_print’)

Usage

list_dataQuality(
  dMeasure_obj,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  appointments_list = NULL,
  lazy = FALSE,
  qualitytag = FALSE,
  qualitytag_print = TRUE,
  chosen = self$dataQuality_choices
)

Arguments

dMeasure_obj

dMeasure R6 object

date_from

from date range (default $date_a)

date_to

to date range (default $date_b)

clinicians

list of clinicians (default $clinicians)

appointments_list

provide an appointment list (default $appointments_list)

lazy

(default FALSE) recalculate an appointment list

qualitytag

(default FALSE) HTML/browser version of tags

qualitytag_print

(default TRUE) printable version of tags

chosen

list of data quality names (default is all)

Value

dataframe list of influenza eligible patients

a$list_dataQuality() %>% head()
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age qualitytag_print
Alan Abbott 2 2011-03-25 10:15 Dr Frederick Findacure 1945-06-30 65 Allergy (House dust mite : Bronchospasm - Severe), Allergy (Trifle : Nausea - Severe), Allergy (Aluminium Hydroxide), Social History (Football), Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2011-09-22 14:35 Dr Frederick Findacure 1945-06-30 66 Allergy (House dust mite : Bronchospasm - Severe), Allergy (Trifle : Nausea - Severe), Allergy (Aluminium Hydroxide), Social History (Football), Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2011-10-27 15:12 Dr Frederick Findacure 1945-06-30 66 Allergy (House dust mite : Bronchospasm - Severe), Allergy (Trifle : Nausea - Severe), Allergy (Aluminium Hydroxide), Social History (Football), Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2012-02-13 11:45 Dr Frederick Findacure 1945-06-30 66 Allergy (House dust mite : Bronchospasm - Severe), Allergy (Trifle : Nausea - Severe), Allergy (Aluminium Hydroxide), Social History (Football), Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2012-04-18 09:00 Dr Frederick Findacure 1945-06-30 66 Allergy (House dust mite : Bronchospasm - Severe), Allergy (Trifle : Nausea - Severe), Allergy (Aluminium Hydroxide), Social History (Football), Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2012-04-18 09:00 Ms. Nadine Nurse 1945-06-30 66 Allergy (House dust mite : Bronchospasm - Severe), Allergy (Trifle : Nausea - Severe), Allergy (Aluminium Hydroxide), Social History (Football), Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)

11.2 Allergy

?dMeasure::list_allergy()
list_allergy R Documentation

List of patients with allergy (or adverse reaction) recordings

Description

Optionally added a HTML (‘qualitytag’) or printable (‘qualitytag_print’)

Usage

list_allergy(
  dMeasure_obj,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  appointments_list = NULL,
  lazy = FALSE,
  qualitytag = FALSE,
  qualitytag_print = TRUE
)

Arguments

dMeasure_obj

dMeasure R6 object

date_from

from date range (default $date_a)

date_to

to date range (default $date_b)

clinicians

list of clinicians (default $clinicians)

appointments_list

provide an appointment list (default $appointments_list)

lazy

= FALSE recalculate an appointment list

qualitytag

= FALSE

qualitytag_print

= TRUE

Value

dataframe list of patients with allergy recording status

a$list_allergy() %>% head()
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age qualitytag_print
Jason Ahern 36 2006-02-23 12:30 Dr Frederick Findacure 1977-05-31 28 Allergy (No recording)
Jason Ahern 36 2006-02-24 09:30 Dr Frederick Findacure 1977-05-31 28 Allergy (No recording)
Janelle Allen 9 2010-11-10 13:22 Dr Frederick Findacure 1965-01-24 45 Allergy (Bactrim)
Alan Abbott 2 2011-03-25 10:15 Dr Frederick Findacure 1945-06-30 65 Allergy (House dust mite : Bronchospasm - Severe)
Alan Abbott 2 2011-03-25 10:15 Dr Frederick Findacure 1945-06-30 65 Allergy (Trifle : Nausea - Severe)
Alan Abbott 2 2011-03-25 10:15 Dr Frederick Findacure 1945-06-30 65 Allergy (Aluminium Hydroxide)

11.3 Social History

?dMeasure::list_socialHx()
list_socialHx R Documentation

List of patients with social history recordings

Description

Optionally added a HTML (‘qualitytag’) or printable (‘qualitytag_print’)

Usage

list_socialHx(
  dMeasure_obj,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  appointments_list = NULL,
  lazy = FALSE,
  qualitytag = FALSE,
  qualitytag_print = TRUE
)

Arguments

dMeasure_obj

dMeasure R6 object

date_from

from date range (default $date_a)

date_to

to date range (default $date_b)

clinicians

list of clinicians (default $clinicians)

appointments_list

provide an appointment list (default $appointments_list)

lazy

= FALSE recalculate an appointment list

qualitytag

= FALSE

qualitytag_print

= TRUE

Value

dataframe list of patients with social history recording status

a$list_socialHx() %>% head()
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age qualitytag_print
Jason Ahern 36 2006-02-23 12:30 Dr Frederick Findacure 1977-05-31 28 Social History (No recording)
Jason Ahern 36 2006-02-24 09:30 Dr Frederick Findacure 1977-05-31 28 Social History (No recording)
Janelle Allen 9 2010-11-10 13:22 Dr Frederick Findacure 1965-01-24 45 Social History (Own home)
Alan Abbott 2 2011-03-25 10:15 Dr Frederick Findacure 1945-06-30 65 Social History (Football)
Madeline Abbott 4 2011-05-20 14:59 Dr Frederick Findacure 1978-02-14 33 Social History (No recording)
Janelle Allen 9 2011-07-04 15:14 Dr Frederick Findacure 1965-01-24 46 Social History (Own home)

11.4 Family history

?dMeasure::list_familyHx()
list_familyHx R Documentation

List of patients with family history recordings

Description

Optionally added a HTML (‘qualitytag’) or printable (‘qualitytag_print’)

Usage

list_familyHx(
  dMeasure_obj,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  appointments_list = NULL,
  lazy = FALSE,
  qualitytag = FALSE,
  qualitytag_print = TRUE
)

Arguments

dMeasure_obj

dMeasure R6 object

date_from

from date range (default $date_a)

date_to

to date range (default $date_b)

clinicians

list of clinicians (default $clinicians)

appointments_list

provide an appointment list (default $appointments_list)

lazy

= FALSE recalculate an appointment list

qualitytag

= FALSE

qualitytag_print

= TRUE

Value

dataframe list of patients with family history recording status

a$list_familyHx() %>% head()
Patient InternalID AppointmentDate AppointmentTime Provider DOB Age qualitytag_print
Alan Abbott 2 2011-03-25 10:15 Dr Frederick Findacure 1945-06-30 65 Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2011-09-22 14:35 Dr Frederick Findacure 1945-06-30 66 Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2011-10-27 15:12 Dr Frederick Findacure 1945-06-30 66 Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2012-02-13 11:45 Dr Frederick Findacure 1945-06-30 66 Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2012-04-18 09:00 Dr Frederick Findacure 1945-06-30 66 Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)
Alan Abbott 2 2012-04-18 09:00 Ms. Nadine Nurse 1945-06-30 66 Family History (Father alive, Mother deceased , Father:Ischaemic heart disease, Brother:Cancer of the colon)

12 Conditions

diabetes_list method described in Chronic Disease Management section.

?dMeasure::asthma_list
asthma_list R Documentation

list of patients with asthma

Description

list of patients with asthma

Usage

asthma_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

a$asthma_list()
#> [1] 2
?dMeasure::atsi_list
atsi_list R Documentation

list of patients recorded ATSI ethnicity

Description

list of patients recorded ATSI ethnicity

Usage

atsi_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::malignancy_list
malignancy_list R Documentation

list of patients recorded malignancy

Description

list of patients recorded malignancy

Usage

malignancy_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::hiv_list
hiv_list R Documentation

list of patients HIV

Description

list of patients HIV

Usage

hiv_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::haemoglobinopathy_list
haemoglobinopathy_list R Documentation

list of patients Haemoglobinopathy

Description

list of patients Haemoglobinopathy

Usage

haemoglobinopathy_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::asplenia_list
#> No documentation for 'asplenia_list' in specified packages and libraries
?dMeasure::haemoglobinopathy_list
haemoglobinopathy_list R Documentation

list of patients Haemoglobinopathy

Description

list of patients Haemoglobinopathy

Usage

haemoglobinopathy_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::transplant_list
transplant_list R Documentation

list of patients with transplant

Description

bone marrow, heart, liver, lung, pancreas, renal, thymus

Usage

transplant_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::cvd_list
cvd_list R Documentation

list of patients with cardiovascular disease

Description

ischaemic heart disease

Usage

cvd_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Details

renovascular hypertension, peripheral arterial disease, peripheral arterial disease - diabetic

cerebrovascular disease

for CVD risk assessment purposes these patients are already at high risk and so excluded from CVD risk assessment

https://www.cvdcheck.org.au/australian-absolute-cardiovascular-disease-risk-calculator

Value

a vector of numbers, which are the InternalIDs

?dMeasure::cardiacdisease_list
cardiacdisease_list R Documentation

list of patients with cardiac conditions

Description

cyanotic congenital heart disease, ischaemic heart disease, acute myocardial infarct (AMI) and congestive failure

Usage

cardiacdisease_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Details

for influenza immunization purposes

Value

a vector of numbers, which are the InternalIDs

?dMeasure::trisomy21_list
trisomy21_list R Documentation

list of patients with trisomy21

Description

list of patients with trisomy21

Usage

trisomy21_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::bmi30_list
bmi30_list R Documentation

list of patients with BMI>=30 (obesity)

Description

list of patients with BMI>=30 (obesity)

Usage

bmi30_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

list of appointments. default is $appointments_filtered

needs appointments, as looks for recording prior to the appointment time

Value

a vector of numbers, which are the InternalIDs of patients who have BMI 30 or more (obesity)

?dMeasure::neurologic_list
neurologic_list R Documentation

list of patients with neurologic disease

Description

multiple sclerosis, epilepsy, spinal cord injury, paraplegia, quadriplegia

Usage

neurologic_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::chronicliverdisease_list
chronicliverdisease_list R Documentation

list of patients with chronic liver disease

Description

liver disease (BP doesn’t have ‘chronic liver disease’!), cirrhosis, alcoholism

Usage

chronicliverdisease_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::chronicrenaldisease_list
chronicrenaldisease_list R Documentation

list of patients with chronic lung disease

Description

chronic renal failure, renal impairment, dialysis

Usage

chronicrenaldisease_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::pregnancy_list
#> No documentation for 'pregnancy_list' in specified packages and libraries
?dMeasure::fifteenplus_list
fifteenplus_list R Documentation

list of patients who are fifteen years or more in age at time of $Date

Description

list of patients who are fifteen years or more in age at time of $Date

Usage

fifteenplus_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::sixtyfiveplus_list
sixtyfiveplus_list R Documentation

list of patients who are sixty-five years or more in age at time of $Date

Description

list of patients who are sixty-five years or more in age at time of $Date

Usage

sixtyfiveplus_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::seventyfiveplus_list
seventyfiveplus_list R Documentation

list of patients who are seventy-five years or more in age at time of $Date

Description

list of patients who are seventy-five years or more in age at time of $Date

Usage

seventyfiveplus_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::ATSI_35_44_list
ATSI_35_44_list R Documentation

list of patients who are 35 to 44 years, and ATSI, at time of $Date

Description

list of patients who are 35 to 44 years, and ATSI, at time of $Date

Usage

ATSI_35_44_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::fortyfiveseventyfour_list
fortyfiveseventyfour_list R Documentation

list of patients who are 45 to 74 years age at time of $Date

Description

list of patients who are 45 to 74 years age at time of $Date

Usage

fortyfiveseventyfour_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::cst_eligible_list
cst_eligible_list R Documentation

list of patients who are cervical screening eligible at time of $Date

Description

  • age twenty-five to seventy-four years inclusive

  • female

  • no history of hysterectomy

Usage

cst_eligible_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::mammogram_eligible_list
mammogram_eligible_list R Documentation

list of patients who are breast cancer screening eligible at time of $Date

Description

  • age fifty to seventy-four years inclusive

  • female

Usage

mammogram_eligible_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Details

https://www.cancer.org.au/about-cancer/early-detection/screening-programs/breast-cancer-screening.html

Value

a vector of numbers, which are the InternalIDs

?dMeasure::familialHypercholesterolaemia_list
familialHypercholesterolaemia_list R Documentation

list of patients with familial hypercholesterolaemia

Description

list of patients with familial hypercholesterolaemia

Usage

familialHypercholesterolaemia_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

?dMeasure::LVH_list
LVH_list R Documentation

list of patients with left ventricular hypertrophy

Description

list of patients with left ventricular hypertrophy

Usage

LVH_list(dMeasure_obj, appointments = NULL)

Arguments

dMeasure_obj

dMeasure R6 object

appointments

dataframe of appointments $InternalID and $Date

if no parameter provided, derives from $appointments_filtered

Value

a vector of numbers, which are the InternalIDs

13 Contacts

There are three kinds of contacts : Appointments, Visits and Services.

Appointments are in the Appointment Book, and can be one of several ‘Status’

a$appointment_status_types
#> [1] "Booked"      "Waiting"     "With doctor" "At billing"  "Invoiced"   
#> [6] "Completed"   "Paid"
a$appointment_status # the appointment status type which are seen with 'contact' methods
#> [1] "With doctor" "At billing"  "Invoiced"    "Completed"   "Paid"

Visits are records in the patient progress notes. These can be of several types.

a$visit_types
#>  [1] "Surgery"       "Home"          "Non Visit"     "Hospital"     
#>  [5] "RACF"          "Telephone"     "SMS"           "Email"        
#>  [9] "Locum Service" "Out of Office" "Other"         "Hostel"       
#> [13] "Telehealth"
a$visit_type # the visit types which are seen with 'contact' methods
#> [1] "Surgery"       "Home"          "Hospital"      "RACF"         
#> [5] "Locum Service" "Out of Office" "Hostel"        "Telehealth"

Services are billings.

13.1 List contacts

?dMeasure::list_contact_appointments
list_contact_appointments R Documentation

List of contacts (appointment type)

Description

Filtered by date, and chosen clinicians

Usage

list_contact_appointments(
  dMeasure_obj,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  status = NA
)

Arguments

dMeasure_obj

dMeasure R6 object

date_from

(default NA -> date_a field) start date

date_to

(default NA -> date_b field) end date (inclusive)

clinicians

(default NA -> clinicians field) list of clinicians to view

status

(default NA) filter by ‘status’ if not NA permissible values are ‘Booked’, ‘Completed’, ‘At billing’, ‘Waiting’, ‘With doctor’ if NA, adopts from active $appointment_status

Value

dataframe of Patient (name), InternalID, AppointmentDate

a$list_contact_appointments() %>>% head()
Patient InternalID AppointmentDate
Alan Abbott 2 2011-03-25
Alan Abbott 2 2011-09-22
Alan Abbott 2 2011-10-27
Alan Abbott 2 2020-04-01
Anastasia Abbott 1 2012-01-11
Anastasia Abbott 1 2019-01-09
x <- a$appointment_status # temporary store
a$appointment_status <- "Completed" # choose appointment status "Completed" only
a$list_contact_appointments() %>>% head()
Patient InternalID AppointmentDate
Alan Abbott 2 2011-03-25
Alan Abbott 2 2011-09-22
Janelle Allen 9 2010-11-10
Janelle Allen 9 2011-08-27
Janelle Allen 9 2012-03-02
Jason Ahern 36 2012-03-05
a$appointment_status <- x # restore previous appointment status setting
a$list_contact_visits() %>% head()
Patient InternalID VisitDate
Anastasia Abbott 1 2019-01-28
Anastasia Abbott 1 2019-08-08
Alan Abbott 2 2019-02-15
Alan Abbott 2 2019-05-30
Alan Abbott 2 2019-07-12
Alan Abbott 2 2019-08-04
a$list_contact_services() %>% head()
Patient InternalID ServiceDate
NA NA 0 2006-05-24
Anastasia Abbott 1 2006-04-26
Anastasia Abbott 1 2010-12-02
Anastasia Abbott 1 2012-03-08
Alan Abbott 2 2010-12-02
Alan Abbott 2 2011-01-06

13.2 Counting contacts

A list of ‘contacted’ patients can be restricted by contact types, number of contacts within the specified time period (which can be chosen with $choose_date), and the date of the most recent contact.

a$contact_type # current contact types which are counted
#> [1] "Services"
a$contact_types # all available contact types
#> [1] "Appointments" "Visits"       "Services"
a$contact_min # number of 'minimum' contact within the specified time period
#> [1] 1
a$contact_minDate # 'minimum' date of most recent contact
#> [1] NA
# note that 'NA' is actually as.Date(-Inf, origin = "1970-01-01")
# which is infinitely into the past
a$contact_minDate <- as.Date("2019-01-01")
a$contact_minDate
#> [1] "2019-01-01"
a$contact_minDate <- as.Date(-Inf, origin = "1970-01-01")
a$contact_minDate
#> [1] NA
a$list_contact_count() %>% head()
Patient InternalID Count Latest
Alan Abbott 2 9 2012-01-12
Anastasia Abbott 1 3 2012-03-08
Ashley Ackerman 43 7 2012-02-17
Benjamin Abbott 3 1 2010-12-02
Catherine Jones 40 3 2019-01-13
David Allen 7 1 2012-03-09
a$contact_min <- 5
a$list_contact_count() %>% head()
Patient InternalID Count Latest
Alan Abbott 2 9 2012-01-12
Ashley Ackerman 43 7 2012-02-17
Felix Adams 5 6 2011-12-02
Janelle Allen 9 8 2012-03-02
a$contact_min <- 1

13.3 Contact conditions

The list_contact_count list can be further restricted by conditions.

These ‘conditions’ include those relevant to the Practice Improvement Program Quality Improvement Measures.

?dMeasure::list_contact_diabetes
list_contact_diabetes R Documentation

List of diabetics in the contact list

Description

Filtered by date, and chosen clinicians

Usage

list_contact_diabetes(
  dMeasure_obj,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  min_contact = NA,
  min_date = NA,
  contact_type = NA,
  lazy = FALSE
)

Arguments

dMeasure_obj

dMeasure R6 object

date_from

start date. default is $date_a

date_to

end date (inclusive). default is $date_b

clinicians

list of clinicians to view. default is $clinicians

min_contact

minimum number of contacts. default is $contact_min, initially one (1)

min_date

most recent contact must be at least min_date. default is $contact_minDate, initially -Inf

contact_type

contact types which are accepted. default is $contact_type

Value

dataframe of Patient (name), InternalID, Count, and most recent contact date

a$list_contact_diabetes() %>% head()
Patient InternalID Count Latest
Alan Abbott 2 9 2012-01-12
Anastasia Abbott 1 3 2012-03-08
David Allen 7 1 2012-03-09
Felix Adams 5 6 2011-12-02
Janelle Allen 9 8 2012-03-02
Madeline Abbott 4 3 2012-03-09
a$list_contact_15plus() %>% head()
#> Created a temporary table named: ##dbplyr_340
Patient InternalID Count Latest
Alan Abbott 2 9 2012-01-12
Ashley Ackerman 43 7 2012-02-17
Catherine Jones 40 3 2019-01-13
David Allen 7 1 2012-03-09
Fay Allen 8 4 2019-07-28
Felix Adams 5 6 2011-12-02
a$list_contact_45_74() %>% head()
#> Created a temporary table named: ##dbplyr_351
Patient InternalID Count Latest
Alan Abbott 2 9 2012-01-12
Catherine Jones 40 3 2019-01-13
David Allen 7 1 2012-03-09
Janelle Allen 9 8 2012-03-02
a$list_contact_65plus() %>% head()
#> Created a temporary table named: ##dbplyr_362
Patient InternalID Count Latest
Alan Abbott 2 9 2012-01-12
Fay Allen 8 4 2019-07-28
Felix Adams 5 6 2011-12-02
Raymond Bartholomew 15 1 2016-07-28
Rhonda Ahern 35 2 2019-03-13
a$list_contact_75plus() %>% head()
#> Created a temporary table named: ##dbplyr_373
Patient InternalID Count Latest
Fay Allen 8 4 2019-07-28
Felix Adams 5 6 2011-12-02
Raymond Bartholomew 15 1 2016-07-28
Rhonda Ahern 35 2 2019-03-13
a$list_contact_ATSI_35_44() %>% head()
#> Created a temporary table named: ##dbplyr_384
Patient InternalID Count Latest
Ashley Ackerman 43 7 2012-02-17
a$list_contact_chroniclungdisease() %>% head()
Patient InternalID Count Latest
a$list_contact_cst() %>% head()
#> Created a temporary table named: ##dbplyr_406
Patient InternalID Count Latest
Catherine Jones 40 3 2019-01-13
Janelle Allen 9 8 2012-03-02
Madeline Abbott 4 3 2012-03-09

14 Practice Incentive Program Quality Improvement Measures

Quality Improvement Measures are provided by the dMeasureQIM object.

qim <- dMeasureQIM::dMeasureQIM$new(a)
# the dMeasureQIM object is created
# with 'access' to the dMeasure object, in this case 'a'

These methods assist in reporting and monitoring of Quality Improvement Measures.

One group of methods list patients relevant to the Quality Improvement Measures.

The most basic list is of active patients (as defined by the contact methods, such as list_contact_count).

In the example below, ‘all’ contact types are counted. This is a very broad definition, and is only used because the ‘samples’ database used to create this document is very small.

?dMeasureQIM::list_qim_active
list_qim_active R Documentation

List of active patients, in the contact list

Description

Filtered by date, and chosen clinicians

Usage

list_qim_active(
  dMeasureQIM_obj,
  contact = NA,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  min_contact = NA,
  min_date = NA,
  contact_type = NA,
  lazy = FALSE
)

Arguments

dMeasureQIM_obj

dMeasureQIM R6 object

contact

patient list. default is $qim_contact. TRUE chooses the ‘contact’ system $list_contact_count (‘active’ patients) from dMeasure object. FALSE chooses the ‘appointment’ system $filter_appointments from dMeasure object.

date_from

start date. default is $date_a

date_to

end date (inclusive). default is $date_b

clinicians

list of clinicians to view. default is $clinicians

min_contact

minimum number of contacts. default is $contact_min, initially one (1)

min_date

most recent contact must be at least min_date. default is $contact_minDate, initially -Inf

contact_type

contact types which are accepted. default is $contact_type

lazy

recalculate the diabetes contact list?

Value

dataframe of Patient (name), InternalID and demographics

a$contact_type <- a$contact_types # includes 'all' contact types as valid (appointment, visit, billing)
qim$list_qim_active() # the list of patients, with Quality Improvement Measure specified groupings
Patient InternalID Count Sex Ethnicity MaritalStatus Sexuality Age5 RecordNo
Alan Abbott 2 16 Male Aboriginal/Torres Strait Islander Married Heterosexual 70 101
Alfred Charles Aldridge 6 1 Male 110 781
Anastasia Abbott 1 9 Female 5 104
Ashley Ackerman 43 8 Male Aboriginal Single Heterosexual 35 7893
Benjamin Abbott 3 4 Male Single 5 103
Catherine Jones 40 4 Female 55 NA
David Allen 7 6 Male Aboriginal 55 6749
David Charles Alfreds 33 1 Male 90 9781
Fay Allen 8 5 Female 75 3346
Felix Adams 5 9 Male 90 245
Frances Barrett 41 2 Female Torres Strait Islander 45 978461
Gwenda Alfreds 32 2 Female 85 9782
Janelle Allen 9 10 Female Married Heterosexual 55 6750
Jason Ahern 36 3 Male 40 987
Jessica Allen 10 2 Female 25 6751
Kathleen Costello 16 4 Female 55 789462
Kenneth Allen 11 2 Male 90 3345
Leslie Bryant 37 5 Female Divorced 55 66604
Madeline Abbott 4 7 Female 40 102
Maree Ackermann 42 1 Female Married Heterosexual 35 7894
Mitchell Allen 12 4 Male 0 6752
NA NA 0 1 NA NA NA NA NA NA
Raymond Bartholomew 15 2 Male 90 789461
Rhonda Ahern 35 3 Female 80 986
Rose Bishop 34 4 Female 90 789464
Tegan Amos 13 3 Female Aboriginal/Torres Strait Islander 35 154

Another group of methods provide aggregated/anonymized report of the relevant patients.

qim$report_qim_active() # an 'anonymized'/aggregated report of the active patients
Age5 Sex Ethnicity MaritalStatus Sexuality n Proportion
0 Male 1 0.0384615
5 Female 1 0.0384615
5 Male Single 1 0.0384615
25 Female 1 0.0384615
35 Female Married Heterosexual 1 0.0384615
35 Female Aboriginal/Torres Strait Islander 1 0.0384615
35 Male Aboriginal Single Heterosexual 1 0.0384615
40 Female 1 0.0384615
40 Male 1 0.0384615
45 Female Torres Strait Islander 1 0.0384615
55 Female 2 0.0769231
55 Female Divorced 1 0.0384615
55 Female Married Heterosexual 1 0.0384615
55 Male Aboriginal 1 0.0384615
70 Male Aboriginal/Torres Strait Islander Married Heterosexual 1 0.0384615
75 Female 1 0.0384615
80 Female 1 0.0384615
85 Female 1 0.0384615
90 Female 1 0.0384615
90 Male 4 0.1538462
110 Male 1 0.0384615
NA NA NA NA NA 1 0.0384615
# 'n' is the number of patients in the category
# 'Proportion' is the proportion of patients in the category

The demographic groupings for report can be changed from the default

qim$qim_demographicGroup # the default setting
#> [1] "Age5"          "Sex"           "Ethnicity"     "MaritalStatus"
#> [5] "Sexuality"
qim$qim_demographicGroupings
#> [1] "Age5"          "Sex"           "Ethnicity"     "MaritalStatus"
#> [5] "Sexuality"
qim$qim_demographicGroup <- c("Sex", "Ethnicity")
qim$report_qim_active()
Sex Ethnicity n Proportion
NA NA 1 0.0384615
Female 12 0.4615385
Female Aboriginal/Torres Strait Islander 1 0.0384615
Female Torres Strait Islander 1 0.0384615
Male 8 0.3076923
Male Aboriginal 2 0.0769231
Male Aboriginal/Torres Strait Islander 1 0.0384615

14.1 Diabetes Quality Improvement Measures

DT::datatable(qim$list_qim_diabetes(),
              extension = "Scroller",
              options = list(scroller = TRUE, scrollX = TRUE))
qim$report_qim_diabetes()
Sex Ethnicity HbA1CDone InfluenzaDone BPDone n Proportion
Female FALSE FALSE FALSE 2 0.2222222
Female FALSE TRUE FALSE 1 0.1111111
Female FALSE TRUE TRUE 1 0.1111111
Female TRUE TRUE TRUE 1 0.1111111
Male TRUE FALSE TRUE 1 0.1111111
Male TRUE TRUE TRUE 1 0.1111111
Male Aboriginal TRUE FALSE TRUE 1 0.1111111
Male Aboriginal/Torres Strait Islander FALSE TRUE TRUE 1 0.1111111

By default, ‘old’ results (as defined by the Quality Improvement Measures) are ignored. Old results can be included by setting qim_ignoreOld to FALSE.

qim$qim_ignoreOld <- FALSE
DT::datatable(qim$list_qim_diabetes(),
              extension = "Scroller",
              options = list(scroller = TRUE, scrollX = TRUE))
qim$report_qim_diabetes()
Sex Ethnicity HbA1CDone InfluenzaDone BPDone n Proportion
Female FALSE FALSE FALSE 1 0.1111111
Female FALSE TRUE TRUE 2 0.2222222
Female TRUE TRUE TRUE 2 0.2222222
Male TRUE TRUE TRUE 2 0.2222222
Male Aboriginal TRUE FALSE TRUE 1 0.1111111
Male Aboriginal/Torres Strait Islander TRUE TRUE TRUE 1 0.1111111

14.1.1 Appointment view

Instead of using the contact list it is possible to use the appointment list view, which derives the patient list purely from the appointment book, without regard to the appointment status.

The appointment list view is designed to be used with the list…appointments methods. For example, list_qim_diabetes_appointments method attaches any appointment in the chosen date-range to the patient listing.

This method will usually be most useful when looking at just one day of appointments.

qim$qim_contact <- FALSE # use 'appointment' list, not 'contact' list
a$choose_date(as.Date("2019-01-01"))
#> [[1]]
#> [1] "2019-01-01"
#> 
#> [[2]]
#> [1] "2020-04-11"

DT::datatable(qim$list_qim_diabetes_appointments(),
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))

?dMeasureQIM::list_qim_diabetes_appointments
list_qim_diabetes_appointments R Documentation

List of diabetics, with Quality Improvement Measures, in contact list plus appointment details

Description

Filtered by date, and chosen clinicians. Note that a ‘contact’ could potentially be defined as something else other than an appointment! (e.g. billing, or record of visit)

Usage

list_qim_diabetes_appointments(
  dMeasureQIM_obj,
  contact = NA,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  min_contact = NA,
  min_date = NA,
  contact_type = NA,
  ignoreOld = NA,
  lazy = FALSE
)

Arguments

dMeasureQIM_obj

dMeasureQIM R6 object

contact

patient list. default is $qim_contact. TRUE chooses the ‘contact’ system $list_contact_diabetes (‘active’ patients) from $dMeasure object. FALSE chooses the ‘appointment’ system $diabetes_list from dMeasure object.

date_from

start date. default is $date_a

date_to

end date (inclusive). default is $date_b

clinicians

list of clinicians to view. default is $clinicians

min_contact

minimum number of contacts. default is $contact_min, initially one (1)

min_date

most recent contact must be at least min_date. default is $contact_minDate, initially -Inf

contact_type

contact types which are accepted. default is $contact_type

ignoreOld

ignore results/observatioins that don’t qualify for quality improvement measures if not supplied, reads $qim_ignoreOld

lazy

recalculate the diabetes contact list?

Details

QIM 01 - HbA1C - most recent. the QIM measure is within last twelve months

QIM 05 - Influenza immunization - most recent. the QIM measure is within last 15 months

QIM 10 - Blood pressure - most recent. the QIM measure is within the last six months

the reference date for ‘most recent’ measurement is ‘date_to’

Value

dataframe of Patient (name), InternalID, appointment details and measures

14.2 Cervical screening

qim$qim_contact <- TRUE # return to 'contact' list
a$choose_date(as.Date("2001-01-01")) # expand date list
#> [[1]]
#> [1] "2001-01-01"
#> 
#> [[2]]
#> [1] "2020-04-11"

qim$list_qim_cst()
#> Created a temporary table named: ##dbplyr_717
Patient InternalID CSTDate CSTName Sex Ethnicity MaritalStatus Sexuality Age5 RecordNo
Catherine Jones 40 NA NA Female 55 NA
Frances Barrett 41 NA NA Female Torres Strait Islander 45 978461
Janelle Allen 9 2019-12-10 CST Female Married Heterosexual 55 6750
Jessica Allen 10 NA NA Female 25 6751
Kathleen Costello 16 2019-08-22 CST Female 55 789462
Leslie Bryant 37 NA NA Female Divorced 55 66604
Madeline Abbott 4 2011-08-26 PAP SMEAR Female 40 102
Maree Ackermann 42 2016-04-10 PAP Female Married Heterosexual 35 7894
Tegan Amos 13 2020-01-10 CST Female Aboriginal/Torres Strait Islander 35 154

DT::datatable(qim$list_qim_cst_appointments(),
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))
#> Created a temporary table named: ##dbplyr_747

qim$report_qim_cst()
#> Created a temporary table named: ##dbplyr_782
Sex Ethnicity CSTDone n Proportion
Female FALSE 3 0.3333333
Female TRUE 4 0.4444444
Female Aboriginal/Torres Strait Islander TRUE 1 0.1111111
Female Torres Strait Islander FALSE 1 0.1111111

14.3 Fifteen plus

# very wide table! use scroller to see to the right...
DT::datatable(qim$list_qim_15plus(),
              extension = "Scroller",
              options = list(scroller = TRUE, scrollX = TRUE))
#> Created a temporary table named: ##dbplyr_812

DT::datatable(qim$list_qim_15plus_appointments(),
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))
#> Created a temporary table named: ##dbplyr_853


DT::datatable(qim$report_qim_15plus())
#> Created a temporary table named: ##dbplyr_899

14.4 Sixty-five plus

qim$list_qim_65plus()
#> Created a temporary table named: ##dbplyr_940
Patient InternalID RecordNo Sex Ethnicity MaritalStatus Sexuality Age5 FluvaxDate FluvaxName
Alan Abbott 2 101 Male Aboriginal/Torres Strait Islander Married Heterosexual 70 2020-04-01 FluQuadri
Alfred Charles Aldridge 6 781 Male 110 2004-03-16 FLUVAX
David Charles Alfreds 33 9781 Male 90 2004-05-06 FLUVAX
Fay Allen 8 3346 Female 75 2019-01-26 Influenza (quadrivalent)
Felix Adams 5 245 Male 90 2020-04-06 Influenza (quadrivalent)
Gwenda Alfreds 32 9782 Female 85 2004-06-09 FLUVAX
Kenneth Allen 11 3345 Male 90 2004-03-16 FLUVAX
Raymond Bartholomew 15 789461 Male 90 NA NA
Rhonda Ahern 35 986 Female 80 2004-02-20 FLUVAX
Rose Bishop 34 789464 Female 90 2019-08-10 Influenza (quadrivalent)

DT::datatable(qim$list_qim_65plus_appointments(),
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))
#> Created a temporary table named: ##dbplyr_971

qim$report_qim_65plus()
#> Created a temporary table named: ##dbplyr_1007
Sex Ethnicity InfluenzaDone n Proportion
Female TRUE 4 0.4
Male FALSE 1 0.1
Male TRUE 4 0.4
Male Aboriginal/Torres Strait Islander TRUE 1 0.1

14.5 Chronic obstructive pulmonary disease

qim$list_qim_copd()
Patient InternalID RecordNo Sex Ethnicity MaritalStatus Sexuality Age5 FluvaxDate FluvaxName
Alfred Charles Aldridge 6 781 Male 110 2004-03-16 FLUVAX
Leslie Bryant 37 66604 Female Divorced 55 2020-04-10 Fluarix Tetra

DT::datatable(qim$list_qim_copd_appointments(),
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))

qim$report_qim_copd()
Sex Ethnicity InfluenzaDone n Proportion
Female TRUE 1 0.5
Male TRUE 1 0.5

14.6 Cardiovascular risk

?dMeasureQIM::list_qim_cvdRisk
list_qim_cvdRisk R Documentation

List of patient with information to complete cardiovascular risk assessment

Description

Filtered by date, and chosen clinicians

Usage

list_qim_cvdRisk(
  dMeasureQIM_obj,
  contact = NA,
  date_from = NA,
  date_to = NA,
  clinicians = NA,
  min_contact = NA,
  min_date = NA,
  contact_type = NA,
  ignoreOld = NA,
  lazy = FALSE
)

Arguments

dMeasureQIM_obj

dMeasureQIM R6 object

contact

patient list. default is $qim_contact.

TRUE chooses the ‘contact’ system $list_contact_diabetes (‘active’ patients) from dMeasure object.

FALSE chooses the ‘appointment’ system $diabetes_list from dMeasure object.

date_from

start date. default is $date_a

date_to

end date (inclusive). default is $date_b

clinicians

list of clinicians to view. default is $clinicians

min_contact

minimum number of contacts. default is $contact_min, initially one (1)

min_date

most recent contact must be at least min_date. default is $contact_minDate, initially -Inf

contact_type

contact types which are accepted. default is $contact_type

ignoreOld

ignore results/observatioins that don’t qualify for quality improvement measures if not supplied, reads $qim_ignoreOld

lazy

recalculate the copd contact list?

Details

QIM 08.Proportion of patients with the necessary risk factors assessed to enable CVD assessment

required parameters

Age, Ethnicity (especially ATSI status)

included - Age 45 to 74 years or older

OR Age 35 or older + ATSI (ATSI 35+ optional - included by default - see $qim_cvdRisk_measure)

Age 75+ excluded (Option to include - see $qim_cvdRisk_measure)

Known cardiovascular disease (optional - excluded by default - see $qim_cvdRisk_measure)

Presence of diabetes. Diabetes and microalbuminuria

eGFR

previous diagnosis of familial hypercholesterolaemia

systolic blood pressure. Diastolic blood pressure

Serum total cholesterol. Serum HDL cholesterol

source : National Vascular Disease Prevention Alliance (NVDPA) guidelines https://www.cvdcheck.org.au/australian-absolute-cardiovascular-disease-risk-calculator

the reference date for ‘most recent’ measurement is ‘date_to’

Value

dataframe of Patient (name), InternalID and measures


# remove some demographics and alcohol recordings because the table is very wide...
# note that the framingham risk equation calculation result 'frisk' is on the
# extreme right hand side
DT::datatable(qim$list_qim_cvdRisk() %>%
                dplyr::select(-c(RecordNo, MaritalStatus, Sexuality)),
              extension = "Scroller",
              options = list(scroller = TRUE, scrollX = TRUE))
#> Created a temporary table named: ##dbplyr_1133
#> Created a temporary table named: ##dbplyr_1153

DT::datatable(qim$list_qim_cvdRisk_appointments(),
              extension = "Scroller",
              options = list(scroller = TRUE, deferRender = TRUE,
                             scrollX = TRUE, scrollY = 200))
#> Created a temporary table named: ##dbplyr_1235
#> Created a temporary table named: ##dbplyr_1255

qim$report_qim_cvdRisk()
#> Created a temporary table named: ##dbplyr_1342
#> Created a temporary table named: ##dbplyr_1362
Sex Ethnicity CVDriskDone n Proportion
Female FALSE 1 0.125
Female TRUE 2 0.250
Female Aboriginal/Torres Strait Islander FALSE 1 0.125
Female Torres Strait Islander FALSE 1 0.125
Male Aboriginal FALSE 1 0.125
Male Aboriginal TRUE 1 0.125
Male Aboriginal/Torres Strait Islander TRUE 1 0.125

14.6.1 Cardiovascular risk inclusion/exclusion groups

qim$qim_cvdRisk_measureTypes
#> [1] "Include ATSI 35-44" "Exclude 75+"        "Exclude known CVD"
qim$qim_cvdRisk_measure # default group settings
#> [1] "Include ATSI 35-44" "Exclude 75+"        "Exclude known CVD"

Note that current Quality Improvement Measures guidelines appear to exclude ATSI 35-44 age group, which is different to the current default setting.

14.6.2 Framingham Risk Equation used for calculation

This equation is in package framinghamRiskEquation https://github.com/DavidPatShuiFong/framinghamRiskEquation.

?framinghamRiskEquation::framingham_riskequation
framingham_riskequation R Documentation

Framingham Risk Equation

Description

Calculate cardiovascular disease risk according to Framingham Risk Equation

Usage

framingham_riskequation(df, years = 5, outcome = "CVD")

Arguments

df

a dataframe, which must include the following columns/fields:

  • InternalID (numeric) case identifier

  • CardiovascularDisease (logical - TRUE or FALSE)

  • Diabetes (logical)

  • SmokingStatus (character) - “Smoker” if a smoker. All other values ignored

  • UrineAlbuminDate (character), UrineAlbuminValue (double), UrineAlbuminUnit (character)

  • PersistentProteinuria (logical)

  • eGFRDate (date), eGFRValue (double), eGFRUnits (character)

  • FamilialHypercholesterolaemia (logical)

  • LVH (logical) = left ventricular hyp0ertrophy

  • Cholesterol (double) in millimoles per litre (mmol/L or mM)

  • Triglycerides (double) in millimoles per litre (mmol/L or mM)

  • CholHDLRatio (double)

  • BP (character, two numbers separated by “/”) in mmHg

  • Sex (character) “Female” or not

  • Ethnicity (character) “Aboriginal”, “Torres Strait Islander”, “Aboriginal/Torres Strait Islander” or not

  • Age (double)

years

number of years to predict (from 4 to 12). default is 5 years.

outcome

(default is “CVD”)

“CHD” - coronary heart disease. includes myocardial infarction, death from coronary heart disease plus angina pectoris and coronary insufficiency.

“CVD” cardiovascular disease (the default) includes coronary heart disease, stroke (including transient ischaemia), congestive heart failure and peripheral vascular disease.

Details

Equations and examples sourced from:

  • “Guidelines for the management of Absolute cardiovascular disease risk. 2012” by the National Vascular Disease Prevention Alliance of Australia. http://www.cvdcheck.org.au/pdf/Absolute_CVD_Risk_Full_Guidelines.pdf

  • “Cardiovascular Disease Risk Profiles” by Keaven M. Anderson, Patricia M. Odell, Peter W.F. Wilson, William B. Kannel in ‘American Heart Journal’ 1991; 121:293-298

  • “An Updated Coronary Risk Profile - A Statement for Health Professionals” by Keaven M. Anderson, Peter W.F. Wilson, Patricia M. Odell, William B. Kannel in AHA (American Heart Association) Medical/Scientific Statement, sourced from http://ahajournals.org

Value

a dataframe

  • InternalID - the internalID of the person’s row in the df (dataframe) parameter

  • frisk - numeric (a number, or ‘NA’ if not enough information to computer),

  • friskHI - either ‘NA’ or ‘>15%’. >15%’ are groups considered equivalent risk to already having ischaemic heart disease.

Examples


framingham_riskequation(data.frame(InternalID = 1, BP = "135/80", Sex = "Female",
 Age = 55,
 SmokingStatus = "Smoker", CholHDLRatio = 230/48, Diabetes = TRUE, LVH = FALSE,
  CardiovascularDisease = FALSE, PersistentProteinuria = FALSE, eGFRValue = NA,
   eGFRUnits = NA, UrineAlbuminValue = NA, UrineAlbuminUnits = NA,
   FamilialHypercholesterolaemia = NA, Cholesterol = 5.96, Ethnicity = NA),
    outcome = "CHD", years = 10)
    # this comes from "Cardiovascular disease risk profiles" (Anderson 1991)
    # the worked answer in the paper is 0.22. this function returns 0.2189125
    # the same risk-factors with outcome = "CVD" and years = 5 returns 0.180
    #  (cvdcheck.org.au reports 18%)
    # the same risk-factors except Sex = "Male" with outcome = "CVD" and years = 5 returns 0.202
    #  (cvdcheck.org.au reports 20%)

framingham_riskequation(data.frame(InternalID = 2, BP = "130/80", Sex = "Male",
 Age = 55,
 SmokingStatus = "Smoker", CholHDLRatio = 240/45, Diabetes = FALSE, LVH = FALSE,
  CardiovascularDisease = FALSE, PersistentProteinuria = FALSE, eGFRValue = NA,
   eGFRUnits = NA, UrineAlbuminValue = NA, UrineAlbuminUnits = NA,
   FamilialHypercholesterolaemia = NA, Cholesterol = 6.22, Ethnicity = NA),
    outcome = "CHD", years = 10)
    # this comes from "An Updated Coronary Risk Profile" (Anderson 1991)
    # the worked answer in the paper is 0.192, this function returns 0.1919
    # the same risk-factors with outcome = "CVD" and years = 5 returns 0.133
    #  (cvdcheck.org.au reports 13%)
    # the same risk-factors except LVH = TRUE (outcome = CVD, years = 5) returns 0.211
    #  (cvdcheck.org.au reports 21%)

framingham_riskequation(data.frame(InternalID = 3, BP = "130/80", Sex = "Female",
 Age = 55,
 SmokingStatus = "Smoker", CholHDLRatio = 240/45, Diabetes = FALSE, LVH = FALSE,
  CardiovascularDisease = FALSE, PersistentProteinuria = FALSE, eGFRValue = NA,
   eGFRUnits = NA, UrineAlbuminValue = NA, UrineAlbuminUnits = NA,
   FamilialHypercholesterolaemia = NA, Cholesterol = 6.22, Ethnicity = NA),
    outcome = "CHD", years = 10)
    # this comes from "An Updated Coronary Risk Profile" (Anderson 1991)
    # the worked answer in the paper is 0.135, this function returns 0.1349
    # the same risk-factors with outcome = "CVD" and years = 5 returns 0.088
    #  (cvdcheck.org.au reports 9%)
    # the same risk-factors except LVH = TRUE (outcome = CVD, years = 5) returns 0.150
    #  (cvdcheck.org.au reports 15%)

The framingham risk equation function is reproduced below. Please report any required corrections to me!

function (df, years = 5, outcome = "CVD") 
{
    fre_coefficients <- data.frame(row.names = c("CHD", "CVD"), 
        theta0 = c(0.9145, 0.6536), theta1 = c(-0.2784, -0.2402), 
        beta0 = c(15.5305, 18.8144), female = c(28.4441, -1.2146), 
        log_age = c(-1.4792, -1.8443), log_age2 = c(0, 0), log_age_female = c(-14.4588, 
            0.3668), log_age2_female = c(1.8515, 0), log_SBP = c(-0.9119, 
            -1.4032), cigarettes = c(-0.2767, -0.3899), log_TCHDLratio = c(-0.7181, 
            -0.539), diabetes = c(-0.1759, -0.3036), diabetes_female = c(-0.1999, 
            -0.1697), ECGLVH = c(-0.5865, -0.3362))
    fre_b <- fre_coefficients[outcome, ]
    f <- df %>>% tidyr::separate(BP, into = c("Systolic", "Diastolic"), 
        sep = "/", convert = TRUE) %>>% dplyr::mutate(mu = fre_b$beta0 + 
        fre_b$female * (Sex == "Female") + fre_b$log_age * log(Age) + 
        fre_b$log_age_female * log(Age) * (Sex == "Female") + 
        fre_b$log_age2_female * log(Age)^2 * (Sex == "Female") + 
        fre_b$log_SBP * log(Systolic) + fre_b$cigarettes * (SmokingStatus == 
        "Smoker") + fre_b$log_TCHDLratio * log(CholHDLRatio) + 
        fre_b$diabetes * Diabetes + fre_b$diabetes_female * Diabetes * 
        (Sex == "Female") + fre_b$ECGLVH * LVH, sigma = exp(fre_b$theta0 + 
        fre_b$theta1 * mu), u = (log(years) - mu)/sigma, frisk = 1 - 
        exp(-exp(u))) %>>% dplyr::mutate(friskHI = dplyr::case_when(CardiovascularDisease ~ 
        ">15%", Diabetes & (Age > 60) ~ ">15%", Diabetes & UrineAlbuminValue > 
        20 & UrineAlbuminUnits == "mcg/min" ~ ">15%", Diabetes & 
        Sex == "Male" & UrineAlbuminValue > 2.5 & UrineAlbuminUnits == 
        "mg/mmol" ~ ">15%", Diabetes & Sex == "Female" & UrineAlbuminValue > 
        3.5 & UrineAlbuminUnits == "mg/mmol" ~ ">15%", PersistentProteinuria == 
        TRUE ~ ">15%", eGFRValue < 45 & eGFRUnits == "mL/min" ~ 
        ">15%", FamilialHypercholesterolaemia == TRUE ~ ">15%", 
        Systolic >= 180 | Diastolic >= 110 ~ ">15%", Cholesterol > 
            7.5 ~ ">15%", Ethnicity %in% c("Aboriginal", "Torres Strait Islander", 
            "Aboriginal/Torres Strait Islander") & Age > 74 ~ 
            ">15%", TRUE ~ as.character(NA))) %>>% dplyr::select(InternalID, 
        frisk, friskHI)
    return(f)
}
<bytecode: 0x000000001f43c960>
<environment: namespace:framinghamRiskEquation>

15 Close the database connections

a$close()