Skip to content

Commit a7e7b50

Browse files
authored
feat: use n-tags in project detail page side column (#3759) (#3792)
* feat: use n-tags instead of `stringifyValues` (#3759) * feat: use `stringifyValues` for paired end on project detail (#3759)
1 parent 76eb9d2 commit a7e7b50

File tree

3 files changed

+98
-12
lines changed

3 files changed

+98
-12
lines changed

explorer/app/components/Index/common/constants.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@ const {
2020
DIAGNOSIS,
2121
DISEASE_DONOR,
2222
DISEASE_INDICATION,
23+
DISEASE_STATUS_DONOR,
24+
DISEASE_STATUS_SPECIMEN,
25+
FILE_FORMAT,
2326
FOCUS_DISEASE,
2427
LIBRARY_CONSTRUCTION_APPROACH,
2528
LIBRARY_PREPARATION,
29+
MODEL_ORGAN,
30+
NUCLEIC_ACID_SOURCE,
31+
ORGAN_PART,
2632
ORGANISM_TYPE,
2733
PHENOTYPIC_SEX,
2834
PLATFORM,
2935
REPORTED_ETHNICITY,
36+
SAMPLE_TYPE,
37+
SELECTED_CELL_TYPE,
3038
STUDY,
3139
STUDY_DESIGN,
3240
WORKSPACE_NAME,
@@ -75,13 +83,21 @@ export const PLURALIZED_METADATA_LABEL = {
7583
[DIAGNOSIS]: "diagnoses",
7684
[DISEASE_DONOR]: "diseases",
7785
[DISEASE_INDICATION]: "diseases",
86+
[DISEASE_STATUS_DONOR]: "disease statuses",
87+
[DISEASE_STATUS_SPECIMEN]: "disease statuses",
88+
[FILE_FORMAT]: "file formats",
7889
[FOCUS_DISEASE]: "focuses / diseases",
7990
[LIBRARY_CONSTRUCTION_APPROACH]: "library construction methods",
8091
[LIBRARY_PREPARATION]: "library preparations",
92+
[MODEL_ORGAN]: "model organs",
93+
[NUCLEIC_ACID_SOURCE]: "nucleic acid sources",
8194
[ORGANISM_TYPE]: "organism types",
95+
[ORGAN_PART]: "organ parts",
8296
[PHENOTYPIC_SEX]: "phenotypic sexes",
8397
[PLATFORM]: "platforms",
8498
[REPORTED_ETHNICITY]: "reported ethnicities",
99+
[SAMPLE_TYPE]: "sample types",
100+
[SELECTED_CELL_TYPE]: "cell types",
85101
[STUDY]: "studies",
86102
[STUDY_DESIGN]: "study designs",
87103
[METADATA_KEY.SPECIES]: "species",

explorer/app/components/Index/common/entities.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,21 @@ export enum METADATA_KEY {
1414
DIAGNOSIS = "DIAGNOSIS",
1515
DISEASE_DONOR = "DISEASE_DONOR",
1616
DISEASE_INDICATION = "DISEASE_INDICATION",
17+
DISEASE_STATUS_DONOR = "DISEASE_STATUS_DONOR",
18+
DISEASE_STATUS_SPECIMEN = "DISEASE_STATUS_SPECIMEN",
19+
FILE_FORMAT = "FILE_FORMAT",
1720
FOCUS_DISEASE = "FOCUS_DISEASE",
1821
LIBRARY_CONSTRUCTION_APPROACH = "LIBRARY_CONSTRUCTION_APPROACH",
1922
LIBRARY_PREPARATION = "LIBRARY_PREPARATION",
23+
MODEL_ORGAN = "MODEL_ORGAN",
24+
NUCLEIC_ACID_SOURCE = "NUCLEIC_ACID_SOURCE",
25+
ORGAN_PART = "ORGAN_PART",
2026
ORGANISM_TYPE = "ORGANISM_TYPE",
2127
PHENOTYPIC_SEX = "PHENOTYPIC_SEX",
2228
PLATFORM = "PLATFORM",
2329
REPORTED_ETHNICITY = "REPORTED_ETHNICITY",
30+
SAMPLE_TYPE = "SAMPLE_TYPE",
31+
SELECTED_CELL_TYPE = "SELECTED_CELL_TYPE",
2432
SPECIES = "SPECIES",
2533
STUDY = "STUDY",
2634
STUDY_DESIGN = "STUDY_DESIGN",

explorer/app/viewModelBuilders/azul/hca-dcp/common/dataSummaryMapper/dataSummaryMapper.ts

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { LABEL } from "@clevercanary/data-explorer-ui/lib/apis/azul/common/entities";
22
import { stringifyValues } from "@clevercanary/data-explorer-ui/lib/common/utils";
33
import { Value } from "@clevercanary/data-explorer-ui/lib/components/common/KeyValuePairs/keyValuePairs";
4+
import { NTagCell } from "@clevercanary/data-explorer-ui/lib/components/Index/components/NTagCell/nTagCell";
45
import { ANCHOR_TARGET } from "@clevercanary/data-explorer-ui/lib/components/Links/common/entities";
56
import { Links } from "@clevercanary/data-explorer-ui/lib/components/Links/links";
67
import { formatCountSize } from "@clevercanary/data-explorer-ui/lib/utils/formatCountSize";
8+
import { METADATA_KEY } from "app/components/Index/common/entities";
9+
import { getPluralizedMetadataLabel } from "app/components/Index/common/indexTransformer";
710
import { HCA_DCP_CATEGORY_KEY } from "../../../../../../site-config/hca-dcp/category";
811
import {
912
processAggregatedBooleanOrArrayValue,
@@ -149,42 +152,101 @@ export function mapProjectDataSummary(
149152
HCA_DCP_CATEGORY_KEY.WORKFLOW
150153
);
151154
details.set(DATA_SUMMARY.PROJECT_SHORTNAME, projectShortname);
152-
details.set(DATA_SUMMARY.GENUS_SPECIES, stringifyValues(genusSpecies));
155+
details.set(
156+
DATA_SUMMARY.GENUS_SPECIES,
157+
NTagCell({
158+
label: getPluralizedMetadataLabel(METADATA_KEY.SPECIES),
159+
values: genusSpecies,
160+
})
161+
);
153162
details.set(
154163
DATA_SUMMARY.SAMPLE_ENTITY_TYPE,
155-
stringifyValues(sampleEntityType)
164+
NTagCell({
165+
label: getPluralizedMetadataLabel(METADATA_KEY.SAMPLE_TYPE),
166+
values: sampleEntityType,
167+
})
156168
); // Sample Type
157-
details.set(DATA_SUMMARY.ORGAN, stringifyValues(organ)); // Anatomical Entity
158-
details.set(DATA_SUMMARY.ORGAN_PART, stringifyValues(organPart)); // Organ Part
169+
details.set(
170+
DATA_SUMMARY.ORGAN,
171+
NTagCell({
172+
label: getPluralizedMetadataLabel(METADATA_KEY.ANATOMICAL_ENTITY),
173+
values: organ,
174+
})
175+
); // Anatomical Entity
176+
details.set(
177+
DATA_SUMMARY.ORGAN_PART,
178+
NTagCell({
179+
label: getPluralizedMetadataLabel(METADATA_KEY.ORGAN_PART),
180+
values: organPart,
181+
})
182+
); // Organ Part
159183
details.set(
160184
DATA_SUMMARY.SELECTED_CELL_TYPE,
161-
stringifyValues(selectedCellType)
185+
NTagCell({
186+
label: getPluralizedMetadataLabel(METADATA_KEY.SELECTED_CELL_TYPE),
187+
values: selectedCellType,
188+
})
162189
); // Selected Cell Types
163190
// Model organ should only display a value when sampleEntityType is cellLines or organoids i.e. "modelOrgan" will
164191
// not display if the sampleEntityType is "specimens".
165192
if (!isSampleEntityTypeSpecimens(sampleEntityType)) {
166-
details.set(DATA_SUMMARY.MODEL_ORGAN, stringifyValues(modelOrgan)); // Model Organ
193+
details.set(
194+
DATA_SUMMARY.MODEL_ORGAN,
195+
NTagCell({
196+
label: getPluralizedMetadataLabel(METADATA_KEY.MODEL_ORGAN),
197+
values: modelOrgan,
198+
})
199+
); // Model Organ
167200
}
168-
details.set(DATA_SUMMARY.DISEASE, stringifyValues(disease)); // Disease Status (Specimen)
169-
details.set(DATA_SUMMARY.DONOR_DISEASE, stringifyValues(donorDisease)); // Disease Status (Donor)
201+
details.set(
202+
DATA_SUMMARY.DISEASE,
203+
NTagCell({
204+
label: getPluralizedMetadataLabel(METADATA_KEY.DISEASE_STATUS_SPECIMEN),
205+
values: disease,
206+
})
207+
); // Disease Status (Specimen)
208+
details.set(
209+
DATA_SUMMARY.DONOR_DISEASE,
210+
NTagCell({
211+
label: getPluralizedMetadataLabel(METADATA_KEY.DISEASE_STATUS_DONOR),
212+
values: donorDisease,
213+
})
214+
); // Disease Status (Donor)
170215
details.set(
171216
DATA_SUMMARY.DEVELOPMENT_STAGE,
172-
stringifyValues(developmentStage)
217+
NTagCell({
218+
label: getPluralizedMetadataLabel(METADATA_KEY.DEVELOPMENT_STAGE),
219+
values: developmentStage,
220+
})
173221
); // Development Stage
174222
details.set(
175223
DATA_SUMMARY.LIBRARY_CONSTRUCTION_APPROACH,
176-
stringifyValues(libraryConstructionApproach)
224+
NTagCell({
225+
label: getPluralizedMetadataLabel(
226+
METADATA_KEY.LIBRARY_CONSTRUCTION_APPROACH
227+
),
228+
values: libraryConstructionApproach,
229+
})
177230
); // Library Construction Method
178231
details.set(
179232
DATA_SUMMARY.NUCLEIC_ACID_SOURCE,
180-
stringifyValues(nucleicAcidSource)
233+
NTagCell({
234+
label: getPluralizedMetadataLabel(METADATA_KEY.NUCLEIC_ACID_SOURCE),
235+
values: nucleicAcidSource,
236+
})
181237
); // Nucleic Acid Source
182238
details.set(DATA_SUMMARY.PAIRED_END, stringifyValues(pairedEnd)); // Paired End
183239
// Workflow will not display if "Unspecified".
184240
if (isWorkflowSpecified(workflow)) {
185241
details.set(DATA_SUMMARY.WORKFLOW, getWorkflowValue(workflow)); // Analysis Protocol
186242
}
187-
details.set(DATA_SUMMARY.FILE_FORMAT, stringifyValues(fileFormat)); // File Format
243+
details.set(
244+
DATA_SUMMARY.FILE_FORMAT,
245+
NTagCell({
246+
label: getPluralizedMetadataLabel(METADATA_KEY.FILE_FORMAT),
247+
values: fileFormat,
248+
})
249+
); // File Format
188250
details.set(DATA_SUMMARY.TOTAL_CELLS, totalCells); // Cell Count Estimate
189251
details.set(DATA_SUMMARY.DONOR_COUNT, formatCountSize(donorCount)); // Donor Count
190252
return details;

0 commit comments

Comments
 (0)