Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null values support #215

Merged
merged 19 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions debiaiServer/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
swagger: "2.0"
info:
version: 0.28.1
version: 0.29.0-beta2
title: DebiAI_BACKEND_API
description: DebiAI backend api
contact:
Expand Down Expand Up @@ -1238,8 +1238,6 @@ paths:
type: array
items:
type: array
items:
type: number

responses:
200:
Expand Down
4 changes: 2 additions & 2 deletions frontend/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"ncontours",
"parcats",
"parcoords",
"psutil",
"rangeslider",
"relayout",
"resizestop",
Expand Down Expand Up @@ -80,8 +81,7 @@
"zeroline",
"Zindex",
"zmax",
"zmin",
"psutil"
"zmin"
],
"flagWords": [],
"ignorePaths": [
Expand Down
3 changes: 1 addition & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "debiai_frontend",
"version": "0.28.1",
"version": "0.29.0-beta2",
"description": "Frontend for Debiai, made with Vuejs",
"license": "Apache-2.0",
"scripts": {
Expand All @@ -24,7 +24,6 @@
"vue-inline-svg": "^2.0.0",
"vue-progressive-image": "^3.2.0",
"vue-router": "^3.3.4",
"vue-table-dynamic": "^0.4.4",
"vuex": "^3.5.1"
},
"devDependencies": {
Expand Down
40 changes: 40 additions & 0 deletions frontend/src/components/debiai/dataAnalysis/common/Column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ Click to set column as the main color"
{{ column.typeText }}
</div>

<!-- Nb null values pie chart -->
<div
class="nbNullValues"
v-if="column.nbNullValues > 0"
:title="column.nbNullValues + ' null values'"
>
<div
class="pie"
:style="{ '--p': (column.nbNullValues / column.originalValues.length) * 100 }"
/>
{{ Math.ceil((column.nbNullValues / column.originalValues.length) * 100) }}%
</div>

<!-- Menu -->
<transition name="fade">
<dropdown-menu
Expand Down Expand Up @@ -333,5 +346,32 @@ export default {
color: var(--undefined);
}
}

/* Pie chart */
.nbNullValues {
display: flex;
align-items: center;
gap: 2px;
font-size: 0.8em;
color: var(--greyDarker);
font-weight: bold;

.pie {
position: relative;
width: 20px;
height: 20px;
display: inline-grid;
place-content: center;
border-radius: 50%;
background: var(--greyLight);
}
.pie:before {
content: "";
position: absolute;
border-radius: 50%;
inset: 0;
background: conic-gradient(var(--greyDarker) calc(var(--p) * 1%), #0000 0);
}
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,13 @@ export default {
} else {
this.selectedColumns = this.defaultSelected;
}
document.addEventListener("keydown", this.keyHandler);
},
mounted() {
// Set focus on search bar
this.$refs.columnsSearch.focus();
},

methods: {
// Handles the keydown event and emits the "cancel" event when the Escape key is pressed
keyHandler(k) {
if (k.key == "Escape") this.$emit("cancel");
},
// Handles the selection of a column and emits the "colSelect" event with the selected column index
columnSelected(colIndex) {
this.$emit("colSelect", colIndex);
Expand Down Expand Up @@ -233,9 +228,6 @@ export default {
if (this.defaultSelected) this.selectedColumns = this.defaultSelected;
},
},
beforeDestroy() {
document.removeEventListener("keydown", this.keyHandler);
},
};
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
:class="'aligned centered ' + (filter.type === 'intervals' ? 'intervalCol' : 'valueCol')"
title="Column name"
>
{{ filter.column.label }}
<span v-if="filter.column && filter.column.label">
{{ filter.column.label }}
</span>
<span v-else>
Column not found
<!-- TODO Prevent this from happening -->
</span>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<select
v-model="newValue"
v-if="filter.column.uniques"
v-if="filter.column.uniques && filter.column.uniques.length < 30"
>
<option
v-for="unValues in filter.column.uniques"
Expand All @@ -54,18 +54,8 @@

<!-- #controls -->
<div class="aligned centered">
<button
@click="addValue(false)"
:disabled="newValue === null || newValue === ''"
>
Add
</button>
<button
@click="addValue(true)"
:disabled="newValue === null || newValue === ''"
>
Add and close
</button>
<button @click="addValue(false)">Add</button>
<button @click="addValue(true)">Add and close</button>
<button
class="red"
@click="addValuePanel = false"
Expand All @@ -88,7 +78,15 @@
@click="removeValue(value)"
title="Remove the value form the filter"
>
{{ value }}
<span v-if="value !== null">
{{ value }}
</span>
<span
v-else
style="opacity: 0.7"
>
Null
</span>
</button>
<button
@click="addValuePanel = true"
Expand Down Expand Up @@ -128,9 +126,11 @@ export default {
methods: {
addValue(closeAfter) {
// Convert the value to the right type
const valueToAdd =
let valueToAdd =
this.filter.column.typeText === "Num" ? parseFloat(this.newValue) : this.newValue;

if (valueToAdd === "" || isNaN(valueToAdd)) valueToAdd = null;

// Add the value to the filter in the store
this.$store.commit("addValueToFilter", {
filterId: this.filter.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ export default {
</script>

<style scoped lang="scss">
#pointPlot {
#densityPlot2D {
display: flex;
flex-direction: column;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ export default {

// Plot
checkPlot(failFast = false) {
const colColor = this.data.columns[this.coloredColumnIndex];
const colColor = this.data.getColumn(this.coloredColumnIndex);

if (
this.coloredColumnIndex !== null &&
this.dividePerColor &&
colColor &&
colColor.uniques.length > 100
) {
if (failFast) return false;
Expand Down Expand Up @@ -248,8 +249,12 @@ export default {

let colColor;
let extraPlotName = "";
if (this.coloredColumnIndex !== null && this.dividePerColor) {
colColor = this.data.columns[this.coloredColumnIndex];
if (
this.coloredColumnIndex !== null &&
this.dividePerColor &&
this.data.getColumn(this.coloredColumnIndex)
) {
colColor = this.data.getColumn(this.coloredColumnIndex);
extraPlotName = " grouped by " + colColor.label;

let selectedColors;
Expand Down Expand Up @@ -286,7 +291,7 @@ export default {
stdX,
stdY,
color: i,
name: colColor.uniques[i],
name: colColor.uniques[i] || "Missing data",
});
});
} else {
Expand Down Expand Up @@ -428,6 +433,11 @@ export default {
</script>

<style lang="scss" scoped>
#nightStarsPlot {
display: flex;
flex-direction: column;
}

#settings {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@
</label>
</div>
</div>
<!-- Display null values -->
<!-- Connect values -->
<div
class="data"
v-if="!averageAsBar"
>
<span class="name">Display null values</span>
<span class="name">Connect values</span>
<div class="value">
<input
type="checkbox"
Expand Down
Loading
Loading