11import { LABEL } from "@clevercanary/data-explorer-ui/lib/apis/azul/common/entities" ;
22import { stringifyValues } from "@clevercanary/data-explorer-ui/lib/common/utils" ;
3- import { Breadcrumb } from "@clevercanary/data-explorer-ui/lib/components/common/Breadcrumbs/breadcrumbs" ;
43import {
54 Key ,
65 KeyValues ,
76 Value ,
87} from "@clevercanary/data-explorer-ui/lib/components/common/KeyValuePairs/keyValuePairs" ;
98import { MetadataValue } from "@clevercanary/data-explorer-ui/lib/components/Index/components/NTagCell/nTagCell" ;
10- import { Description } from "@clevercanary/data-explorer-ui/lib/components/Project/common/entities" ;
119import { humanFileSize } from "../../../../utils/fileSize" ;
1210import {
1311 processAggregatedOrArrayValue ,
@@ -24,7 +22,6 @@ import {
2422import {
2523 ActivityEntityResponse ,
2624 BioSampleEntityResponse ,
27- DatasetEntityResponse ,
2825 DonorEntityResponse ,
2926 FileEntityResponse ,
3027 LibraryEntityResponse ,
@@ -72,8 +69,8 @@ export function getBioSampleType(response: BioSampleEntityResponse): string {
7269 * @param response - Response model return from biosamples API.
7370 * @returns Biosample type.
7471 */
75- export function getConsentGroup ( response : DatasetEntityResponse ) : string {
76- return processEntityValue ( response . datasets , "consent_group" ) ;
72+ export function getConsentGroup ( response : DatasetsResponse ) : string [ ] {
73+ return processAggregatedOrArrayValue ( response . datasets , "consent_group" ) ;
7774}
7875
7976/**
@@ -87,40 +84,6 @@ export function getAggregatedBioSampleTypes(
8784 return processAggregatedOrArrayValue ( response . biosamples , "biosample_type" ) ;
8885}
8986
90- /**
91- * Returns dataset related breadcrumbs.
92- * TODO revisit location
93- * @param firstCrumb - First breadcrumb.
94- * @param response - Response model return from datasets or dataset API endpoints.
95- * @returns dataset breadcrumbs.
96- */
97- export function getDatasetBreadcrumbs (
98- firstCrumb : Breadcrumb ,
99- response : DatasetEntityResponse
100- ) : Breadcrumb [ ] {
101- const datasetName = getDatasetTitle ( response ) ;
102- const breadcrumbs = [ firstCrumb ] ;
103- if ( datasetName ) {
104- breadcrumbs . push ( { path : "" , text : datasetName } ) ;
105- }
106- return breadcrumbs ;
107- }
108-
109- /**
110- * Maps dataset description from API response.
111- * @param response - Response model return from datasets or dataset API endpoints.
112- * @returns string representation of dataset description.
113- */
114- export function getDatasetDescription (
115- response : DatasetEntityResponse
116- ) : Description {
117- return processEntityValue (
118- response . datasets ,
119- "entity_description" ,
120- LABEL . NONE
121- ) ;
122- }
123-
12487/**
12588 * Maps dataset-related information, included formatted display text from API response.
12689 * @param response - Response model return from datasets or dataset API endpoints.
@@ -188,15 +151,6 @@ export function getDatasetEntryId(response: DatasetsResponse): string {
188151 return response . entryId ?? "" ; // TODO throw on no ID?
189152}
190153
191- /**
192- * Maps dataset title from the core dataset entity returned from the index/datasets endpoint.
193- * @param response - Response model return from datasets or dataset API endpoints.
194- * @returns Dataset title.
195- */
196- export function getDatasetTitle ( response : DatasetEntityResponse ) : string {
197- return processEntityValue ( response . datasets , "title" , LABEL . NONE ) ;
198- }
199-
200154/**
201155 * Maps dataset name from an aggregated datasets value returned from endpoints other than index/datasets.
202156 * @param response - Response model return from Azul that includes aggregated datasets.
@@ -352,17 +306,6 @@ export function getAggregatedPhenotypicSexes(
352306 return processAggregatedOrArrayValue ( response . donors , "phenotypic_sex" ) ;
353307}
354308
355- /**
356- * Maps registered identifier from the core dataset entity returned from the /index/datasets API response.
357- * @param response - Response model return from index/datasets API endpoint.
358- * @returns registered identifier.
359- */
360- export function getRegisteredIdentifier (
361- response : DatasetEntityResponse
362- ) : string {
363- return processEntityValue ( response . datasets , "registered_identifier" ) ;
364- }
365-
366309/**
367310 * Maps reported ethnicities from the core donors value returned from the index/donors endpoint.
368311 * @param response - Response model return from index/donors API endpoint.
0 commit comments