Skip to content

supernovus/lum.spjs.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

lum.spjs.php

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

Class Description
Lum\SPJS The SPJS processor.

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

About

Statistical Processing from JSON Structures

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages