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.
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 acharacterstring.trip_id_performed: Should be acharacterstring.event_timestamp: Should be aPOSIXctdate-time.vehicle_id: Should be acharacterstring.operator_id: Should be acharacterstring. This field is not standard in TIDESvehicle_locations, and is not a strict requirement for any AVL processing functions.longitudeandlatitude: Should benumeric. These fields are required only to linearize AVL data, and not used afterwards.distance: Should benumeric. This field is not standard in TIDESvehicle_locations, and is generated byget_linear_distances(). It is required by most other AVL processing functions.speed: Should benumeric. 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