@databiosphere/findable-ui 28.0.0 → 29.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/lib/common/entities.d.ts +27 -7
  4. package/lib/components/DataDictionary/common/utils.js +4 -4
  5. package/lib/components/DataDictionary/components/Entities/entities.js +1 -1
  6. package/lib/components/DataDictionary/components/Entities/types.d.ts +2 -2
  7. package/lib/components/DataDictionary/components/Entity/entity.js +3 -3
  8. package/lib/components/DataDictionary/components/Entity/types.d.ts +2 -2
  9. package/lib/components/DataDictionary/components/Outline/utils.js +3 -3
  10. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +2 -2
  11. package/lib/components/DataDictionary/components/Table/hook.d.ts +2 -2
  12. package/lib/components/DataDictionary/hooks/UseDataDictionary/types.d.ts +2 -2
  13. package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.js +1 -0
  14. package/package.json +1 -1
  15. package/src/common/entities.ts +29 -8
  16. package/src/components/DataDictionary/common/utils.ts +4 -4
  17. package/src/components/DataDictionary/components/Entities/entities.tsx +1 -1
  18. package/src/components/DataDictionary/components/Entities/types.ts +6 -2
  19. package/src/components/DataDictionary/components/Entity/entity.tsx +2 -2
  20. package/src/components/DataDictionary/components/Entity/types.ts +6 -2
  21. package/src/components/DataDictionary/components/Outline/utils.ts +3 -3
  22. package/src/components/DataDictionary/components/Table/components/BasicCell/types.ts +5 -2
  23. package/src/components/DataDictionary/components/Table/hook.ts +2 -2
  24. package/src/components/DataDictionary/hooks/UseDataDictionary/types.ts +6 -2
  25. package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.ts +1 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "28.0.0"
