Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Aggregates hi-res data from ATC traffic signal controllers into 15-minute binned ATSPM/performance measures.
atspm
is a lightweight production-ready Python package to efficiently transform traffic signal controller event logs into Aggregate Traffic Signal Performance Measures.
This project focuses only on transforming event logs into performance measures and troubleshooting data, it does include data visualization. Feel free to submit feature requests or bug reports or to reach out with questions or comments. Contributions are welcome!
pip install atspm
Or pinned to a specific version:
pip install atspm==1.x.x
atspm
works on Python 3.10-3.12 and is tested on Ubuntu, Windows, and MacOS.
The best place to start is with these self-contained example uses in Colab!
Here's an example of how to use atspm
(but see the Colab link above for more examples):
# Import libraries
from atspm import SignalDataProcessor, sample_data
params = {
# Global Settings
'raw_data': sample_data.data, # dataframe or file path
'detector_config': sample_data.config,
'bin_size': 15, # in minutes
'output_dir': 'test_folder',
'output_to_separate_folders': True,
'output_format': 'csv', # csv/parquet/json
'output_file_prefix': 'prefix_',
'remove_incomplete': True, # Remove periods with incomplete data
'unmatched_event_settings': { # For incremental processing
'df_or_path': 'test_folder/unmatched.parquet',
'split_fail_df_or_path': 'test_folder/sf_unmatched.parquet',
'max_days_old': 14},
'to_sql': False, # Returns SQL string
'verbose': 1, # 0: print off, 1: print performance, 2: print all
# Performance Measures
'aggregations': [
{'name': 'has_data', 'params': {'no_data_min': 5, 'min_data_points': 3}},
{'name': 'actuations', 'params': {}},
{'name': 'arrival_on_green', 'params': {'latency_offset_seconds': 0}},
{'name': 'communications', 'params': {'event_codes': '400,503,502'}},# MAXVIEW Specific
{'name': 'coordination', 'params': {}}, # MAXTIME Specific
{'name': 'ped', 'params': {}},
{'name': 'unique_ped', 'params': {'seconds_between_actuations': 15}},
{'name': 'full_ped', 'params': {
'seconds_between_actuations': 15,
'return_volumes': True
}},
{'name': 'split_failures', 'params': {
'red_time': 5,
'red_occupancy_threshold': 0.80,
'green_occupancy_threshold': 0.80,
'by_approach': True,
'by_cycle': False
}},
{'name': 'splits', 'params': {}}, # MAXTIME Specific
{'name': 'terminations', 'params': {}},
{'name': 'yellow_red', 'params': {
'latency_offset_seconds': 1.5,
'min_red_offset': -8
}},
{'name': 'timeline', 'params': {'min_duration': 0.2, 'cushion_time': 60}},
]
}
processor = SignalDataProcessor(**params)
processor.run()
After running the SignalDataProcessor
, the output directory will have the following structure:
test_folder/
unmatched.parquet
sf_unmatched.parquet
├── actuations/
├── yellow_red/
├── arrival_on_green/
├── coordination/
├── terminations/
├── split_failures/
...etc...
Inside each folder, there will be a CSV file named prefix_.csv
with the aggregated performance data. In production, the prefix could be named using the date/time of the run. Or you can output everything to a single folder.
A good way to use the data is to output as parquet to separate folders, and then a data visualization tool like Power BI can read in all the files in each folder and create a dashboard. For example, see: Oregon DOT ATSPM Dashboard
Use of CSV files in production should be avoided, instead use Parquet file format, which is significantly faster, smaller, and enforces datatypes.
The following performance measures are included:
Coming Soon:
Detailed documentation for each measure is coming soon.
Fixed a timestamp conversion issue when reading unmatched events from a csv file. Updated the unit tests to catch this issue in the future.
Ideas and contributions are welcome! Please feel free to submit a Pull Request. Note that GitHub Actions will automatically run unit tests on your code.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Aggregates hi-res data from ATC traffic signal controllers into 15-minute binned ATSPM/performance measures.
We found that atspm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.