Skip to content

Commit

Permalink
- ADD: Added another option to export trait definitions in Germinate …
Browse files Browse the repository at this point in the history
…and GridScore format.

-
  • Loading branch information
sebastian-raubach committed May 24, 2024
1 parent d4ec33a commit 34811b1
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 13 deletions.
3 changes: 2 additions & 1 deletion components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ declare module 'vue' {
ChangelogModal: typeof import('./src/components/modals/ChangelogModal.vue')['default']
ColumnHeader: typeof import('./src/components/canvas/ColumnHeader.vue')['default']
ConfirmModal: typeof import('./src/components/modals/ConfirmModal.vue')['default']
copy: typeof import('./src/components/modals/PlotCommentListModal.vue')['default']
copy: typeof import('./src/components/icons/IconGridScore.vue')['default']
DataCalendarHeatmapChart: typeof import('./src/components/charts/DataCalendarHeatmapChart.vue')['default']
DataCanvas: typeof import('./src/components/canvas/DataCanvas.vue')['default']
DataGridComponent: typeof import('./src/components/canvas/DataGridComponent.vue')['default']
Expand Down Expand Up @@ -249,6 +249,7 @@ declare module 'vue' {
IBiXSquare: typeof import('~icons/bi/x-square')['default']
IconBrapi: typeof import('./src/components/icons/IconBrapi.vue')['default']
IconGerminate: typeof import('./src/components/icons/IconGerminate.vue')['default']
IconGridScore: typeof import('./src/components/icons/IconGridScore.vue')['default']
ImageModal: typeof import('./src/components/modals/ImageModal.vue')['default']
JumpToDropdown: typeof import('./src/components/dropdowns/JumpToDropdown.vue')['default']
LayoutFeedbackModal: typeof import('./src/components/modals/LayoutFeedbackModal.vue')['default']
Expand Down
7 changes: 2 additions & 5 deletions public/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/components/icons/IconGridScore.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" fill="currentColor" class="b-icon bi">
<path d="M13.548.048a6.254 6.254 0 0 0-2.42.969c-.35.24-1.017.855-1.217 1.122l-.094.13-.452-.22c-.87-.428-1.577-.589-2.586-.585-.742 0-1.189.071-1.805.275a5.864 5.864 0 0 0-3.39 2.998c-.876 1.856-.727 3.948.408 5.718.05.082.039.102-.267.412a5.699 5.699 0 0 0-1.652 3.638 5.71 5.71 0 0 0 .584 2.994c.793 1.59 2.17 2.664 3.944 3.076.428.099.542.11 1.217.11.722 0 1.047-.039 1.613-.196.07-.02.106.028.259.33a5.787 5.787 0 0 0 3.987 3.068c.49.106 1.397.146 1.871.083a5.826 5.826 0 0 0 3.952-2.296c.624-.836 1.052-1.974 1.119-2.978.015-.2.043-.353.066-.361.024-.008.22-.04.44-.071 2.048-.318 3.799-1.801 4.501-3.818 1.005-2.88-.447-6.087-3.277-7.24l-.29-.118.059-.263c.043-.189.059-.487.059-1.048 0-.663-.012-.844-.083-1.165-.4-1.786-1.522-3.242-3.092-4.011a5.447 5.447 0 0 0-1.354-.483c-.534-.121-1.558-.157-2.1-.07zm-1.667 10.917c.227.11.459.216.522.228.117.03.121.043.062.337a6.288 6.288 0 0 0-.066.565l-.028.353-.314.043a5.936 5.936 0 0 0-.56.11 2.784 2.784 0 0 1-.287.063c-.02 0-.114-.153-.208-.345a5.896 5.896 0 0 0-.295-.514l-.117-.173.42-.443c.231-.244.427-.44.439-.436.012.004.204.098.432.212z"/>
</svg>
</template>
5 changes: 5 additions & 0 deletions src/plugins/changelog/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@
"type": "new",
"title": "Beetkommentarliste",
"text": "Eine Liste aller Beetkommentare die über den gesamten Versuch aufgezeichnet wurden ist nun über das Kommentarsymbol über der Hauptdateneingabe verfügbar. Die Liste kann durchsucht und sortiert werden um die Kommentare zu finden nach denen gesucht wird."
},
{
"type": "new",
"title": "Merkmalsdefinitionen-Export",
"text": "Neue Optionen zum Export von Merkmalsdefinitionen in verschiedenen Formaten wurden hinzugefügt."
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/changelog/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@
"type": "new",
"title": "Plot comment list",
"text": "A list of all plot trials recorded across the trial is now available using the comment icon above the data input table. The list can be filtered and sorted to find the comments you're looking for."
},
{
"type": "new",
"title": "Trait definition export",
"text": "Added more ways in which trait definitions can be exported in a variety of formats."
}
]
}
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,12 @@
"pageExportTrialFormatGerminateDataCardSubtitle": "Exportiere die gesammelten Daten direkt in die Germinate Datenvorlagen für phänotypische Versuchsdaten. Diese können dann direkt nach Germinate hochgeladen werden.",
"pageExportTrialFormatGerminateShapeCardTitle": "Versuchsaufbau exportieren",
"pageExportTrialFormatGerminateShapeCardSubtitle": "Exportiere den Versuchsaufbau in Form eines Shapefiles. Diese können dann direkt nach Germinate hochgeladen werden.",
"pageExportTabTitleTraits": "Merkmale",
"pageExportTrialTraits": "Exportiere die Merkmale die in diesem Versuch genutzt wurden in spezifische Formate.",
"pageExportTrialTraitsGerminateCardTitle": "Germinate Format",
"pageExportTrialTraitsGerminateCardSubtitle": "Exportiere die Merkmale im Germinate-Format welches im 'PHENOTYPES' Reiter der Germinate Datenvorlagen genutzt wird.",
"pageExportTrialTraitsGridScoreCardTitle": "GridScore Format",
"pageExportTrialTraitsGridScoreCardSubtitle": "Exportiere die Merkmale im GridScore JSON-Format welches genutzt werden kann um die Merkmale zu einem späteren Zeitpunkt wieder zu importieren.",
"pageArchiveProgressLabelCheckingForArchive": "Suche nach Archiv...",
"pageArchiveTitle": "Archiv",
"pageArchiveSubtitle": "Eine archivierte Version des Versuchs wurde gefunden.",
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/i18n/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,12 @@
"pageExportTrialFormatGerminateDataCardSubtitle": "Export the collected data straight into the Germinate Data Template for phenotypic trials data. This can then directly be uploaded to Germinate.",
"pageExportTrialFormatGerminateShapeCardTitle": "Export trial layout",
"pageExportTrialFormatGerminateShapeCardSubtitle": "Export the layout of this trial in form of a Shapefile. This can then directly be uploaded to Germinate.",
"pageExportTabTitleTraits": "Traits",
"pageExportTrialTraits": "Export the traits used in this trial into specific formats.",
"pageExportTrialTraitsGerminateCardTitle": "Germinate format",
"pageExportTrialTraitsGerminateCardSubtitle": "Export the traits into the Germinate format used in the 'PHENOTYPES' tab of the Germinate data templates.",
"pageExportTrialTraitsGridScoreCardTitle": "GridScore format",
"pageExportTrialTraitsGridScoreCardSubtitle": "Export the traits into the GridScore JSON format which can be used to re-import them at a later date.",
"pageArchiveProgressLabelCheckingForArchive": "Checking for archive...",
"pageArchiveTitle": "Archive",
"pageArchiveSubtitle": "An archived version of your trial has been found.",
Expand Down
2 changes: 1 addition & 1 deletion src/views/DataStatisticsView.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<b-container fluid class="my-4">
<b-container class="my-4">
<h1 class="display-4">{{ $t('pageDataStatisticsTitle') }}</h1>
<p>{{ $t('pageDataStatisticsText') }}</p>

