A spatem-filter facilitates the filtering of spatial-temporal (spatem) IoT data data based on a standardised set of parameters.
spatem-filter is a lightweight Node.js package that is typically used with a chimps instance and the barnacles-x family of modules which relay spatem data to specific endpoints. Together these packages are core components of reelyActive's Pareto Anywhere open source IoT middleware.
See also the spatem-filter's sister modules, raddec-filter and dynamb-filter.
const SpatemFilter = require('spatem-filter');
let parameters = {
acceptedDeviceSignatures: [ 'aabbccddeeff/2', '112233445566/2' ],
acceptedDeviceIds: [ 'aabbccddeeff', '112233445566' ],
acceptedDeviceIdTypes: [ 2 ]
}
let filter = new SpatemFilter(parameters);
let spatem = { /* Spatem properties */ };
let accepted = filter.isPassing(spatem);
console.log(accepted); // true or false
See the reelyActive Developer's Cheatsheet for a detailed description of the spatem and its properties.
The following parameters are supported:
Array of device signatures to accept. A filtered spatem must have its device signature (deviceId and deviceIdType) included in the list to pass. For example, to only allow spatems from a device with EUI-48 identifier aa:bb:cc:dd:ee:ff to pass:
let acceptedDeviceSignatures = [ 'aabbccddeeff/2' ];
Array of deviceIds to accept. A filtered spatem must have a deviceId included in the list to pass. For example, to only allow spatems from devices with the identifier aa:bb:cc:dd:ee:ff to pass:
let acceptedDeviceIds = [ 'aabbccddeeff' ];
Array of deviceIdTypes to accept. See the list of identifier types for details. A filtered spatem must have a deviceIdType included in the list to pass. For example, to only allow spatems from devices with EUI-48 and random 48-bit identifiers to pass:
let acceptedDeviceIdTypes = [ 2, 3 ];
The spatem-filter will iterate sequentially through each included filter parameter, and return false
if any should fail. If all included filter parameters are passing, the spatem-filter will return true
.
Discover how to contribute to this open source project which upholds a standard code of conduct.
Consult our security policy for best practices using this open source software and to report vulnerabilities.
MIT License
Copyright (c) 2025 reelyActive
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.