Header row

pemr: A Unified R Interface for Managing Personal Exposure Monitor Data in Air Pollution Research

Oscar de León
Universidad del Valle de Guatemala

Abstract Personal air pollution monitoring relies on a variety of portable devices, each recording data from different sensors in non-standard formats and data structures, saved to local files or uploaded to web APIs. Tools are needed in R to handle these data in a device- and format-agnostic way. The pemr package aims to provide a unified interface to collect and handle personal air pollution monitoring data.

Body row

Data sources

Personal exposure monitors

RTI Enhanced MicroPEM (ECM)


Air pollution monitoring

  • Monitor worn by person
  • Standardized setup:
    • Set duration
    • Constant air flow
      (e.g. 1 L/min)
    • Physical separation of particles
    • Filter to capture particles
    • Counting particles in real-time

Current: Device-specific parsing

  • Files collected from in-device memory
  • Monitoring session metadata saved in file name
  • Ad-hoc script to read the file
    • Header with settings information
    • Body with time series of collected data

Issues

  • System specific settings
  • Code repetition
  • Reproducibility more difficult


The role of pemr

# Single function to read data
pemr::read_monitor(
  file = "your-file",
  type = "monitor-type"
)

# Handles each monitor type internally
pemr:::read_em_ecm(file, skip = 24, ...)
pemr:::read_em_upas(file, ...)

# And nested metadata is handled for
# for each monitor type
pemr::collect_data(
  .data = "data-column",
  type = "monitor-type"
)

Further development needed

  • pemr handles 4 types
    • RTI MicroPEM
    • RTI ECM
    • PATS+
    • UPAS
  • Research monitors
    • Under active development
    • Data structure changes
    • Loss of support
  • Consumer monitors
    • Lower precision, but lower cost
    • Smaller and longer monitoring
    • Data web APIs

Future of pemr

  • Plugin architecture
    • Handle web APIs
    • Users can define custom data structures
# json
{
  "device_profile": "RTI_MicroPEM_v1",
  "data_source_type": "file",
  "format": {
     ...
  }
}