Skip to content

Latest commit

 

History

History
1456 lines (604 loc) · 40.6 KB

PROTOCOL_BUFFERS.md

File metadata and controls

1456 lines (604 loc) · 40.6 KB

Protocol Documentation

Table of Contents

Top

column.proto

Column

Defines a column in the UI.

Field Type Label Description
key string A unique key for the column. By default, used to look up attributes in the displayed data.
width_string string Passed directly to the style of the column. "100%" can be used to take up space remaining after laying out fixed columns.
width_double double Units used by the UI library to standardize dimensions.
title string The visible title of the column.
sortable bool Whether the column supports sorting.
filterable bool Whether the column supports filtering.

Top

criteriaselector/configschema/attribute.proto

Attribute

A criteria based on a categorical (i.e. an enum) or numeric attribute of the primary entity.

Field Type Label Description
attribute string The attribute of interest.
multiRange bool Whether multiple ranges can be simultaneously specified for the attribute within a single criteria.
unit string optional An optional unit to show in the criteria UI.

Top

criteriaselector/configschema/biovu.proto

BioVU

Field Type Label Description
plasmaFilter bool

Top

criteriaselector/configschema/entity_group.proto

EntityGroup

A criteria based on one or more entity groups. This allows the selection of primary entities which are related to one or more of another entity which match certain characteristics (e.g. people related to condition_occurrences which have condition_name of "Diabetes").

Field Type Label Description
columns tanagra.Column repeated Columns displayed in the list view.
hierarchy_columns tanagra.Column repeated Columns displayed in the hierarchy view.
name_column_index int32 This has been replaced by nameAttribute for determining stored names. Now this only determines which is the primary column for checkboxes, etc.
classification_entity_groups EntityGroup.EntityGroupConfig repeated Entity groups where the related entity is what is selected (e.g. condition when filtering condition_occurrences).
grouping_entity_groups EntityGroup.EntityGroupConfig repeated Entity groups where the related entity is not what is selected (e.g. brands when filtering ingredients or genotyping platforms when filtering people).
multi_select bool Whether a single click selects a value or multiple values can be selected and then confirmed.
value_configs tanagra.ValueConfig repeated Optional configuration of a categorical or numeric value associated with the selection (e.g. a measurement value). Applied to the entire selection so generally not compatible with multi_select. Currently only one is supported.
default_sort tanagra.SortOrder The sort order to use in the list view, or in hierarchies where no sort order has been specified.
limit int32 optional Number of values to display in the list view for each entity group. Otherwise, a default value is applied.
nameAttribute string optional The attribute used to name selections if not the first column. This can be used to include extra context with the selected values that's not visible in the table view.

EntityGroup.EntityGroupConfig

Multiple entity groups can be shown within the same criteria. Typically they would filter over the same entity, or at least very similar entities, since much of the configuration (e.g. columns) is shared. Both types of configs can be combined though they are displayed separately.

Field Type Label Description
id string The id of the entity group.
sort_order tanagra.SortOrder The sort order applied to this entity group when displayed in the hierarchy view.

Top

criteriaselector/configschema/filterable_group.proto

FilterableGroup

Config for an GroupItems entity group criteria with filterable attributes and the ability to select all items that match a set of attributes.

Field Type Label Description
columns tanagra.Column repeated Columns displayed in the list view.
entityGroup string The GroupItems entity group to be filtered.
value_configs tanagra.ValueConfig repeated Attributes that can be part of a select all.
sort_order tanagra.SortOrder The sort order to use in the list view.
page_size int32 optional Number of values to display on each page in the list view. Otherwise, a default value is applied.
search_configs FilterableGroup.SearchConfig repeated

FilterableGroup.SearchConfig

Each SearchConfig corresponds to a valid search query format and is a regex which are checked in order with the first matching one being used. Each capture group is mapped to a Parameter which will be checked against a specified attribute using a specified operator. If no capture groups are specified, then the entire match is mapped to the first parameter. If there are no configs, a generic text search will be performed across the search fields specified by the entity.

Field Type Label Description
name string The list of names and corresponding examples are shown in a tooltip.
example string
regex string The regular expression to match against.
displayOrder int64 The tooltips are sorted according to displayOrder, which defaults to 0 when unspecified, and falls back on the order specified in the config. This allows the visible order to differ from the matching order.
parameters FilterableGroup.SearchConfig.Parameter repeated

