Skip to content

Commit 16b079a

Browse files
committed
feat(data/biobank-directory): fixes Study model
1 parent e80fe09 commit 16b079a

File tree

6 files changed

+240
-4
lines changed

6 files changed

+240
-4
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<template>
2+
<div>
3+
<div class="d-flex">
4+
<report-description
5+
:description="study.description"
6+
:maxLength="500"
7+
></report-description>
8+
</div>
9+
10+
<!-- study information -->
11+
<view-generator :viewmodel="studyModel.viewmodel" />
12+
</div>
13+
</template>
14+
15+
<script>
16+
import { getStudyDetails } from "../../functions/viewmodelMapper";
17+
import ReportDescription from "../report-components/ReportDescription.vue";
18+
import ViewGenerator from "../generators/ViewGenerator.vue";
19+
20+
export default {
21+
name: "ReportStudyDetails",
22+
props: {
23+
study: {
24+
type: Object,
25+
required: true,
26+
},
27+
},
28+
components: {
29+
ReportDescription,
30+
ViewGenerator,
31+
},
32+
computed: {
33+
studyModel() {
34+
return this.study ? getStudyDetails(this.study) : {};
35+
},
36+
},
37+
};
38+
</script>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<template>
2+
<div class="col-md-4">
3+
<div class="card">
4+
<div class="card-body">
5+
<div class="card-text">
6+
<template v-if="info.also_known">
7+
<h5>Also Known In</h5>
8+
<ReportDetailsList :reportDetails="info.also_known" />
9+
</template>
10+
</div>
11+
</div>
12+
</div>
13+
</div>
14+
</template>
15+
16+
<script setup>
17+
import { toRefs } from "vue";
18+
import ReportDetailsList from "../../components/report-components/ReportDetailsList.vue";
19+
20+
const props = defineProps(["info"]);
21+
let { info } = toRefs(props);
22+
</script>
23+
24+
<style scoped>
25+
.right-content-list {
26+
list-style-type: none;
27+
margin-left: -2.5rem;
28+
}
29+
.right-content-list:not(:last-child) {
30+
margin-bottom: 1.5rem;
31+
}
32+
33+
.right-content-list li {
34+
margin-bottom: 0.5rem;
35+
}
36+
37+
.info-list {
38+
margin-bottom: 1rem;
39+
}
40+
41+
.cert-badge:not(:last-child) {
42+
margin-right: 1rem;
43+
}
44+
</style>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const initialStudyColumns = [
2+
{ label: "Id:", column: "id", type: "string", showCopyIcon: true },
3+
{ label: "Title:", column: "title", type: "string" },
4+
{ label: "Description:", column: "description", type: "string" },
5+
{ label: "Type:", column: "type", type: "string" },
6+
{ label: "Sex:", column: { sex: ["label"] }, type: "array" },
7+
{ label: "Number of subjects:", column: "number_of_subjects", type: "int" },
8+
{
9+
label: "Age:",
10+
type: "range",
11+
min: "age_high",
12+
max: "age_low",
13+
unit: "age_unit",
14+
unit_column: { age_unit: ["label"] },
15+
},
16+
{
17+
label: "Also Known In:",
18+
column: { also_known: ["name_system", "url"] },
19+
type: "xref",
20+
},
21+
];
22+
23+
export default initialStudyColumns;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { defineStore } from "pinia";
2+
import { QueryEMX2 } from "molgenis-components";
3+
import { useSettingsStore } from "./settingsStore";
4+
5+
export const useStudyStore = defineStore("studyStore", () => {
6+
const settingsStore = useSettingsStore();
7+
8+
const studyColumns = settingsStore.config.studyColumns;
9+
const graphqlEndpoint = settingsStore.config.graphqlEndpoint;
10+
11+
function getStudyColumns() {
12+
const properties = studyColumns
13+
.filter((column) => column.column)
14+
.flatMap((studyColumn) => studyColumn.column);
15+
16+
const rangeProperties = studyColumns.filter(
17+
(column) => column.type === "range"
18+
);
19+
20+
for (const property of rangeProperties) {
21+
properties.push(property.min, property.max, property.unit_column);
22+
}
23+
24+
return properties;
25+
}
26+
27+
async function getStudyReport(id) {
28+
const studyReportQuery = new QueryEMX2(graphqlEndpoint)
29+
.table("Studies")
30+
.select(getStudyColumns())
31+
.orderBy("Studies", "id", "asc")
32+
.where("id")
33+
.like(id);
34+
const reportResults = await studyReportQuery.execute();
35+
36+
return reportResults;
37+
}
38+
39+
return {
40+
getStudyColumns,
41+
getStudyReport,
42+
};
43+
});
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<template>
2+
<div class="container mg-network-report-card">
3+
<div
4+
v-if="!loaded"
5+
class="d-flex justify-content-center align-items-center spinner-container"
6+
>
7+
<Spinner />
8+
</div>
9+
<div v-else class="container-fluid">
10+
<div class="row">
11+
<div class="col my-3 shadow-sm d-flex p-2 align-items-center bg-white">
12+
<Breadcrumb
13+
class="directory-nav"
14+
:crumbs="{
15+
[uiText['home']]: '../#/',
16+
[study.title]: '/',
17+
}"
18+
/>
19+
</div>
20+
</div>
21+
22+
<div class="row" v-if="study">
23+
<div class="col">
24+
<report-title type="Study" :name="study.title" />
25+
<div class="container">
26+
<div class="row">
27+
<div class="container p-0">
28+
<div class="row">
29+
<div class="col-md-8">
30+
<report-study-details v-if="study" :study="study" />
31+
</div>
32+
<study-report-info-card :info="info" />
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
</div>
38+
</div>
39+
</div>
40+
</div>
41+
</template>
42+
43+
<script setup>
44+
import { Breadcrumb, Spinner } from "molgenis-components";
45+
import { computed, ref, watch } from "vue";
46+
import { useRoute } from "vue-router";
47+
import ReportStudyDetails from "../components/report-components/ReportStudyDetails.vue";
48+
import StudyReportInfoCard from "../components/report-components/StudyReportInfoCard.vue";
49+
import ReportTitle from "../components/report-components/ReportTitle.vue";
50+
import { studyReportInformation } from "../functions/viewmodelMapper";
51+
import { useStudyStore } from "../stores/studyStore";
52+
import { useSettingsStore } from "../stores/settingsStore";
53+
54+
const settingsStore = useSettingsStore();
55+
const studyStore = useStudyStore();
56+
57+
const route = useRoute();
58+
const study = ref({});
59+
60+
let loaded = ref(false);
61+
62+
loadStudyReport(route.params.id);
63+
64+
watch(route, async (route) => {
65+
loadStudyReport(route.params.id);
66+
});
67+
68+
const uiText = computed(() => settingsStore.uiText);
69+
70+
const studyDataAvailable = computed(() => {
71+
return Object.keys(study).length;
72+
});
73+
74+
const info = computed(() => {
75+
return studyDataAvailable.value ? studyReportInformation(study.value) : {};
76+
});
77+
78+
function loadStudyReport(id) {
79+
loaded.value = false;
80+
const studyPromise = studyStore.getStudyReport(id).then((result) => {
81+
study.value = result.Studies.length ? result.Studies[0] : {};
82+
});
83+
Promise.all([studyPromise]).then(() => {
84+
loaded.value = true;
85+
});
86+
}
87+
</script>

