Skip to contents

Counts what Peskas has collected in each country and district (survey submissions, enumerators, landing sites, the dates covered and GPS-tracked trips) and writes the numbers as of today to the collection_stats table of the Airtable frame base, one row per country and one per district.

Usage

export_collection_stats(log_threshold = logger::DEBUG, package = "coasts")

Arguments

log_threshold

Logging threshold.

package

Name of the package whose inst/conf.yml to read.

Value

Invisibly, the tibble written to Airtable.

Details

Every number comes from an output that already exists:

  • Submissions, landing sites and dates: each country's trips-raw and trips-validated files in the peskas-api bucket (api.trips), so survey programmes the API does not publish are not counted.

  • Enumerators: the surveys_flags-<form id> collections of the validation database, for the forms in those files. Kenya's WCS form records no enumerator, so its submissions add none. Timor-Leste's enumerators share logins and its flags name the reporting region instead, one enumerator each, so there regions are counted.

  • GPS trips: the country's pds-trips file for the country row; for a district row, the trips generate_fleet_analysis() places in it (<country>-aggregated).

Rows are matched on key (kenya, kenya-103651), so each run overwrites the previous numbers; a district that drops out keeps its last ones.

See also