FilterableGroup.SearchConfig.Parameter

Each parameter corresponds to a capture group in the regex, or the entire match if none are specified. At least one parameter must be specified. The order of arguments is <attribute> <operator> <query>.

Field Type Label Description
attribute string The attribute to compare against.
operator FilterableGroup.SearchConfig.Parameter.Operator
case FilterableGroup.SearchConfig.Parameter.Case

FilterableGroup.SearchConfig.Parameter.Case

If specified, the matched string is converted to lower or upper case.

Name Number Description
CASE_NONE 0
CASE_LOWER 1
CASE_UPPER 2

FilterableGroup.SearchConfig.Parameter.Operator

The operator to compare with.

Name Number Description
OPERATOR_UNKNOWN 0
OPERATOR_EQUALS 1
OPERATOR_GREATER_THAN 2
OPERATOR_GREATER_THAN_OR_EQUAL 3
OPERATOR_LESS_THAN 4
OPERATOR_LESS_THAN_OR_EQUAL 5

Top

criteriaselector/configschema/multi_attribute.proto

MultiAttribute

A criteria based on one or more categorical (i.e. an enum) or numeric attribute of an entity. Can be configured to show all attributes or switch between them.

Field Type Label Description
entity string The entity to filter on.
single_value bool Whether the user selects a single attribute to filter on or filters on all of them simultaneously.
value_configs tanagra.ValueConfig repeated Configuration for each filterable attribute.

Top

criteriaselector/configschema/output_unfiltered.proto

OutputUnfiltered

A UI-less criteria intended primarily for prepackaged data features that include entire entities (e.g. demographics).

Field Type Label Description
entities string repeated The entities to include.

Top

criteriaselector/configschema/survey.proto

Survey

Field Type Label Description
columns tanagra.Column repeated Columns displayed in the list view.
entity_groups Survey.EntityGroupConfig repeated Entity groups where the related entity is what is selected (e.g. surveyBasics when filtering surveyOccurrence).
value_configs tanagra.ValueConfig repeated Optional configuration of a categorical or numeric value associated with the selection (e.g. a numeric answer). Applied to the entire selection so generally not compatible with multi_select. Currently only one is supported.
default_sort tanagra.SortOrder The sort order to use in the list view, or in hierarchies where no sort order has been specified.
nameAttribute string optional The attribute used to name selections if not the first column. This can be used to include extra context with the selected values that's not visible in the table view.

Survey.EntityGroupConfig

Field Type Label Description
id string The id of the entity group.
sort_order tanagra.SortOrder The sort order applied to this entity group when displayed in the hierarchy view.

Top

criteriaselector/configschema/text_search.proto

TextSearch

A criteria that allows searching for text across categorized items.

Field Type Label Description
entity string The entity to search.
searchAttribute string optional The attribute to search within. Defaults to the search configuration in the entity definition.
categoryAttribute string optional An optional categorical attribute to additionally filter on.

Top

criteriaselector/configschema/unhinted_value.proto

UnhintedValue

Field Type Label Description
group_by_count bool
attributes UnhintedValue.AttributesEntry repeated

UnhintedValue.AttributeList

Field Type Label Description
values string repeated

UnhintedValue.AttributesEntry

Field Type Label Description
key string
value UnhintedValue.AttributeList

Top

criteriaselector/data_range.proto

DataRange

Field Type Label Description
id string
min double
max double

Top

criteriaselector/dataschema/attribute.proto

Attribute

Data for an attribute criteria is a list of categorical values or ranges.

Field Type Label Description
selected Attribute.Selection repeated
data_ranges tanagra.DataRange repeated Contains one or more numeric ranges when referencing a numeric value (e.g. age).

Attribute.Selection

