@@ -65,11 +65,11 @@ import {
6565} from "../../../../apis/azul/anvil-cmg/common/entities" ;
6666import {
6767 DatasetsResponse ,
68+ EntityResponse ,
6869 FilesResponse ,
6970 SummaryResponse ,
7071} from "../../../../apis/azul/anvil-cmg/common/responses" ;
7172import {
72- getActivityDataModalities ,
7373 getActivityType ,
7474 getAggregatedBioSampleTypes ,
7575 getAggregatedDatasetIds ,
@@ -97,6 +97,7 @@ import {
9797 getReportedEthnicities ,
9898} from "../../../../apis/azul/anvil-cmg/common/transformers" ;
9999import {
100+ processAggregatedOrArrayValue ,
100101 processEntityArrayValue ,
101102 processEntityValue ,
102103} from "../../../../apis/azul/common/utils" ;
@@ -124,6 +125,20 @@ export const buildActivityType = (
124125 } ;
125126} ;
126127
128+ /**
129+ * Build props for aggregated data modality NTagCell component from the given response.
130+ * @param response - Response model return from API.
131+ * @returns model to be used as props for the NTagCell component.
132+ */
133+ export const buildAggregatedDataModality = (
134+ response : Exclude < EntityResponse , FilesResponse >
135+ ) : React . ComponentProps < typeof C . NTagCell > => {
136+ return {
137+ label : getPluralizedMetadataLabel ( METADATA_KEY . DATA_MODALITY ) ,
138+ values : processAggregatedOrArrayValue ( response . files , "data_modality" ) ,
139+ } ;
140+ } ;
141+
127142/**
128143 * Build props for dataset-related export warning Alert component.
129144 * @param _ - Unused.
@@ -267,16 +282,16 @@ export const buildConsentGroup = (
267282} ;
268283
269284/**
270- * Build props for data modality NTagCell component from the given activities response.
271- * @param response - Response model return from index/activities API.
285+ * Build props for data modality NTagCell component from the given response.
286+ * @param response - Response model return from API.
272287 * @returns model to be used as props for the NTagCell component.
273288 */
274289export const buildDataModality = (
275- response : ActivityEntityResponse
290+ response : FilesResponse
276291) : React . ComponentProps < typeof C . NTagCell > => {
277292 return {
278293 label : getPluralizedMetadataLabel ( METADATA_KEY . DATA_MODALITY ) ,
279- values : getActivityDataModalities ( response ) ,
294+ values : processEntityArrayValue ( response . files , "data_modality" ) ,
280295 } ;
281296} ;
282297
0 commit comments