Skip to contents

The transit integrated data exchange standard (TIDES) specifies columns that should be present in AVL data tables and the data types of these columns. This function verifies if those columns are present in the input avl_df, and those columns are of the correct data type. See Details for more information.

Usage

validate_tides(avl_df)

Arguments

avl_df

A dataframe of AVL data, either in GPS (longitude/latitude) form or linearized distance form.

Value

A dataframe of each required field, required data type, whether the field is present, and whether the data type matches expectations.

Details

The AVL cleaning functions in this package generally require the input dataframes to adhere to the TIDES vehicle_locations table schema. The following columns and data types are checked by this validator:

  • location_ping_id: Should be a character string.

  • trip_id_performed: Should be a character string.

  • event_timestamp: Should be a POSIXct date-time.

  • vehicle_id: Should be a character string.

  • operator_id: Should be a character string. This field is not standard in TIDES vehicle_locations, and is not a strict requirement for any AVL processing functions.

  • longitude and latitude: Should be numeric. These fields are required only to linearize AVL data, and not used afterwards.

  • distance: Should be numeric. This field is not standard in TIDES vehicle_locations, and is generated by get_linear_distances(). It is required by most other AVL processing functions.

  • speed: Should be numeric. This field is not a strict requirement for any AVL processing functions.

Each AVL processing function in transittraj uses specific fields. Each function verifies that the required fields and data types are present before proceeding.

Examples

wmata_tides_val <- validate_tides(avl_df = wmata_avl)
print(wmata_tides_val)
#>      required_field required_field_type field_present actual_field_type
#> 1  location_ping_id           character          TRUE         character
#> 2 trip_id_performed           character          TRUE         character
#> 3   event_timestamp             POSIXct          TRUE           POSIXct
#> 4        vehicle_id           character          TRUE         character
#> 5       operator_id           character         FALSE              <NA>
#> 6         longitude             numeric          TRUE           numeric
#> 7          latitude             numeric          TRUE           numeric
#> 8          distance             numeric         FALSE              <NA>
#> 9             speed             numeric          TRUE           numeric
#>   field_type_ok field_ok
#> 1          TRUE     TRUE
#> 2          TRUE     TRUE
#> 3          TRUE     TRUE
#> 4          TRUE     TRUE
#> 5            NA    FALSE
#> 6          TRUE     TRUE
#> 7          TRUE     TRUE
#> 8            NA    FALSE
#> 9          TRUE     TRUE