Skip to contents

If supplied with at least a partner_id and name of the contact, create a new record for a partner contact in the database.

Usage

insert_contact(
  name = NA,
  partner_id = NA,
  role = c("Site contact", "Chairperson", "Reporting person"),
  email_address = NA,
  phone_number = NA,
  test_db = FALSE
)

Arguments

name

The name of the partner contact that is being added to the database. The first name and surname of the contact should be provided.

partner_id

The record ID of the partner for whom this individual a contact. The joins the contact to the partners table appropriately.

role

The role of this contact, either Site contact, Chairperson, or Reporting provider. Note that multiple roles might be assigned to one individual, with a separate record in contacts for each of these roles.

email_address

An optional email address for the contact. Ideally, either an email address or a telephone number should be provided (or both).

phone_number

An optional phone number for the contact. Ideally, either an email address or a telephone number should be provided (or both).

test_db

Is this connection to the test database (TRUE) or not (FALSE)? Defaults to FALSE.

Value

A data frame with one row containing the newly-added entry.

Examples

insert_contact(name = "Bilbo Baggins", partner_id = "P1", role = "Chairperson", test_db = TRUE)
#>    id partner_id          name email_address phone_number        role
#> 1 PO2         P1 Bilbo Baggins          <NA>         <NA> Chairperson