Extending the Code
The API has been written so you can write and use your own:
- Function types
- Transforms - including but not limited to:
- Data aggregators
- Perturbation algorithms
- Rounding algorithms
- Field exclusion rules
- Sparsity restriction checks
- Replacing functions with new ones
- Supplementing functions with derived data
- Removing hidden fields and data
- Pipelines (eg. an alternative to the standard
- Authorization interfaces
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:
function_types: - protari.example_function_types.foo_type - myapp.function_types.correlation
The first function type in the above example adds a new function
See the referenced file for more detail, along with
Custom transforms and pipelines
Custom transforms (including pipelines) can be defined in the same way as the sql tbe pipeline, eg:
transform_definitions: power: reference: myapp.transform.power.Power parameters: exponent: 3 power_pipeline: reference: protari.transform.Compose transform_sequence: - 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:
includes: - sql_tbe_pipeline # To also include the standard SQL TBE pipeline. - /path/to/power_pipeline.yaml
You can run your own instance by first installing Protari into your environment (eg. using
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.
to run your custom version of the API.