Learn R Programming

telraamStats

The aim of this package is to grant the user tools for data visualisation and data analysis of mobility data for Telraam sensors.

An example of using this package can be seen in this application, although it also utilizes more advanced representations.

Link to Github repository

Telraam Sensors

Telraam is a Belgian company that offers a citizen-powered solution for gathering diverse traffic data using an affordable device. The sensor continuously monitors street activity from a citizen's window, capturing data on various transportation modes like cars, heavy vehicles, cyclists, and pedestrians. This data is crucial for informing traffic planning and engaging local communities in dialogue with authorities.

The sensors employs advanced AI and proprietary algorithms to detect, classify and count road users, providing anonymous, aggregate data with a 15-minute resolution. The device operates autonomously once installed in an upper-floor window with an unobstructed view of the street. Data collected by Telraam devices can be shared as Open Data.

For more information or to view the map of currently available sensors, you can visit the Telraam website.

Specific Terms

Telraam data includes specific terms that are essential for further use of this package :

  • segment is the abbreviated term for a road segment. A road segment is a part of a road, defined by a set of geographical coordinate pairs and a Telraam id. These segments are defined typically between two corners of a street, so a longer street will most likely consist of multiple road segments ;
  • a sensor is the device that measures traffic in a specific segment. Multiple sensors can be associated with the same road segment, but a unique sensor is not linked to multiple segments. Sensors are also defined by their configuration, primarily their version (either V1 or S2, with S2 being the most advanced version of Telraam devices) ;
  • the uptime: Telraam V1 sensors don't count trafic 100% of the time. A portion of their time is used for calculations and preprocessing. The uptime is the percentage of time during which the counter is actively counting. Data provided through the Telraam API is already corrected for this uptime but Telraam recommends keeping an eye on the uptime values. A high uptime, typically between 0.7-0.8, indicates very good data. The first and last daylight hour of the day will consistently have lower uptimes due to the aforementioned reasons, but if uptimes during the day are below 0.5, it usually indicates a potential issue with the instance. Uptime for Telraam S2 units is almost always 1.

Licence

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Install Package

install.packages('telraamStats')
library(telraamStats)

Vignettes

Two vignettes are currently available:

  • one explaining the retrieval of Telraam data and describing the data included in the package (vignette("data-details"))
  • the second detailing the available graphical representations (vignette("data-visualization")).

Future Developments

Future developments will focus on data quality topics: descriptive statistics and visualizations of data quality, as well as imputation methods for data with low update frequencies (indicating low quality).

Copy Link

Version

Install

install.packages('telraamStats')

Monthly Downloads

137

Version

1.1.2

License

CC BY 4.0

Maintainer

Ketsia Guichard

Last Published

May 27th, 2024

Functions in telraamStats (1.1.2)

get_graph_subtitles

Create subtitles for graphics.
is_vacation

Indicates if a date is in vacation period and if true, which vacation.
write_update_data

Write or update the sensor data in the data folder
get_segment_name

Get the name of a segment giving its id
set_global_vars

Function to set up the global variables for public holidays and vacations, with the default being the french dates from a governmental API.
seq_by_3_month

Generate sequence of intervals with three-month periods
gg_car_speed_histogram

Histogram of car speed over a period, for a segment or a subset of segment.
import_sensor

Imports data associated with a list of sensors
gg_traffic_evolution

Evolution of traffic and smoothed traffic.
gg_availability

Availability and quality of sensors during a period through a heatmap.
set_telraam_token

Saves an authentication token for the 'Telraam' API.
get_config_path

Get the path of configuration file.
retrieve_sensor

Retrieves data associated with a sensor from the Telraam API
preprocess_car_speed

Preprocessing mandatory for car speed graphs functions
get_custom_palette

Colors palettes for each option (mode, direction, segment_name, weekday, hour)
melt_direction_mode

Melt dataframe to obtain one row per hour/segment/transportation mode/direction This format makes graphs with ggplot and filtering easier.
traffic

Traffic data of Telraam sensors in Châteaubourg (FR)
get_api_state

Check API state
create_config

Create config file if needed.
enrich_special_days

Enrich traffic data with french vacation and public holidays
filter_agg

Filter by selected criteria and aggregating traffics.
enrich_traffic

Enrich traffic data with date features, names and uptime filters.
convert_string_to_list

Convert a character string into a numeric vector
enrich_name

Enrich traffic data with segment name
enrich_dates

Enrich traffic data with date informations.
enrich_uptime

Enrich traffic data with uptime quality indication
check_options_graph

Check if options are available in the options list, replace by a default otherwise.
get_telraam_token

Get the current authentication token for the 'Telraam' API
get_segments

Get Telraam segments into a named vector
gg_traffic_avg

Average of traffic during a week.
gg_car_speed_v85

Average of v85 car speed per hour over a period, for a segment or a subset of segment.