Searchable Dataset
Add a new route at /datasets/{uuid}/view AmphibianDatasetPage
that uses the same layout as @labs/ingest/IngestPage
:
<PageLayout withTable sidebar={ <TraitDescriptorFilters ... /> }>
<ScrollToTopOnMount />
<PageTitle title={ dataset?.title } />
<BrowseMainSection tableView>
<Table />
</BrowseMainSection>
</PageLayout>
Use hooks.
Effects
The primary effect is to load the dataset: Dataset
by uuid
from the route. When the dataset
is successfully loaded, then we need to
also load the corresponding Amphibian dataset information (see commit 462602f2) so we can fetch the list of Descriptors
that are registered for it in Amphibian.
The list of "ingested" Descriptors
(their UUIDs) can be found in Amphibian's Object.keys(datatable.columns)
.
useEffect(() => {
setDataset(DatasetService.getDataset(uuid));
}, [ uuid ]);
// Fetch info from Amphibian if dataset changes
const amphibianDataset = useMemo(async () => {
if (dataset?.uuid) {
return await AmphibianService.getAmphibianDataset(dataset.uuid);
} else {
return undefined;
}
}, [ dataset?.uuid ]);
// Fetch list of descriptors if amphibianDataset.columns changes
const descriptors = useMemo(async () => {
if (amphibianDataset?.columns) {
return await DescriptorService.load....(Object.keys(amphibianDataset.columns);
} else {
return undefined;
}
}, [ amphibianDataset?.columns ]);
TraitDescriptorFilter
and TraitDescriptorFilters
We need a new component TraitDescriptorFilter
that accepts Descriptor
and renders differently for different types of Descriptors
(e.g. scale is different to coded).
<TraitDescriptorFilters descriptors={ [ ...descriptors ] }
component receives descriptors: Descriptor[]
and renders individual <TraitDescriptorFilter descriptor={ descriptor } />
for each of the received descriptors.
Table
The main <Table
displays a column for each of the Descriptors
in the datatable.
Rows for the <Table
are fetched with POST amhibian/... with the selected TraitDescriptorFilters
.
PrettyTraitFilters
We need a component to display the active trait descriptor filters in BrowseMainSection top={ <><PrettyTraitFilters /></> }
.
Actions
- Download filtered data in Excel
- Navigate to
/datasets/{uuid}
Tabs
The main <Tab
is titled "Observations" and it displays the data. Other tabs will be added later:
- Overview: TBD
- Analyze: TBD