Extending the Code

The API has been written so you can write and use your own:

To use your own implementations of one of these, just provide the path to them in your settings file.

Custom function types

To define additional function types, include a section like this in your settings file:

  - protari.example_function_types.foo_type
  - myapp.function_types.correlation

The first function type in the above example adds a new function foo. See the referenced file for more detail, along with tests.core.test_function_types.

Custom transforms and pipelines

Custom transforms (including pipelines) can be defined in the same way as the sql tbe pipeline, eg:

    reference: myapp.transform.power.Power
      exponent: 3
    reference: protari.transform.Compose
    - get_aggregated_sql_data
    - power
    - remove_none

If the above is saved as /path/to/power_pipeline.yaml, then you can include it into your main settings file via:

- sql_tbe_pipeline                   # To also include the standard SQL TBE pipeline.
- /path/to/power_pipeline.yaml

Code organization

You can run your own instance by first installing Protari into your environment (eg. using pip), and then writing an application.py file, eg. based on the one in Protari-API. You have the flexibility to use a customised version instead.

Then use

python application.py

to run your custom version of the API.