Skip to content

Commit

Permalink
add more stats to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
khansadaoudi committed Nov 6, 2024
1 parent 3faf42a commit ac822ea
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
42 changes: 31 additions & 11 deletions src/components/project/StatisticsProject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</q-card-section>
</q-card>
</div>
<div class="row justify-between q-gutter-md">
<div class="row q-pa-md justify-between q-gutter-md">
<q-card v-if="projectTags.length" flat bordered class="col">
<q-card-section class="q-gutter-md">
<div class="text-h6">
Expand All @@ -118,17 +118,31 @@
</q-card>
</div>
<div class="row q-pa-md justify-between q-gutter-md">
<q-card v-if="labels.length && values.length" flat bordered class="col">
<q-card-section class="text-center text-h6">
Users' contributions
<q-card v-if="userLabels.length && userTreesValues.length" flat bordered class="col">
<q-card-section>
<div class="text-center text-h6">
{{ $t('projectStats.userContributionTitle') }}
</div>
<div class="text-center text-caption">
{{ $t('projectStats.userContributionCaption') }}
</div>
</q-card-section>
<q-card-section>
<PieChart :labels="labels" :values="values"></PieChart>
<PieChart :labels="userLabels" :values="userTreesValues"></PieChart>
</q-card-section>

</q-card>
<q-card flat bordered class="col">

<q-card-section>
<div class="text-center text-h6">
{{ $t('projectStats.tokensDistributionTitle') }}
</div>
<div class="text-center text-caption">
{{ $t('projectStats.tokenDistributionCaption') }}
</div>
</q-card-section>
<q-card-section>
<PieChart :labels="samplesNames" :values="tokensNumberList"></PieChart>
</q-card-section>
</q-card>
</div>
</template>
Expand Down Expand Up @@ -159,14 +173,20 @@ export default defineComponent({
},
data() {
return {
labels: [] as string[],
values: [] as number[],
userLabels: [] as string[],
userTreesValues: [] as number[],
}
},
computed: {
...mapState(useStatisticStore, ['projectStats', 'topUserProgress', 'topUserProgressLabel']),
projectTags() {
return this.samples.map((sample) => Object.keys(sample.tags)).reduce((a: string[], b: string[]) => [...a, ...b], []);
},
samplesNames() {
return this.samples.map((sample) => sample.sampleName);
},
tokensNumberList() {
return this.samples.map((sample) => sample.tokens);
}
},
mounted() {
Expand All @@ -183,8 +203,8 @@ export default defineComponent({
}
return total
}, {});
this.labels = Object.keys(totalTreesByUser);
this.values = Object.values(totalTreesByUser);
this.userLabels = Object.keys(totalTreesByUser);
this.userTreesValues = Object.values(totalTreesByUser);
},
}
});
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/en-us/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ export default {
by: 'by',
usedTags: 'Used tags',
progressTooltip: 'Percentage of annotated sentences',
userContributionTitle: "Users' contributions",
userContributionCaption: "The total of users' trees in the project",
tokensDistributionTitle: 'Tokens distribution',
tokenDistributionCaption: 'Distribution of tokens per sample in the project',
},
conllDial: {
title: 'Conll Dialog',
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/fr-fra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@ export default {
by: 'par',
usedTags: 'Tags utilisés',
progressTooltip: 'Pourcentage des phrases annotées',
userContributionTitle: "Les contributions des utilisateurs",
userContributionCaption: "Nombre total d'arbres d'utilisateurs dans le projet",
tokensDistributionTitle: 'Distribution des tokens',
tokenDistributionCaption: 'Distribution des tokens par échantillon dans le projet',
},
conllDial: {
title: 'Conll Dialog',
Expand Down

0 comments on commit ac822ea

Please sign in to comment.