find_latest: Find latest

View source: R/find_latest_events.R

find_latestR Documentation

Find latest

Description

Find the latest A360 event for follow up from a list of service provision reports stored in a google spreadsheet.

Usage

find_latest(events, from = NULL, ...)

find_latest_by_name_and_id(events)

find_latest_by_name(events)

find_latest_by_phone_number(events)

Arguments

events

A data frame with events to find.

from

A google spreadsheet ID, where to search the events from.

...

Additional params passed to the read_sheet.

Details

The latest event is determined using the girl ID, name of girl, and phone number for girls with a single report and date of service provision for girls with multiple reports.

In cases where there are multiple reports for the same girl, but the newest is missing the phone number, the newest record is updated with any available phone number in the reports:

  • record 1 phone number : NA

  • record 2 phone number : XXX XXX XXXX

  • record 3 phone number : NA

the newest record will be assigned the phone number : XXX XXX XXXX

this is similar to cases where there different phone numbers:

  • record 1 phone number : NA

  • record 2 phone number : XXX XXX XXXX

  • record 3 phone number : YYY XXX YYYY

the newest record will be assigned both available phone numbers : XXX XXX XXXX | YYY XXX YYYY

the phone number is validated; only records with a phone number equal to or more than 10 digits are returned.

Value

A data.table object with the latest unique events for follow up.

Functions

  • find_latest: Find the latest event for follow up

  • find_latest_by_name_and_id: Find the latest event by girl id and name

  • find_latest_by_name: Find latest the event by name

  • find_latest_by_phone_number: Find the latest event by phone number


psi-mis/a360connect documentation built on Nov. 22, 2022, 12:36 p.m.