Expand Down
73 changes: 67 additions & 6 deletions src/views/TrialExportView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<b-row>
<b-col cols=12 md=6>
<b-card class="mb-3" :title="$t('pageExportTrialFormatTabDataCardTitle')" :sub-title="$t('pageExportTrialFormatTabDataCardSubtitle')">
<b-card class="mb-3" :title="$t('pageExportTrialFormatTabDataCardTitle')" :subtitle="$t('pageExportTrialFormatTabDataCardSubtitle')">
<b-form-group :label="$t('formLabelExportTrialFormatGerminateAggregate')" :description="$t('formDescriptionExportTrialFormatGerminateAggregate')" label-for="aggregate">
<b-form-checkbox id="aggregate" v-model="tabAggregate" switch>
{{ tabAggregate ? $t('genericYes') : $t('genericNo') }}
Expand All @@ -26,6 +26,30 @@
</b-col>
</b-row>
</b-tab>
<b-tab>
<template #title>
<IBiTags /> {{ $t('pageExportTabTitleTraits') }}
</template>

<p class="mt-3" v-html="$t('pageExportTrialTraits')" />

<b-row>
<b-col cols=12 md=6>
<b-card class="mb-3" :title="$t('pageExportTrialTraitsGerminateCardTitle')" :subtitle="$t('pageExportTrialTraitsGerminateCardSubtitle')">
<b-button @click="exportTraitsGerminate" variant="primary">
<IconGerminate /> {{ $t('buttonExport') }}
</b-button>
</b-card>
</b-col>
<b-col cols=12 md=6>
<b-card class="mb-3" :title="$t('pageExportTrialTraitsGridScoreCardTitle')" :subtitle="$t('pageExportTrialTraitsGridScoreCardSubtitle')">
<b-button @click="exportTraitsGridScore" variant="primary">
<IconGridScore /> {{ $t('buttonExport') }}
</b-button>
</b-card>
</b-col>
</b-row>
</b-tab>
<b-tab>
<template #title>
<IBiChatRightQuoteFill /> {{ $t('pageExportTabTitleComments') }}
Expand All @@ -35,7 +59,7 @@

