TableTransforms.jl icon indicating copy to clipboard operation
TableTransforms.jl copied to clipboard

More general assertion API

Open juliohm opened this issue 3 years ago • 0 comments

Currently we provide a few basic checks as assertion functions that can be used before the transform is applied. For example, some transforms like EigenAnalysis only make sense with continuous variables. We need to refactor this API and consider assertions that apply to a specific ColSpec and assertions that hold state.

In particular, we could return a list of structs in the assertions function that represent different types of assertion. For example, we could consider something like:

"""
    SciTypeAssertion{T}(colspec)

Asserts that the columns in the `colspec` have a scientific type `T`.
"""
struct SciTypeAssertion{T,S}
  colspec::S
end

We could then introduce an API apply(assertion, table) to throw an error whenever the checks fail. The name of the function could also be something else to avoid confusion with the apply of transforms.

juliohm avatar Jun 11 '22 12:06 juliohm