2
+ ".": "29.0.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [29.0.0](https://github.com/DataBiosphere/findable-ui/compare/v28.0.1...v29.0.0) (2025-05-06)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * updated data dictionary model #423 ([#454](https://github.com/DataBiosphere/findable-ui/issues/454))
9
+
10
+ ### Features
11
+
12
+ * updated data dictionary model [#423](https://github.com/DataBiosphere/findable-ui/issues/423) ([#454](https://github.com/DataBiosphere/findable-ui/issues/454)) ([729da9e](https://github.com/DataBiosphere/findable-ui/commit/729da9e569addd680c2b160973f47630441d613c))
13
+
14
+ ## [28.0.1](https://github.com/DataBiosphere/findable-ui/compare/v28.0.0...v28.0.1) (2025-04-30)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * fix observable plot y-scale warning caused by numeric strings ([#449](https://github.com/DataBiosphere/findable-ui/issues/449)) ([#450](https://github.com/DataBiosphere/findable-ui/issues/450)) ([53df97a](https://github.com/DataBiosphere/findable-ui/commit/53df97a8508c822aef48aac4c71646cfddc0b605))
20
+
3
21
  ## [28.0.0](https://github.com/DataBiosphere/findable-ui/compare/v27.0.0...v28.0.0) (2025-04-30)
4
22
 
5
23
 
@@ -3,14 +3,23 @@ import { ColumnDef } from "@tanstack/react-table";
3
3
  * Model of a value of a metadata class.
4
4
  */
5
5
  export interface Attribute {
6
+ annotations?: {
7
+ [key in keyof DataDictionaryPrefix]: string;
8
+ };
6
9
  description: string;
7
- key: string;
8
- label: string;
10
+ example?: string;
11
+ multivalued: boolean;
12
+ name: string;
13
+ range: string;
14
+ rationale?: string;
15
+ required: boolean;
16
+ title: string;
17
+ values?: string;
9
18
  }
10
19
  /**
11
- * Model of attribute keys; used mostly when building data dictionary column definitions.
20
+ * Model of attribute key types; used mostly when building data dictionary column definitions.
12
21
  */
13
- export type AttributeValue = Attribute[keyof Attribute];
22
+ export type AttributeValueTypes = string | boolean;
14
23
  /**
15
24
  * Filterable metadata keys.
16
25
  */
@@ -29,19 +38,30 @@ export interface CategoryTag {
29
38
  export interface Class {
30
39
  attributes: Attribute[];
31
40
  description: string;
32
- key: string;
33
- label: string;
34
41
  name: string;
42
+ title: string;
35
43
  }
36
44
  /**
37
45
  * Category values to be used as keys. For example, "Homo sapiens" or "10X 3' v2 sequencing".
38
46
  */
39
47
  export type CategoryValueKey = unknown;
48
+ /**
49
+ * Key value pair where the key is an identifier for a schema and the value is
50
+ * a URL to the schema definition.
51
+ */
52
+ export type DataDictionaryPrefix = Record<string, string>;
40
53
  /**
41
54
  * Model of a metadata dictionary containing a set of classes and their definitions.
42
55
  */
43
56
  export interface DataDictionary {
57
+ annotations: {
58
+ [key in keyof DataDictionaryPrefix]: string;
59
+ };
44
60
  classes: Class[];
61
+ description: string;
62
+ name: string;
63
+ prefixes: DataDictionaryPrefix;
64
+ title: string;
45
65
  }
46
66
  /**
47
67
  * Display model of a data dictionary column.
@@ -59,7 +79,7 @@ export interface DataDictionaryColumnDef {
59
79
  * dictionary) as well as column def for displaying the data dictionary.
60
80
  */
61
81
  export interface DataDictionaryConfig {
62
- columnDefs: ColumnDef<Attribute, Attribute[keyof Attribute]>[];
82
+ columnDefs: ColumnDef<Attribute>[];
63
83
  dataDictionary: DataDictionary;
64
84
  }
65
85
  /**
@@ -108,15 +108,15 @@ function annotateCategoryGroupConfig(categoryGroupConfig, annotationsByKey) {
108
108
  function keyAnnotationsByKey(dataDictionary) {
109
109
  return dataDictionary.classes.reduce((acc, cls) => {
110
110
  // Add class to map.
111
- acc[cls.key] = {
111
+ acc[cls.name] = {
112
112
  description: cls.description,
113
- label: cls.label,
113
+ label: cls.title,
114
114
  };
115
115
  // Add each class attribute to the map.
116
116
  cls.attributes.forEach((attribute) => {
117
- acc[attribute.key] = {
117
+ acc[attribute.name] = {
118
118
  description: attribute.description,
119
- label: attribute.label,
119
+ label: attribute.title,
120
120
  };
121
121
  });
122
122
  return acc;
@@ -3,5 +3,5 @@ import React from "react";
3
3
  import { Entity } from "../Entity/entity";
4
4
  import { GRID_PROPS } from "./constants";
5
5
  export const Entities = ({ classes, columnDefs, spacing, }) => {
6
- return (React.createElement(Grid, { ...GRID_PROPS }, classes.map((classData) => (React.createElement(Entity, { key: classData.key, class: classData, columnDefs: columnDefs, spacing: spacing })))));
6
+ return (React.createElement(Grid, { ...GRID_PROPS }, classes.map((classData) => (React.createElement(Entity, { key: classData.name, class: classData, columnDefs: columnDefs, spacing: spacing })))));
7
7
  };
@@ -1,8 +1,8 @@
1
1
  import { ColumnDef } from "@tanstack/react-table";
2
- import { Attribute, AttributeValue, Class } from "../../../../common/entities";
2
+ import { Attribute, AttributeValueTypes, Class } from "../../../../common/entities";
3
3
  import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
4
4
  export interface ClassesProps {
5
5
  classes: Class[];
6
- columnDefs: ColumnDef<Attribute, AttributeValue>[];
6
+ columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
7
7
  spacing?: LayoutSpacing;
8
8
  }
@@ -10,10 +10,10 @@ export const Entity = ({ class: classData, columnDefs, spacing, }) => {
10
10
  const table = useTable(classData.attributes, columnDefs);
11
11
  return (React.createElement(Grid, { ...GRID_PROPS, rowGap: 4 },
12
12
  React.createElement(Grid, { ...GRID_PROPS, rowGap: 1 },
13
- React.createElement(StyledTypography, { component: "h3", id: classData.key, variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_HEADING_SMALL, ...spacing },
14
- classData.label,
13
+ React.createElement(StyledTypography, { component: "h3", id: classData.name, variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_HEADING_SMALL, ...spacing },
14
+ classData.title,
15
15
  " ",
16
- React.createElement(AnchorLink, { anchorLink: classData.key })),
16
+ React.createElement(AnchorLink, { anchorLink: classData.name })),
17
17
  React.createElement(Typography, { color: TYPOGRAPHY_PROPS.COLOR.INK_LIGHT, component: "div", variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_400_2_LINES }, classData.description)),
18
18
  React.createElement(Table, { table: table })));
19
19
  };
@@ -1,8 +1,8 @@
1
1
  import { ColumnDef } from "@tanstack/react-table";
2
- import { Attribute, AttributeValue, Class } from "../../../../common/entities";
2
+ import { Attribute, AttributeValueTypes, Class } from "../../../../common/entities";
3
3
  import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
4
4
  export interface EntityProps {
5
5
  class: Class;
6
- columnDefs: ColumnDef<Attribute, AttributeValue>[];
6
+ columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
7
7
  spacing?: LayoutSpacing;
8
8
  }
@@ -4,12 +4,12 @@
4
4
  * @returns Outline items.
5
5
  */
6
6
  export function buildClassesOutline(classes) {
7
- return classes.map(({ key, name }) => {
7
+ return classes.map(({ name, title }) => {
8
8
  return {
9
9
  depth: 2,
10
10
  disabled: false,
11
- hash: key,
12
- value: name,
11
+ hash: name,
12
+ value: title,
13
13
  };
14
14
  });
15
15
  }
@@ -1,3 +1,3 @@
1
1
  import { CellContext } from "@tanstack/react-table";
2
- import { Attribute, AttributeValue } from "../../../../../../common/entities";
3
- export type BasicCellProps = CellContext<Attribute, AttributeValue>;
2
+ import { Attribute, AttributeValueTypes } from "../../../../../../common/entities";
3
+ export type BasicCellProps = CellContext<Attribute, AttributeValueTypes>;
@@ -1,3 +1,3 @@
1
1
  import { ColumnDef, Table } from "@tanstack/react-table";
2
- import { Attribute } from "../../../../common/entities";
3
- export declare const useTable: (data: Attribute[], columnDefs: ColumnDef<Attribute, Attribute[keyof Attribute]>[]) => Table<Attribute>;
2
+ import { Attribute, AttributeValueTypes } from "../../../../common/entities";
3
+ export declare const useTable: (data: Attribute[], columnDefs: ColumnDef<Attribute, AttributeValueTypes>[]) => Table<Attribute>;
@@ -1,6 +1,6 @@
1
1
  import { ColumnDef } from "@tanstack/react-table";
2
- import { Attribute, AttributeValue, Class } from "../../../../common/entities";
2
+ import { Attribute, AttributeValueTypes, Class } from "../../../../common/entities";
3
3
  export interface UseDataDictionary {
4
4
  classes: Class[];
5
- columnDefs: ColumnDef<Attribute, AttributeValue>[];
5
+ columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
6
6
  }
@@ -85,6 +85,7 @@ export function getPlotOptions(selectCategoryValueViews, width) {
85
85
  paddingOuter: getYPaddingOuter(),
86
86
  tickFormat: () => "",
87
87
  tickSize: 0,
88
+ type: "band", // Treats number-like strings as categorical labels to prevent numeric scale warnings.
88
89
  },
89
90
  };
90
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "28.0.0",
3
+ "version": "29.0.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -4,15 +4,24 @@ import { ColumnDef } from "@tanstack/react-table";
4
4
  * Model of a value of a metadata class.
5
5
  */
6
6
  export interface Attribute {
7
+ annotations?: {
8
+ [key in keyof DataDictionaryPrefix]: string; // Prefix to fragment mapping, e.g. cxg: "batch_condition".
9
+ };
7
10
  description: string;
8
- key: string;
9
- label: string;
11
+ example?: string; // Free text example of attribute
12
+ multivalued: boolean; // True if attribute can have multiple values
13
+ name: string; // Programmatic slot name or key (e.g. batch_condition, biosamples.anatomical_site)
14
+ range: string; // Type of attribute value e.g. "string"
15
+ rationale?: string; // Free text rationale for attribute
16
+ required: boolean;
17
+ title: string; // Display name
18
+ values?: string; // Free text description of attribute values
10
19
  }
11
20
 
12
21
  /**
13
- * Model of attribute keys; used mostly when building data dictionary column definitions.
22
+ * Model of attribute key types; used mostly when building data dictionary column definitions.
14
23
  */
15
- export type AttributeValue = Attribute[keyof Attribute];
24
+ export type AttributeValueTypes = string | boolean;
16
25
 
17
26
  /**
18
27
  * Filterable metadata keys.
@@ -34,9 +43,8 @@ export interface CategoryTag {
34
43
  export interface Class {
35
44
  attributes: Attribute[];
36
45
  description: string;
37
- key: string;
38
- label: string;
39
- name: string;
46
+ name: string; // Programmatic name or key (e.g. cell, sample)
47
+ title: string; // Display name
40
48
  }
41
49
 
42
50
  /**
@@ -44,11 +52,24 @@ export interface Class {
44
52
  */
45
53
  export type CategoryValueKey = unknown;
46
54
 
55
+ /**
56
+ * Key value pair where the key is an identifier for a schema and the value is
57
+ * a URL to the schema definition.
58
+ */
59
+ export type DataDictionaryPrefix = Record<string, string>;
60
+
47
61
  /**
48
62
  * Model of a metadata dictionary containing a set of classes and their definitions.
49
63
  */
50
64
  export interface DataDictionary {
65
+ annotations: {
66
+ [key in keyof DataDictionaryPrefix]: string; // Prefix to title e.g. "cxg": "CELLxGENE"
67
+ };
51
68
  classes: Class[];
69
+ description: string; // Free text description of data dictionary
70
+ name: string; // Programmatic name or key (e.g. tier1, hca)
71
+ prefixes: DataDictionaryPrefix;
72
+ title: string; // Display name
52
73
  }
53
74
 
54
75
  /**
@@ -69,7 +90,7 @@ export interface DataDictionaryColumnDef {
69
90
  * dictionary) as well as column def for displaying the data dictionary.
70
91
  */
71
92
  export interface DataDictionaryConfig {
72
- columnDefs: ColumnDef<Attribute, Attribute[keyof Attribute]>[];
93
+ columnDefs: ColumnDef<Attribute>[];
73
94
  dataDictionary: DataDictionary;
74
95
  }
75
96
 
@@ -145,16 +145,16 @@ function keyAnnotationsByKey(
145
145
  return dataDictionary.classes.reduce(
146
146
  (acc: Record<string, DataDictionaryAnnotation>, cls: Class) => {
147
147
  // Add class to map.
148
- acc[cls.key] = {
148
+ acc[cls.name] = {
149
149
  description: cls.description,
150
- label: cls.label,
150
+ label: cls.title,
151
151
  };
152
152
 
153
153
  // Add each class attribute to the map.
154
154
  cls.attributes.forEach((attribute: Attribute) => {
155
- acc[attribute.key] = {
155
+ acc[attribute.name] = {
156
156
  description: attribute.description,
157
- label: attribute.label,
157
+ label: attribute.title,
158
158
  };
159
159
  });
160
160
  return acc;
@@ -13,7 +13,7 @@ export const Entities = ({
13
13
  <Grid {...GRID_PROPS}>
14
14
  {classes.map((classData) => (
15
15
  <Entity
16
- key={classData.key}
16
+ key={classData.name}
17
17
  class={classData}
18
18
  columnDefs={columnDefs}
19
19
  spacing={spacing}
@@ -1,9 +1,13 @@
1
1
  import { ColumnDef } from "@tanstack/react-table";
2
- import { Attribute, AttributeValue, Class } from "../../../../common/entities";
2
+ import {
3
+ Attribute,
4
+ AttributeValueTypes,
5
+ Class,
6
+ } from "../../../../common/entities";
3
7
  import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
4
8
 
5
9
  export interface ClassesProps {
6
10
  classes: Class[];
7
- columnDefs: ColumnDef<Attribute, AttributeValue>[];
11
+ columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
8
12
  spacing?: LayoutSpacing;
9
13
  }
@@ -19,11 +19,11 @@ export const Entity = ({
19
19
  <Grid {...GRID_PROPS} rowGap={1}>
20
20
  <StyledTypography
21
21
  component="h3"
22
- id={classData.key}
22
+ id={classData.name}
23
23
  variant={TYPOGRAPHY_PROPS.VARIANT.TEXT_HEADING_SMALL}
24
24
  {...spacing}
25
25
  >
26
- {classData.label} <AnchorLink anchorLink={classData.key} />
26
+ {classData.title} <AnchorLink anchorLink={classData.name} />
27
27
  </StyledTypography>
28
28
  <Typography
29
29
  color={TYPOGRAPHY_PROPS.COLOR.INK_LIGHT}
@@ -1,9 +1,13 @@
1
1
  import { ColumnDef } from "@tanstack/react-table";
2
- import { Attribute, AttributeValue, Class } from "../../../../common/entities";
2
+ import {
3
+ Attribute,
4
+ AttributeValueTypes,
5
+ Class,
6
+ } from "../../../../common/entities";
3
7
  import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
4
8
 
5
9
  export interface EntityProps {
6
10
  class: Class;
7
- columnDefs: ColumnDef<Attribute, AttributeValue>[];
11
+ columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
8
12
  spacing?: LayoutSpacing;
9
13
  }
@@ -7,12 +7,12 @@ import { OutlineItem } from "../../../Layout/components/Outline/types";
7
7
  * @returns Outline items.
8
8
  */
9
9
  export function buildClassesOutline(classes: Class[]): OutlineItem[] {
10
- return classes.map(({ key, name }) => {
10
+ return classes.map(({ name, title }) => {
11
11
  return {
12
12
  depth: 2,
13
13
  disabled: false,
14
- hash: key,
15
- value: name,
14
+ hash: name,
15
+ value: title,
16
16
  };
17
17
  });
18
18
  }
@@ -1,4 +1,7 @@
1
1
  import { CellContext } from "@tanstack/react-table";
2
- import { Attribute, AttributeValue } from "../../../../../../common/entities";
2
+ import {
3
+ Attribute,
4
+ AttributeValueTypes,
5
+ } from "../../../../../../common/entities";
3
6
 
4
- export type BasicCellProps = CellContext<Attribute, AttributeValue>;
7
+ export type BasicCellProps = CellContext<Attribute, AttributeValueTypes>;
@@ -1,10 +1,10 @@
1
1
  import { ColumnDef, Table, useReactTable } from "@tanstack/react-table";
2
- import { Attribute } from "../../../../common/entities";
2
+ import { Attribute, AttributeValueTypes } from "../../../../common/entities";
3
3
  import { useTableOptions } from "./options/hook";
4
4
 
5
5
  export const useTable = (
6
6
  data: Attribute[],
7
- columnDefs: ColumnDef<Attribute, Attribute[keyof Attribute]>[]
7
+ columnDefs: ColumnDef<Attribute, AttributeValueTypes>[]
8
8
  ): Table<Attribute> => {
9
9
  const tableOptions = useTableOptions();
10
10
  return useReactTable<Attribute>({
@@ -1,7 +1,11 @@
1
1
  import { ColumnDef } from "@tanstack/react-table";
2
- import { Attribute, AttributeValue, Class } from "../../../../common/entities";
2
+ import {
3
+ Attribute,
4
+ AttributeValueTypes,
5
+ Class,
6
+ } from "../../../../common/entities";
3
7
 
4
8
  export interface UseDataDictionary {
5
9
  classes: Class[];
6
- columnDefs: ColumnDef<Attribute, AttributeValue>[];
10
+ columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
7
11
  }
@@ -105,6 +105,7 @@ export function getPlotOptions(
105
105
  paddingOuter: getYPaddingOuter(),
106
106
  tickFormat: () => "",
107
107
  tickSize: 0,
108
+ type: "band", // Treats number-like strings as categorical labels to prevent numeric scale warnings.
108
109
  },
109
110
  };
110
111
  }