diff --git a/docs/generated/PROTOCOL_BUFFERS.md b/docs/generated/PROTOCOL_BUFFERS.md index ae0fbb114..669c09c2c 100644 --- a/docs/generated/PROTOCOL_BUFFERS.md +++ b/docs/generated/PROTOCOL_BUFFERS.md @@ -101,17 +101,17 @@ - [value.proto](#value-proto) - [Value](#tanagra-Value) -- [viz/viz_config.proto](#viz_viz_config-proto) - - [VizConfig](#tanagra-viz-VizConfig) - - [VizConfig.Source](#tanagra-viz-VizConfig-Source) - - [VizConfig.Source.Attribute](#tanagra-viz-VizConfig-Source-Attribute) - - [VizConfig.Source.Attribute.NumericBucketing](#tanagra-viz-VizConfig-Source-Attribute-NumericBucketing) - - [VizConfig.Source.Attribute.NumericBucketing.Intervals](#tanagra-viz-VizConfig-Source-Attribute-NumericBucketing-Intervals) - - [VizConfig.Source.Join](#tanagra-viz-VizConfig-Source-Join) - - [VizConfig.Source.Join.Aggregation](#tanagra-viz-VizConfig-Source-Join-Aggregation) +- [viz/viz_data_config.proto](#viz_viz_data_config-proto) + - [VizDataConfig](#tanagra-viz-VizDataConfig) + - [VizDataConfig.Source](#tanagra-viz-VizDataConfig-Source) + - [VizDataConfig.Source.Attribute](#tanagra-viz-VizDataConfig-Source-Attribute) + - [VizDataConfig.Source.Attribute.NumericBucketing](#tanagra-viz-VizDataConfig-Source-Attribute-NumericBucketing) + - [VizDataConfig.Source.Attribute.NumericBucketing.Intervals](#tanagra-viz-VizDataConfig-Source-Attribute-NumericBucketing-Intervals) + - [VizDataConfig.Source.Join](#tanagra-viz-VizDataConfig-Source-Join) + - [VizDataConfig.Source.Join.Aggregation](#tanagra-viz-VizDataConfig-Source-Join-Aggregation) - - [VizConfig.Source.Attribute.SortType](#tanagra-viz-VizConfig-Source-Attribute-SortType) - - [VizConfig.Source.Join.Aggregation.AggregationType](#tanagra-viz-VizConfig-Source-Join-Aggregation-AggregationType) + - [VizDataConfig.Source.Attribute.SortType](#tanagra-viz-VizDataConfig-Source-Attribute-SortType) + - [VizDataConfig.Source.Join.Aggregation.AggregationType](#tanagra-viz-VizDataConfig-Source-Join-Aggregation-AggregationType) - [Scalar Value Types](#scalar-value-types) @@ -1270,31 +1270,31 @@ A single selected categorical value (e.g. {value: 1234, name: "Diabetes" - +

Top

-## viz/viz_config.proto +## viz/viz_data_config.proto - + -### VizConfig +### VizDataConfig The configuration of a underlay or cohort level visualization. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sources | [VizConfig.Source](#tanagra-viz-VizConfig-Source) | repeated | The visualization must have one or two sources of data to display. | +| sources | [VizDataConfig.Source](#tanagra-viz-VizDataConfig-Source) | repeated | The visualization must have one or two sources of data to display. | - + -### VizConfig.Source +### VizDataConfig.Source @@ -1303,25 +1303,25 @@ The configuration of a underlay or cohort level visualization. | criteriaSelector | [string](#string) | | The criteria selector (e.g. condition) determines which entities the data is being pulled from. | | selectionData | [string](#string) | optional | Configuration of the specified criteria selection (e.g. to select conditions under diabetes). | | entity | [string](#string) | optional | For criteria selectors that return more than one entity. | -| joins | [VizConfig.Source.Join](#tanagra-viz-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](#tanagra-viz-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). | +| joins | [VizDataConfig.Source.Join](#tanagra-viz-VizDataConfig-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 | [VizDataConfig.Source.Attribute](#tanagra-viz-VizDataConfig-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 +### VizDataConfig.Source.Attribute | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | attribute | [string](#string) | | The attribute to read. | -| numeric_bucketing | [VizConfig.Source.Attribute.NumericBucketing](#tanagra-viz-VizConfig-Source-Attribute-NumericBucketing) | | | -| sort_type | [VizConfig.Source.Attribute.SortType](#tanagra-viz-VizConfig-Source-Attribute-SortType) | optional | How to sort this attribute for display. Defaults to NAME. | +| numeric_bucketing | [VizDataConfig.Source.Attribute.NumericBucketing](#tanagra-viz-VizDataConfig-Source-Attribute-NumericBucketing) | | | +| sort_type | [VizDataConfig.Source.Attribute.SortType](#tanagra-viz-VizDataConfig-Source-Attribute-SortType) | optional | How to sort this attribute for display. Defaults to NAME. | | sort_descending | [bool](#bool) | optional | Whether to sort in descending order. | | limit | [int64](#int64) | optional | Whether a limited amount of data should be returned (e.g. 10 most common conditions). | @@ -1330,16 +1330,16 @@ The configuration of a underlay or cohort level visualization. - + -### VizConfig.Source.Attribute.NumericBucketing +### VizDataConfig.Source.Attribute.NumericBucketing Converts a continuous numeric range into ids with count as the value. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | thresholds | [double](#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](#tanagra-viz-VizConfig-Source-Attribute-NumericBucketing-Intervals) | optional | | +| intervals | [VizDataConfig.Source.Attribute.NumericBucketing.Intervals](#tanagra-viz-VizDataConfig-Source-Attribute-NumericBucketing-Intervals) | optional | | | includeLesser | [bool](#bool) | optional | Whether to create buckets for values outside of the explicitly specified ones or ignore them. | | includeGreater | [bool](#bool) | optional | | @@ -1348,9 +1348,9 @@ Converts a continuous numeric range into ids with count as the value. - + -### VizConfig.Source.Attribute.NumericBucketing.Intervals +### VizDataConfig.Source.Attribute.NumericBucketing.Intervals For intervals {min:1, max:5, count: 2}, creates two buckets [1, 3) and [3, 5). @@ -1366,31 +1366,31 @@ and [3, 5). - + -### VizConfig.Source.Join +### VizDataConfig.Source.Join | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | entity | [string](#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](#tanagra-viz-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). | +| aggregation | [VizDataConfig.Source.Join.Aggregation](#tanagra-viz-VizDataConfig-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 +### VizDataConfig.Source.Join.Aggregation | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| type | [VizConfig.Source.Join.Aggregation.AggregationType](#tanagra-viz-VizConfig-Source-Join-Aggregation-AggregationType) | optional | The type of aggregation being performed. | +| type | [VizDataConfig.Source.Join.Aggregation.AggregationType](#tanagra-viz-VizDataConfig-Source-Join-Aggregation-AggregationType) | optional | The type of aggregation being performed. | | attribute | [string](#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). | @@ -1400,9 +1400,9 @@ and [3, 5). - + -### VizConfig.Source.Attribute.SortType +### VizDataConfig.Source.Attribute.SortType | Name | Number | Description | @@ -1413,9 +1413,9 @@ and [3, 5). - + -### VizConfig.Source.Join.Aggregation.AggregationType +### VizDataConfig.Source.Join.Aggregation.AggregationType | Name | Number | Description | diff --git a/docs/generated/UNDERLAY_CONFIG.md b/docs/generated/UNDERLAY_CONFIG.md index 21765749b..4d9f85d9a 100644 --- a/docs/generated/UNDERLAY_CONFIG.md +++ b/docs/generated/UNDERLAY_CONFIG.md @@ -1328,7 +1328,7 @@ Configuration for a single visualization. ### SZVisualization.dataConfig **required** String -Serialized configuration of the visualization. VizConfig protocol buffer as JSON. +Serialized configuration of the visualization. VizDataConfig protocol buffer as JSON. ### SZVisualization.dataConfigFile **required** String diff --git a/ui/src/tanagra-underlay/underlayConfig.ts b/ui/src/tanagra-underlay/underlayConfig.ts index 15c13043d..de4c87747 100644 --- a/ui/src/tanagra-underlay/underlayConfig.ts +++ b/ui/src/tanagra-underlay/underlayConfig.ts @@ -37,7 +37,7 @@ export enum SZCorePlugin { SURVEY = "SURVEY", TEXT_SEARCH = "TEXT_SEARCH", UNHINTED_VALUE = "UNHINTED_VALUE", -}; +} export type SZCriteriaOccurrence = { criteriaEntity: string; @@ -88,7 +88,7 @@ export enum SZDataType { INT64 = "INT64", STRING = "STRING", TIMESTAMP = "TIMESTAMP", -}; +} export type SZDataflow = { dataflowLocation: string; diff --git a/ui/src/viz/viz.ts b/ui/src/viz/viz.ts index 657b193c8..5fb0932e9 100644 --- a/ui/src/viz/viz.ts +++ b/ui/src/viz/viz.ts @@ -1,7 +1,7 @@ import { VALUE_SUFFIX } from "data/configuration"; import { FilterCountValue } from "data/source"; import { compareDataValues } from "data/types"; -import * as vizProto from "proto/viz/viz_config"; +import * as vizProto from "proto/viz/viz_data_config"; import { useMemo } from "react"; import { isValid } from "util/valid"; @@ -48,10 +48,10 @@ export type VizDataFormat = { }; export function processFilterCountValues( - vizConfig: vizProto.VizConfig, + vizDataConfig: vizProto.VizDataConfig, fcvs: FilterCountValue[] ): VizData[] { - const vizSource = vizConfig.sources[0]; + const vizSource = vizDataConfig.sources[0]; const dataMap = new Map(); fcvs.forEach((d) => { @@ -149,11 +149,13 @@ export function processFilterCountValues( if (!attrib.numericBucketing) { if ( !attrib.sortType || - attrib.sortType === vizProto.VizConfig_Source_Attribute_SortType.NAME + attrib.sortType === + vizProto.VizDataConfig_Source_Attribute_SortType.NAME ) { sortValue = compareDataValues(a.keys[i].name, b.keys[i].name); } else if ( - attrib.sortType === vizProto.VizConfig_Source_Attribute_SortType.VALUE + attrib.sortType === + vizProto.VizDataConfig_Source_Attribute_SortType.VALUE ) { sortValue = compareDataValues( a.values[i].numeric, diff --git a/ui/src/viz/vizContainer.tsx b/ui/src/viz/vizContainer.tsx index 4723dba62..f04e68422 100644 --- a/ui/src/viz/vizContainer.tsx +++ b/ui/src/viz/vizContainer.tsx @@ -11,7 +11,7 @@ import { useCohort, useStudyId } from "hooks"; import emptyImage from "images/empty.svg"; import { GridBox, GridBoxPaper } from "layout/gridBox"; import GridLayout from "layout/gridLayout"; -import * as configProto from "proto/viz/viz_config"; +import * as configProto from "proto/viz/viz_data_config"; import { useMemo, useState } from "react"; import useSWRImmutable from "swr/immutable"; import { getVizPlugin, processFilterCountValues, VizData } from "viz/viz"; @@ -24,7 +24,7 @@ type UnparsedConfig = { }; type ParsedConfig = { - dataConfig: configProto.VizConfig; + dataConfig: configProto.VizDataConfig; plugin: string; pluginConfig: object; title: string; @@ -45,7 +45,7 @@ export function VizContainer(props: VizContainerProps) { const config = useMemo( (): ParsedConfig => ({ ...props.config, - dataConfig: configProto.VizConfig.fromJSON( + dataConfig: configProto.VizDataConfig.fromJSON( JSON.parse(props.config.dataConfig) ), pluginConfig: JSON.parse(props.config.pluginConfig ?? "{}"), @@ -134,16 +134,16 @@ const selectorToEntity: { [key: string]: string } = { measurements: "measurementOccurrence", }; async function fetchVizData( - vizConfig: configProto.VizConfig, + vizDataConfig: configProto.VizDataConfig, studySource: StudySource, studyId: string, cohort: Cohort ): Promise { - const vizSource = vizConfig.sources[0]; + const vizSource = vizDataConfig.sources[0]; // TODO(tjennison): Remove these limitations once the backend sufficiently // supports the query generation. - if (!vizSource || vizConfig.sources.length > 1) { + if (!vizSource || vizDataConfig.sources.length > 1) { throw new Error("Only 1 visualization source is supported."); } const entity = selectorToEntity[vizSource.criteriaSelector]; @@ -165,5 +165,5 @@ async function fetchVizData( countDistinctAttribute: vizSource.joins?.length ? "person_id" : undefined, }); - return processFilterCountValues(vizConfig, fcvs); + return processFilterCountValues(vizDataConfig, fcvs); } diff --git a/underlay/src/main/java/bio/terra/tanagra/underlay/serialization/SZVisualization.java b/underlay/src/main/java/bio/terra/tanagra/underlay/serialization/SZVisualization.java index 1d9e0dbf0..3b9c653e0 100644 --- a/underlay/src/main/java/bio/terra/tanagra/underlay/serialization/SZVisualization.java +++ b/underlay/src/main/java/bio/terra/tanagra/underlay/serialization/SZVisualization.java @@ -20,7 +20,7 @@ public class SZVisualization { @AnnotatedField( name = "SZVisualization.dataConfig", markdown = - "Serialized configuration of the visualization. VizConfig protocol buffer as JSON.") + "Serialized configuration of the visualization. VizDataConfig protocol buffer as JSON.") public String dataConfig; @AnnotatedField( diff --git a/underlay/src/main/proto/viz/viz_config.proto b/underlay/src/main/proto/viz/viz_data_config.proto similarity index 99% rename from underlay/src/main/proto/viz/viz_config.proto rename to underlay/src/main/proto/viz/viz_data_config.proto index f7a2ddc23..999517d41 100644 --- a/underlay/src/main/proto/viz/viz_config.proto +++ b/underlay/src/main/proto/viz/viz_data_config.proto @@ -6,7 +6,7 @@ option java_package = "bio.terra.tanagra.proto.viz"; option java_outer_classname = "Viz"; // The configuration of a underlay or cohort level visualization. -message VizConfig { +message VizDataConfig { message Source { // The criteria selector (e.g. condition) determines which entities the data // is being pulled from.