lum/lum-spjs

Lum SPJS simple processor

v2.0.0 2021-12-16 00:00 UTC

This package is auto-updated.

Last update: 2024-11-29 05:39:26 UTC


README

Summary

Statistical Processing for JSON Structures

A really minimal data processing library that I've used in a couple projects. You pass it a data set (returned from say a CSV file) which is an array of associative arrays, and then pass it an array of statements (which themselves are an array of associative arrays defining rules to apply to the data.)

Classes

Example

Initial Data

[
  {"id":1, "ctype":1},
  {"id":2, "ctype":1},
  {"id":3, "ctype":5},
  {"id":4, "ctype":3},
  {"id":5, "ctype":6}
]

Statements

[
  {"always": true, "set": {"rtype": 0}},
  {"if":{"ctype":[1,2,5]}, "set": {"rtype": 1}},
  {"if":{"ctype":[3,4]}, "set": {"rtype": 2}}
]

Processed Data

[
  {"id":1, "ctype":1, "rtype": 1},
  {"id":2, "ctype":1, "rtype": 1},
  {"id":3, "ctype":5, "rtype": 1},
  {"id":4, "ctype":3, "rtype": 2},
  {"id":5, "ctype":6, "rtype": 0}
]

TODO

Write tests.

Official URLs

This library can be found in two places:

Author

Timothy Totten

License

MIT