A single selected categorical value (e.g. {value: 1234, name: "Diabetes"}.

Field Type Label Description
value tanagra.Value The value used to build queries.
name string The visible name for the selection. This is stored to avoid extra lookups when rendering.

Top

criteriaselector/dataschema/biovu.proto

BioVU

Field Type Label Description
sample_filter BioVU.SampleFilter
exclude_compromised bool
exclude_internal bool
plasma bool

BioVU.SampleFilter

Name Number Description
SAMPLE_FILTER_UNKNOWN 0
SAMPLE_FILTER_ANY 1
SAMPLE_FILTER_ONE_HUNDRED 2
SAMPLE_FILTER_FIVE_HUNDRED 3

Top

criteriaselector/dataschema/entity_group.proto

EntityGroup

Data for an entity group criteria is a list of selected values.

Field Type Label Description
selected EntityGroup.Selection repeated
value_data tanagra.ValueData Data for an additional categorical or numeric value associated with the selection (e.g. a measurement value). Deprecated in favor of per-selection value_data.

EntityGroup.Selection

Field Type Label Description
key tanagra.Key The key of the selected value, which references a related entity (e.g. condition for a condition_occurrence).
name string The visible name for the selection. This is stored to avoid extra lookups when rendering.
entityGroup string The entity group is stored to differentiate between them when multiple are configured within a single criteria.
value_data tanagra.ValueData Data for additional categorical or numeric values associated with the selection (e.g. a measurement value).

Top

criteriaselector/dataschema/filterable_group.proto

FilterableGroup

Data for an GroupItems entity group criteria with filterable attributes.

Field Type Label Description
selected FilterableGroup.Selection repeated The list of selections, each of which may be a single item or a set of parameters.

FilterableGroup.SelectAll

Field Type Label Description
query string The string query of the selection.
value_data tanagra.ValueData repeated Optional values that comprise the selection.
exclusions FilterableGroup.SingleSelect repeated Single items excluded from this selection.

FilterableGroup.Selection

Field Type Label Description
id string A unique id to refer to selections since SelectAlls don't naturally have one.
single FilterableGroup.SingleSelect
all FilterableGroup.SelectAll

FilterableGroup.SingleSelect

Field Type Label Description
key tanagra.Key The key of the selected value, which references group entity (e.g. variant when filtering variantPerson).
name string The visible name for the selection. This is stored to avoid extra lookups when rendering.

Top

criteriaselector/dataschema/multi_attribute.proto

MultiAttribute

Data for a multi attribute criteria is a list of categorical or numeric values.

Field Type Label Description
value_data tanagra.ValueData repeated

Top

criteriaselector/dataschema/output_unfiltered.proto

OutputUnfiltered

Field Type Label Description
entities string repeated

Top

criteriaselector/dataschema/survey.proto

Survey

Data for an entity group criteria is a list of selected values.

Field Type Label Description
selected Survey.Selection repeated
value_data tanagra.ValueData Data for an additional categorical or numeric value associated with the selection (e.g. a numeric answer). Temporarily unused in favor of per-selection value_data but will potentially be used in future to support criteria wide values (e.g. survey version or date).

Survey.Selection

Field Type Label Description
key tanagra.Key The key of the selected value, which references a related entity (e.g. surveyBasics when filtering surveyOccurrence).
name string The visible name for the selection. This is stored to avoid extra lookups when rendering.
entityGroup string The entity group is stored to differentiate between them when multiple are configured within a single criteria.
question_key tanagra.Key If the selected item is an answer, the key of the question it belongs to.
question_name string If the selected item is an answer, the visible name of the question it belongs to.
value_data tanagra.ValueData Data for additional categorical or numeric values associated with the selection (e.g. a numeric answer).

Top

criteriaselector/dataschema/text_search.proto

TextSearch

Data for a text search criteria is a list of selected categories and teh text to search for.

Field Type Label Description
categories TextSearch.Selection repeated
query string The text to search for.

TextSearch.Selection

A single selected category (e.g. {value: 1234, name: "Intake form"}.

Field Type Label Description
value tanagra.Value The value used to build queries.
name string The visible name for the selection. This is stored to avoid extra lookups when rendering.

Top

criteriaselector/dataschema/unhinted_value.proto

UnhintedValue

Field Type Label Description
operator UnhintedValue.ComparisonOperator
min double
max double

UnhintedValue.ComparisonOperator

Name Number Description
COMPARISON_OPERATOR_UNKNOWN 0
COMPARISON_OPERATOR_EQUAL 1
COMPARISON_OPERATOR_BETWEEN 2
COMPARISON_OPERATOR_LESS_THAN_EQUAL 3
COMPARISON_OPERATOR_GREATER_THAN_EQUAL 4

Top

criteriaselector/key.proto

Key

Field Type Label Description
string_key string
int64_key int64

Top

criteriaselector/value_config.proto

ValueConfig

Configuration for a value that can be selected.

Field Type Label Description
attribute string The attribute of interest.
title string The visble title to show for this value.
unit string optional An optional unit to show for this value.

Top

criteriaselector/value_data.proto

ValueData

Configuration for a value that has been selected.

Field Type Label Description
attribute string The attribute that was selected.
numeric bool Whether this is a numeric or categorical value. Stored to avoid extra lookups when rendering.
selected ValueData.Selection repeated
range DataRange The selected numeric range when referencing a numeric value (e.g. age).

ValueData.Selection

A single selected categorical value (e.g. {value: 1234, name: "Diabetes"}.

Field Type Label Description
value Value The value used to build queries.
name string The visible name for the selection. This is stored to avoid extra lookups when rendering.

Top

sort_order.proto

SortOrder

Field Type Label Description
attribute string
direction SortOrder.Direction

SortOrder.Direction

Name Number Description
SORT_ORDER_DIRECTION_UNKNOWN 0
SORT_ORDER_DIRECTION_ASCENDING 1
SORT_ORDER_DIRECTION_DESCENDING 2

Top

value.proto

Value

Field Type Label Description
string_value string
int64_value int64
bool_value bool
timestamp_value google.protobuf.Timestamp

Top

viz/viz_config.proto

VizConfig

The configuration of a underlay or cohort level visualization.

Field Type Label Description
sources VizConfig.Source repeated The visualization must have one or two sources of data to display.

VizConfig.Source

Field Type Label Description
criteriaSelector string The criteria selector (e.g. condition) determines which entities the data is being pulled from.
selectionData string optional Configuration of the specified criteria selection (e.g. to select conditions under diabetes).
entity string optional For criteria selectors that return more than one entity.
joins VizConfig.Source.Join repeated To visualize data from different entities, the data must be joined to a common entity. Each source must specify a series of joins that ends up at the same entity if it does not already come from that entity.
attributes VizConfig.Source.Attribute repeated Which attributes should be returned from the selected data source (e.g. condition_name from condition_occurrence or age from person).

VizConfig.Source.Attribute

Field Type Label Description
attribute string The attribute to read.
numeric_bucketing VizConfig.Source.Attribute.NumericBucketing
sort_type VizConfig.Source.Attribute.SortType optional How to sort this attribute for display. Defaults to NAME.
sort_descending bool optional Whether to sort in descending order.
limit int64 optional Whether a limited amount of data should be returned (e.g. 10 most common conditions).

VizConfig.Source.Attribute.NumericBucketing

Converts a continuous numeric range into ids with count as the value.

Field Type Label Description
thresholds double repeated Buckets can be specified as either a list of thresholds or a range and number of buckets. For thresholds [18, 45, 65], results in two buckets [18, 45), and [45, 65). Lesser and greater buckets can be added if desired.
intervals VizConfig.Source.Attribute.NumericBucketing.Intervals optional
includeLesser bool optional Whether to create buckets for values outside of the explicitly specified ones or ignore them.
includeGreater bool optional

VizConfig.Source.Attribute.NumericBucketing.Intervals

For intervals {min:1, max:5, count: 2}, creates two buckets [1, 3) and [3, 5).

Field Type Label Description
min double
max double
count int64

VizConfig.Source.Join

Field Type Label Description
entity string The next entity to join to in order to eventually get to the entity the visualization is displaying (e.g. person when joining condition_occurences to age).
aggregation VizConfig.Source.Join.Aggregation optional When joining an entity with an N:1 relationship (e.g. multiple weight values to a person), an aggregation is often required to make the data visualizable. For example, to visualize weight vs. race, each person needs to have a single weight value associated with them, such as the average or most recent. For simple cases, simply counting unique instances of a related entity may be sufficient (e.g. to count people with related condition occurrences).

VizConfig.Source.Join.Aggregation

Field Type Label Description
type VizConfig.Source.Join.Aggregation.AggregationType optional The type of aggregation being performed.
attribute string optional The output is always ids and values but aggregation may occur over another field (e.g. date to find the most recent value).

VizConfig.Source.Attribute.SortType

Name Number Description
UNKNOWN 0
NAME 1
VALUE 2

VizConfig.Source.Join.Aggregation.AggregationType

Name Number Description
UNIQUE 0
MIN 1
MAX 2
AVERAGE 3

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)