<b-row>
<b-col cols=12 md=6>
<b-card class="mb-3" :title="$t('pageExportTrialFormatCommentTrialCardTitle')" :sub-title="$t('pageExportTrialFormatCommentTrialCardSubtitle')">
<b-card class="mb-3" :title="$t('pageExportTrialFormatCommentTrialCardTitle')" :subtitle="$t('pageExportTrialFormatCommentTrialCardSubtitle')">
<b-card-text :class="trialCommentCount < 1 ? 'text-danger' : null">{{ $t('pageExportTrialFormatCommentTrialCount', trialCommentCount) }}</b-card-text>

<b-button @click="exportTrialComments" variant="primary" :disabled="trialCommentCount < 1">
Expand All @@ -44,7 +68,7 @@
</b-card>
</b-col>
<b-col cols=12 md=6>
<b-card class="mb-3" :title="$t('pageExportTrialFormatCommentPlotCardTitle')" :sub-title="$t('pageExportTrialFormatCommentPlotCardSubtitle')">
<b-card class="mb-3" :title="$t('pageExportTrialFormatCommentPlotCardTitle')" :subtitle="$t('pageExportTrialFormatCommentPlotCardSubtitle')">
<b-card-text :class="plotCommentCount < 1 ? 'text-danger' : null">{{ $t('pageExportTrialFormatCommentPlotCount', plotCommentCount) }}</b-card-text>

<b-button @click="exportPlotComments" variant="primary" :disabled="plotCommentCount < 1">
Expand All @@ -61,7 +85,7 @@

<p class="mt-3" v-html="$t('pageExportTrialFormatEvent')" />

<b-card class="mb-3" :title="$t('pageExportTrialFormatEventTrialCardTitle')" :sub-title="$t('pageExportTrialFormatEventTrialCardSubtitle')">
<b-card class="mb-3" :title="$t('pageExportTrialFormatEventTrialCardTitle')" :subtitle="$t('pageExportTrialFormatEventTrialCardSubtitle')">
<b-card-text :class="trialEventCount < 1 ? 'text-danger' : null">{{ $t('pageExportTrialFormatEventTrialCount', trialEventCount) }}</b-card-text>

<b-button @click="exportTrialEvents" variant="primary" :disabled="trialEventCount < 1">
Expand All @@ -81,7 +105,7 @@

