Parameters

Overview

Parameters allow you to centrally manage a group of values for use throughout a workflow. Any changes you make to this parameter will be simultaneously updated everywhere it's used.

This may be useful in many situations, including where:

  • A set of diagnosis codes are entered in multiple filters that may change over time as you build your analysis

  • You have a single value used in multiple places that you want to be able to quickly change everywhere at once.

Creating parameters

To create and update parameters, you can click the Parameters button at the top left of workflow tool top bar.

You can create, modify, search for, filter on, and delete parameters from this interface.

Parameters can have up to 10,000 values. Each individual value can be up to 255 characters. Any spaces included within a value are preserved as entered (e.g., "NYC " will retain the trailing space and would not be trimmed to "NYC").

Parameter values should never be quoted, unless you specifically want to match against a quoted character.

Importing and exporting

Values can be copied into parameters from any spreadsheet program by directly using the clipboard. For bulk or scripted actions, you may also import multiple parameters as a JSON or CSV file. Note that any parameter exports will follow the same format.

CSV specification

Each variable in your CSV will represent one parameter, with the first row containing the name of the parameter. E.g.:

Fruits

Vegetables

Item_codes

Strawberry

Broccoli

1

Tomato

Asparagus

2

Apple

Spinach

3

JSON specification

The same set of parameters can be imported via JSON, with the following format:

[
    { 
        "name": "Fruits",
        "values": ["Strawberry", "Tomato", "Apple"]
    },
    { 
        "name": "Vegetables",
        "values": ["Broccoli", "Asparagus", "Spinach"]
    },
    { 
        "name": "Item_codes",
        "values": ["1", "2", "3"]
        // This is identical:
        // "values": [1, 2, 3]
    },
]

Exporting

You can export all parameters at once as either .csv or .json files.

Parameter types

All variables in Redivis have a defined type. Redivis will automatically determine the most specific type for all the values in a parameter, falling back to the "universal type" of string.

For example, these combinations will yield the corresponding specific types and can be compared to the following types:

Values

Type

Can compare to

1, 2, 3

Integer

Integer, Float, String

1, 2.0, 3

Integer

Integer, Float, String

1, 1.0, 1.1

Float

Float, String

1, 2.0, a

String

String

1971-01-01, 1972-02-02, 1973-03-03

Date

Date, String

1971-01-01, a, b

String

String

1970-01-01 12:00:00, 1970-01-01 12:30:00

DateTime

DateTime, Date, String

Using parameters

Parameters can be referenced in transforms and notebooks within the workflow they are stored in.

When using parameters, the parameter type needs to be the same (or coercible to) the type required of for the input.

If you update the values in a parameter, all transforms and notebooks that reference the parameter will be marked as stale on the workflow tree.

Transforms

You can reference the parameter in transform interface anywhere you can input multiple values. Where you would input your value(s) you can scroll to the bottom of the menu to find your parameters.

You can also reference parameters in SQL steps programmatically.

Notebooks

You can reference a parameter in a notebook with any kernel type in your code

  • You can reference the parameter's name, but this linkage will break if the name changes.

    • E.g. @icd_codes

  • You can reference the parameter's reference ID to create a permanent linkage. This ID can be copied in the bottom of the parameter modal. See more about referencing resources on Redivis.

    • E.g. @icd_codes:7br5

For specifics on how to reference parameters in your workflow see the details in the relevant client libraries

  • Python

  • R

Versioning and reverting

Each time a transform or notebook is run using a parameter, a historic timestamp is created to reflect what the values were at that moment. You can view any previous versions of a parameter by opening its history and selecting the timestamp associated with the transform run.

When looking at a previous version you can see what values were added and removed between this version and the current parameter.

You can revert to a previous version to restore values from that point in time.

Last updated

Was this helpful?