Skip to content

Commit

Permalink
added more filters for datasets and tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinvanschoren committed Jan 1, 2024
1 parent 839c4bd commit 5396292
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 13 deletions.
23 changes: 18 additions & 5 deletions app/public/locales/en/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,13 @@ filters:
status: "Status"
licence: "Licence"
size: "Size"
features: "Features"
target: "Task type"
deactivated: "Deactivated"
active: "Verified"
in_preparation: "In preparation"
Less than 10: "Less than 10"
10s: "10s"
100s: "100s"
1000s: "1000s"
10000s: "10000s"
Expand All @@ -638,9 +642,18 @@ filters:
CC0: "CC0"
tasktype: "Task type"
Clustering: "Clustering"
Supervised_Regression: "Supervised Regression"
Supervised_Classification: "Supervised Classification"
Learning_curve: "Learning curve"
Subgroup_Discovery: "Subgroup Discovery"

Supervised Regression: "Supervised Regression"
Supervised Classification: "Supervised Classification"
Learning Curve: "Learning Curve Analysis"
Subgroup Discovery: "Subgroup Discovery"
Regression: "Regression"
Binary Classification: "Binary Classification"
Multi-Class: "Multi-Class"
format: "Formatting"
ARFF: "Dense"
arff: "Dense"
Sparse_ARFF: "Sparse"
csv: "CSV"
CSV: "CSV"


2 changes: 0 additions & 2 deletions app/src/components/search/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import React from "react";
import styled from "@emotion/styled";
import { Chip as MuiChip } from "@mui/material";

import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

const FilterChip = styled(MuiChip)`
margin-left: 10px;
margin-top: 10px;
Expand Down
7 changes: 3 additions & 4 deletions app/src/components/search/SearchContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const Filter = ({ label, options, values, onRemove, onSelect }) => {
label={
(label in facet_aliases && option.value in facet_aliases[label]
? facet_aliases[label][option.value]
: i18n.t(`filters.${option.value.replace(/ /g, "_")}`)) +
: i18n.t(`filters.${option.value}`)) +
" (" +
option.count +
")"
Expand Down Expand Up @@ -234,9 +234,9 @@ const SearchContainer = memo(
}) => {
const [filter, setFilter] = React.useState("hide");
const handleFilterChange = (event, newFilter) => {
console.log("newFilter", newFilter);
console.log(filter, newFilter);
if (newFilter === filter) {
setFilter(false);
setFilter("hide");
} else {
setFilter(newFilter + "");
}
Expand All @@ -255,7 +255,6 @@ const SearchContainer = memo(
name: i18n.t(option.name),
}));

console.log("Filter:", filter);
return (
<SearchProvider config={config}>
<TabContext value={filter}>
Expand Down
11 changes: 10 additions & 1 deletion app/src/pages/d/dataCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,14 @@ export const stats = [
];

export const Description = ({ result }) => {
return <Teaser description={result.description.raw.toString()} limit={3} />;
return (
<Teaser
description={
result.description.raw
? result.description.raw.toString()
: "Description missing"
}
limit={3}
/>
);
};
12 changes: 12 additions & 0 deletions app/src/pages/d/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ const search_facets = [
label: "filters.size",
field: "qualities.NumberOfInstances",
},
{
label: "filters.features",
field: "qualities.NumberOfFeatures",
},
{
label: "filters.target",
field: "qualities.NumberOfClasses",
},
{
label: "filters.format",
field: "format",
},
];

// Controls how columns are rendered and manipulated in the table view
Expand Down
28 changes: 27 additions & 1 deletion app/src/pages/d/searchConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ const searchConfig = {
visibility: { raw: {} },
suggest: { raw: {} },
},
disjunctiveFacets: ["status", "licence", "qualities.NumberOfInstances"],
disjunctiveFacets: [
"status",
"licence",
"qualities.NumberOfInstances",
"qualities.NumberOfFeatures",
"qualities.NumberOfClasses",
"format",
],
facets: {
"status.keyword": { type: "value" },
"name.keyword": { type: "value" },
Expand All @@ -65,6 +72,25 @@ const searchConfig = {
{ from: 1000000, name: "Millions" },
],
},
"qualities.NumberOfFeatures": {
type: "range",
ranges: [
{ from: 0, to: 10, name: "Less than 10" },
{ from: 10, to: 100, name: "10s" },
{ from: 100, to: 1000, name: "100s" },
{ from: 1000, to: 10000, name: "1000s" },
{ from: 10000, name: "10000s" },
],
},
"qualities.NumberOfClasses": {
type: "range",
ranges: [
{ from: 0, to: 2, name: "Regression" },
{ from: 2, to: 2, name: "Binary Classification" },
{ from: 2, name: "Multi-Class" },
],
},
format: { type: "value" },
},
group: {
//This doesn't work yet. TODO: figure out how to group.
Expand Down
3 changes: 3 additions & 0 deletions app/src/pages/t/searchConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const searchConfig = {
target_values: { raw: {} },
estimation_procedure: { raw: {} },
evaluation_measures: { raw: {} },
nr_of_likes: { raw: {} },
nr_of_downloads: { raw: {} },
runs: { raw: {} },
},
disjunctiveFacets: ["tasktype"],
facets: {
Expand Down

0 comments on commit 5396292

Please sign in to comment.