<b-row>
<b-col cols=12 md=6>
<b-card class="mb-3" :title="$t('pageExportTrialFormatGerminateDataCardTitle')" :sub-title="$t('pageExportTrialFormatGerminateDataCardSubtitle')">
<b-card class="mb-3" :title="$t('pageExportTrialFormatGerminateDataCardTitle')" :subtitle="$t('pageExportTrialFormatGerminateDataCardSubtitle')">
<b-form-group :label="$t('formLabelExportTrialFormatGerminateAggregate')" :description="$t('formDescriptionExportTrialFormatGerminateAggregate')" label-for="aggregate">
<b-form-checkbox id="aggregate" v-model="germinateAggregate" switch>
{{ germinateAggregate ? $t('genericYes') : $t('genericNo') }}
Expand All @@ -93,7 +117,7 @@
</b-card>
</b-col>
<b-col cols=12 md=6 v-if="trial.layout && trial.layout.corners">
<b-card class="mb-3" :title="$t('pageExportTrialFormatGerminateShapeCardTitle')" :sub-title="$t('pageExportTrialFormatGerminateShapeCardSubtitle')">
<b-card class="mb-3" :title="$t('pageExportTrialFormatGerminateShapeCardTitle')" :subtitle="$t('pageExportTrialFormatGerminateShapeCardSubtitle')">
<b-button :disabled="isOnline === false" :href="exportedFiles.shapefile" @click="exportedFiles.shapefile = null" variant="success" v-if="exportedFiles.shapefile"><IBiDownload /> {{ $t('buttonDownload') }}</b-button>
<b-button :disabled="isOnline === false" @click="exportShapefileGerminate" variant="primary" v-else><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-grid-3x2-gap" viewBox="0 0 16 16">
<path d="M4 4v2H2V4zm1 7V9a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1m0-5V4a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1m5 5V9a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1m0-5V4a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1M9 4v2H7V4zm5 0h-2v2h2zM4 9v2H2V9zm5 0v2H7V9zm5 0v2h-2V9zm-3-5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zm1 4a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1z"/>
Expand Down Expand Up @@ -123,6 +147,7 @@ import { getTrialDataCached } from '@/plugins/datastore'
import { exportToGerminate, exportToShapefile, shareTrial } from '@/plugins/api'
import IconGerminate from '@/components/icons/IconGerminate.vue'
import IconBrapi from '@/components/icons/IconBrapi.vue'
import IconGridScore from '@/components/icons/IconGridScore.vue'
import TrialSynchronizationModal from '@/components/modals/TrialSynchronizationModal.vue'
import { downloadText, toLocalDateString, trialsDataToMatrix } from '@/plugins/misc'
import { DISPLAY_ORDER_LEFT_TO_RIGHT, DISPLAY_ORDER_TOP_TO_BOTTOM, TRIAL_EVENT_TYPE_MANAGEMENT, TRIAL_EVENT_TYPE_OTHER, TRIAL_EVENT_TYPE_WEATHER } from '@/plugins/constants'
Expand All @@ -136,6 +161,7 @@ export default {
BrapiExportSection,
IconGerminate,
IconBrapi,
IconGridScore,
TrialSynchronizationModal,
UseOnline
},
Expand Down Expand Up @@ -277,6 +303,41 @@ export default {
.catch(this.errorHandler)
}
},
toGerminateDataType: function (type) {
switch (type) {
case 'int':
case 'float':
case 'range':
return 'numeric'
default:
return type
}
},
exportTraitsGerminate: function () {
if (this.trial.traits && this.trial.traits.length > 0) {
let text = 'Name\tShort Name\tDescription\tData Type\tUnit Name\tUnit Abbreviation\tUnit Descriptions\tTrait categories (comma separated)\tMin (only for numeric traits)\tMax (only for numeric traits)'
this.trial.traits.forEach(t => {
text += `\n${t.name}\t\t${t.description || ''}\t${this.toGerminateDataType(t.dataType)}\t\t\t\t${(t.restrictions && t.restrictions.categories) ? ('[[' + t.restrictions.categories.join(',') + ']]') : ''}\t${(t.restrictions && t.restrictions.min !== undefined && t.restrictions.min !== null) ? t.restrictions.min : ''}\t${(t.restrictions && t.restrictions.max !== undefined && t.restrictions.max !== null) ? t.restrictions.max : ''}`
})
downloadText(text, `germinate-traits-${this.safeTrialName}.txt`)
}
},
exportTraitsGridScore: function () {
if (this.trial.traits && this.trial.traits.length > 0) {
const copy = JSON.parse(JSON.stringify(this.trial.traits))
copy.forEach(t => {
delete t.id
delete t.progress
delete t.editable
delete t.color
})
const text = JSON.stringify(copy, null, 2)
downloadText(text, `gridscore-traits-${this.safeTrialName}.txt`)
}
},
exportDataTab: function () {
emitter.emit('show-loading', true)
Expand Down

0 comments on commit 34811b1

Please sign in to comment.