data/biobank-directory/molgenis.csv

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AlsoKnownIn,,id,ID,string,1,true,true,Unique ID.,,,,,,,,,
1212
AlsoKnownIn,,name_system,Name of the System,string,,true,,"Name of the source in which the biobank, collection or network also exists.",,,,,,,,,
1313
AlsoKnownIn,,pid,Persistent Identifier,string,,false,,"Persistent Identifier of the biobank, collection or network in the other source.",,,,,,,,,
1414
AlsoKnownIn,,url,URL,hyperlink,,true,,"Link to the biobank, collection or network in the other source.",,,,,,,,,
15-
AlsoKnownIn,,national_node,National Node,ref,,true,,"The biobank, collection or network where this also known In refers to originates from this national node.",,NationalNodes,,${description},,,,,
15+
AlsoKnownIn,,national_node,National Node,ref,,false,,"The biobank, collection or network where this also known In refers to originates from this national node.",,NationalNodes,,${description},,,,,
1616
AlsoKnownIn,,label,Name of the System,string,,false,true,"Name of the source in which the biobank, collection or network also exists.",,,,,,,,name_system,
1717
Biobanks,,,,,,,,"Description of the biobank organisation, like name, location, network, contact person, collaboration opportunities and quality assessments.",,,,,,,,,
1818
Biobanks,,id,ID,string,1,true,true,"Unique biobank ID within BBMRI-ERIC based on MIABIS 2.0 standard (ISO 3166-1 alpha-2 + underscore + biobank national ID or name), prefixed with bbmri-eric:ID: string - MIABIS-2.0-01.",,,,,,,,,
@@ -115,6 +115,7 @@ Collections,,access_joint_project,Access via Join Projects to,ontology_array,,fa
115115
Collections,,access_description,Access Description,text,,false,,Short description of the access rules.,,,,,,,,,
116116
Collections,,access_uri,Access URI,hyperlink,,false,,URI describing the access policy.,,,,,,,,,
117117
Collections,,sop,PD/SOPs,ontology_array,,false,,Availability of Process Descriptions (PDs) and/or Standard Operating Procedures (SOPs).,DirectoryOntologies,SOPs,,${label},,,,,
118+
Collections,,study,Study,ref,,false,,A link to a Study during which the collection was generated,,Studies,,,,,,,
118119
ContactPersonsNationalNodes,,,,,,,,Contact persons national nodes,,,,,,,,,
119120
ContactPersonsNationalNodes,,id,ID,string,1,true,true,Unique ID.,,,,,,,,,
120121
ContactPersonsNationalNodes,,first_name,First name,string,,false,,First name.,,,,,,,,,
@@ -167,10 +168,10 @@ Studies,,id,ID,string,1,true,,"Unique ID of the study, prefixed with bbmri-eric:
167168
Studies,,title,Title,text,,true,,The title of the study,,,,,,,,,
168169
Studies,,description,Description,text,,false,,A text describing the study,,,,,,,,,
169170
Studies,,type,Type,string,,false,,"The type of study (Observational, Interventional). This is a string imported from ECRIN",,,,,,,,,
170-
Studies,,sex,Sex,ontology_array,,false,,"The sex of the individuals that participated to the study",,SexTypes,,,,,,,
171+
Studies,,sex,Sex,ontology_array,,false,,"The sex of the individuals that participated to the study",DirectoryOntologies,SexTypes,,,,,,,
171172
Studies,,age_low,Age Low,int,,false,,Age of youngest sample donor at time of sample donation - MIABIS-2.0-10.,,,,,,,,,
172173
Studies,,age_high,Age High,int,,false,,Age of oldest sample donor at time of sample donation - MIABIS-2.0-11.,,,,,,,,,
173-
Studies,,age_unit,Age Unit,ontology,,false,,"Unit defining Age Low and Age High. Can be one of the following values: YEAR, MONTH, WEEK, DAY - MIABIS-2.0-08.",,AgeUnits,,${label},,,,,
174+
Studies,,age_unit,Age Unit,ontology,,false,,"Unit defining Age Low and Age High. Can be one of the following values: YEAR, MONTH, WEEK, DAY - MIABIS-2.0-08.",DirectoryOntologies,AgeUnits,,${label},,,,,
174175
Studies,,number_of_subjects,Number of subjects,int,,false,,"The number of subjects that participated to the study",,,,,,,,,
175176
Studies,,also_known,Also Known In,ref_array,,false,,The study also exists in …,,AlsoKnownIn,,${name_system},,,,,
176-
Studies,,collections,Collection,refback,,false,true,,,Collections,study,,,,,,
177+
Studies,,collections,Collections,refback,,false,true,,,Collections,study,,,,,,

0 commit comments

Comments
 (0)