Skip to content

Commit

Permalink
Merge pull request #549 from inab/participant-metrics
Browse files Browse the repository at this point in the history
Participant metrics
  • Loading branch information
carleshf authored Apr 24, 2024
2 parents 997c536 + 9cd0264 commit 1257f20
Show file tree
Hide file tree
Showing 13 changed files with 851 additions and 36 deletions.
63 changes: 63 additions & 0 deletions components/Challenges/ChallengeParticipantMetricsTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<template>
<div>
<v-data-table
dense
:headers="headers"
:items="items"
:items-per-page="15"
:search="search"
item-key="_id"
:loading="
$store.state.challenge.loading.participants ||
$store.state.challenge.loading.metrics
"
>
<template #top>
<v-text-field
v-model="search"
label="Search"
class="mx-4"
></v-text-field>
</template>
</v-data-table>
</div>
</template>

<script>
export default {
components: {},
props: {
metricsTable: { type: Object, required: true },
},
data() {
const headers = this.metricsTable.metrics.map((metric, metricsI) => {
return {
text: metric.metrics_label,
align: 'start',
value: `metricsValues[${metricsI}].value`,
};
});
headers.unshift({
text: 'Participant',
align: 'start',
value: 'participant.participant_label',
});
const items = this.metricsTable.participants.map(
(participant, participantI) => {
return {
_id: participant._id,
participant,
metricsValues: this.metricsTable.dataMatrix[participantI],
};
}
);
return {
search: '',
headers,
items,
};
},
};
</script>
3 changes: 3 additions & 0 deletions components/Communities/CommunityClassificationTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
<nuxt-link :to="item._id" append>
{{ item.acronym }}
</nuxt-link>
(<nuxt-link :to="item._id + '/participants'" append>
participants </nuxt-link
>)
</template>
</v-data-table>
</div>
Expand Down
13 changes: 13 additions & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,19 @@ export default {
path: '/scientific/:community/:id',
component: resolve(__dirname, 'pages/benchmarking/_community/_id'),
});
routes.push({
name: 'scientific-community-challenge-participants',
path: '/scientific/:community/:id/participants',
component: resolve(
__dirname,
'pages/benchmarking/_community/_id/participants'
),
});
// routes.push({
// name: 'scientific-community-challenge-participants',
// path: '/benchmarking/:community/:id/participants',
// component: resolve(__dirname, 'pages/benchmarking/_community/_id/participants'),
// });
},
},
};
28 changes: 19 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openEBench-nuxt",
"version": "1.0.3",
"version": "1.0.4",
"private": true,
"author": "Dominik Brüchner <dominik.bruchner@bsc.es>, José Mª Fernández <jose.m.fernandez@bsc.es>",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mount } from '@vue/test-utils';
import Challenge from './_id.vue';
import Challenge from './index.vue';
import MockCommunity from '~/test/unit/mockData/Community';
import MockEvent from '~/test/unit/mockData/Event';
import MockEvents from '~/test/unit/mockData/Events';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
/>
<div v-else>
<h1 class="text-h4">
{{ challenge.acronym }}
{{ challenge.challenge_label }} ({{ challenge._id }})
</h1>
<h2 class="text-subtitle-1 mb-5">
{{ challenge.name }}
</h2>
<p class="text--secondary">
In this 2D plot two metrics from the challenge
{{ challenge.acronym }} are represented in the X and Y axis, showing the
results from the participating tools in this challenge. The gray line
represents the pareto frontier, which runs over the participants tools,
showing the best efficiency, while the arrow in the plot represents the
optimal corner.
{{ challenge.challenge_label }} are represented in the X and Y axis,
showing the results from the participating tools in this challenge. The
gray line represents the pareto frontier, which runs over the
participants tools, showing the best efficiency, while the arrow in the
plot represents the optimal corner.
</p>
<v-alert class="mt-8" border="left" dense text color="info" type="info">
The menu button above the diagram can be used to switch between the
Expand Down Expand Up @@ -85,7 +85,7 @@ import ChartBarplotVisualizerWrapper from '~/components/Widgets/ChartBarplotVisu
import ChartScatterVisualizerWrapper from '~/components/Widgets/ChartScatterVisualizerWrapper';
export default {
name: 'CommunityParticipantPage',
name: 'CommunityChallengePlotsPage',
components: { ChartBarplotVisualizerWrapper, ChartScatterVisualizerWrapper },
data() {
return {
Expand Down Expand Up @@ -117,23 +117,24 @@ export default {
to: '/benchmarking',
},
{
text: this.community.acronym
? this.community.acronym
: this.$route.params.community + ' Events',
text:
(this.community.acronym
? this.community.acronym
: this.$route.params.community) + ' Events',
disabled: false,
exact: true,
to: 'events',
to: './events',
},
{
text: this.currentEvent
? this.currentEvent.name
: this.$route.params.community + ' Results',
disabled: false,
exact: true,
to: './',
to: './?event=' + this.$route.params.id,
},
{
text: this.challenge ? this.challenge.acronym : '',
text: this.challenge ? this.challenge.challenge_label : '',
disabled: true,
to: this.$route.params.id,
},
Expand Down
142 changes: 142 additions & 0 deletions pages/benchmarking/_community/_id/participants.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import { mount } from '@vue/test-utils';
import Challenge from './index.vue';
import MockCommunity from '~/test/unit/mockData/Community';
import MockEvent from '~/test/unit/mockData/Event';
import MockEvents from '~/test/unit/mockData/Events';
import MockChallenge from '~/test/unit/mockData/Challenge';
/*
import ChartBarplotVisualizerWrapper from '~/components/Widgets/ChartBarplotVisualizerWrapper';
import ChartScatterVisualizerWrapper from '~/components/Widgets/ChartScatterVisualizerWrapper';
*/

const factory = (mockStore) => {
return mount(Challenge, {
...createComponentMocks({ store: mockStore }),
mocks: {
$route: { params: { community: 'TESTCOMMUNITY', id: 'TESTID' } },
$config: { OEB_LEGACY_ANGULAR_URI: 'https://jest-openebench.bsc.es/' },
},
});
};

describe('Community Participant', () => {
afterEach(() => {
jest.clearAllMocks();
});

const mockStore = {
community: {
getters: {
events: () => {
return MockEvents;
},
currentEvent: () => {
return MockEvent;
},
participants: () => {
return [];
},
tools: () => {
return [];
},
community: () => {
return MockCommunity;
},
getEventById: () => {
return () => MockEvent;
},
},
actions: {
setCurrentEvent: jest.fn(),
getCommunity: jest.fn(),
},
mutations: {
setCommunity: jest.fn(),
setEvents: jest.fn(),
setCurrentEvent: jest.fn(),
setParticipants: jest.fn(),
setTools: jest.fn(),
setLoading: jest.fn(),
},
state: () => {
return {
loading: {
events: false,
tools: false,
participants: false,
community: false,
},
community: MockCommunity,
};
},
},
challenge: {
getters: {
participantsList: () => {
return [];
},
challenge: () => {
return {};
},
},
actions: {
getChallenge: jest.fn(),
getParticipants: jest.fn(),
},
mutations: {
setParticipants: jest.fn(),
setChallenge: jest.fn(),
setLoading: jest.fn(),
},
state: () => {
return {
loading: {
challenge: false,
participants: false,
},
challenge: MockChallenge,
};
},
},
};

it('is instantiated', async () => {
const wrapper = factory(mockStore);
expect(wrapper).toBeTruthy();
await wrapper.vm.$nextTick();
});

it('calls store actions on mount', () => {
const wrapper = factory(mockStore);
expect(wrapper).toBeTruthy();

expect(mockStore.challenge.actions.getChallenge).toHaveBeenCalled();
});

/*
it('renders the bar-plot component with the right ID and JSON data structure for rendering', () => {
mockStore.challenge.getters.datasetsList = () => {
return MockChallengeDatasetsBarplot;
};
const wrapper = factory(mockStore);
expect(wrapper).toBeTruthy();
const barplot = wrapper.findComponent(ChartBarplotVisualizerWrapper); // => finds Bar by `name`
expect(barplot.exists()).toBe(true);
expect(barplot.props().id).toBe(MockChallengeDatasetsBarplot[0]._id);
expect(barplot.props().data).toBe(
MockChallengeDatasetsBarplot[0].graphData
);
});
it('renders the scatter-plot component with the right ID', () => {
mockStore.challenge.getters.datasetsList = () => {
return MockChallengeDatasetsScatter;
};
const wrapper = factory(mockStore);
expect(wrapper).toBeTruthy();
const scatter = wrapper.findComponent(ChartScatterVisualizerWrapper); // => finds Bar by `name`
expect(scatter.exists()).toBe(true);
expect(scatter.props().id).toBe(MockChallengeDatasetsScatter[0]._id);
});
*/
});
Loading

0 comments on commit 1257f20

Please sign in to comment.