Skip to contents

R package · Tidy surveillance data

Helpful functions for cleaning and manipulating surveillance data — especially creating and validating panel data from individual-level records.

Get started Browse the reference →

cstidy logo

cstidy puts aggregated disease-surveillance counts into one standard panel format, and derives the time and geography columns that format needs. Give it a table with a time column and a location_code. You get back the same table with isoyear, isoweek, season, seasonweek, date and the granularity columns filled in. It does not aggregate individual-level records — aggregate first, then use cstidy.

cstidy is built by Core Surveillance, a team at the Norwegian Institute of Public Health (NIPH; Folkehelseinstituttet, FHI), alongside cstime, csdata, csalert and csstyle. The cs prefix is Core Surveillance; the format class csfmt_rts_data_v3 is core surveillance format, real-time surveillance data, version 3. Defaults follow NIPH convention — a surveillance season runs from ISO week 35 to ISO week 34, and geography codes are Norwegian.

Features

01

Standard data format

Apply set_csfmt_rts_data_v3() for the slim weekly format. Apply set_csfmt_rts_data_v2() for the older format, which derives 18 unified columns and also covers daily and yearly data.

02

Smart assignment

Assigning isoyear, isoyearweek, date, or location_code with := automatically re-derives all dependent time and geography columns.

03

Panel inspection

Check completeness with unique_time_series(), extend to a future time point with expand_time_to(), and plot column structure with identify_data_structure().