1
0
mirror of https://github.com/pcvolkmer/grz-metadata-processor.git synced 2025-07-01 20:12:54 +00:00

feat: instant replace kit data

This commit is contained in:
2025-06-09 17:11:40 +02:00
parent 844717e2ce
commit 9f5b5f03df
8 changed files with 224 additions and 28 deletions

View File

@ -108,6 +108,7 @@ enum class ReferenceGenome(val value: String) {
}
interface LabDataRepository : CrudRepository<LabData, Long> {
fun getById(id: Long): LabData?
fun findByDonorId(donorId: Long): MutableList<LabData>
fun countLabDataByDonorIdIsNull(): Long
fun findByEinsendenummer(einsendenummer: String): LabData

View File

@ -18,7 +18,13 @@ class LabDataController(
fun getAllLabData(@PathVariable donorId: Long, model: Model): String {
model.addAttribute("labdatas", allLabDatasByDonorId(donorId))
model.addAttribute("labdataprofiles", labDataProfileRepository.findAll())
return "labdatas"
return "labdatas/index"
}
@GetMapping(path = ["{labdataId}/kits"])
fun getLabDataKits(@PathVariable labdataId: Long, model: Model): String {
model.addAttribute("labdata", labDataRepository.getById(labdataId))
return "labdatas/kits"
}
@PostMapping
@ -26,7 +32,7 @@ class LabDataController(
labDataRepository.save(LabData(donorId = donorId))
model.addAttribute("labdatas", allLabDatasByDonorId(donorId))
model.addAttribute("labdataprofiles", labDataProfileRepository.findAll())
return "labdatas"
return "labdatas/index"
}
@PutMapping(path = ["{labdataId}"])
@ -34,7 +40,7 @@ class LabDataController(
labDataRepository.save(labData)
model.addAttribute("labdatas", allLabDatasByDonorId(donorId))
model.addAttribute("labdataprofiles", labDataProfileRepository.findAll())
return "labdatas"
return "labdatas/index"
}
@DeleteMapping(path = ["{labdataId}"])
@ -42,7 +48,7 @@ class LabDataController(
labDataRepository.deleteById(labdataId)
model.addAttribute("labdatas", allLabDatasByDonorId(donorId))
model.addAttribute("labdataprofiles", labDataProfileRepository.findAll())
return "labdatas"
return "labdatas/index"
}
private fun allLabDatasByDonorId(donorId: Long): List<LabData> {

View File

@ -2,6 +2,7 @@ package dev.pcvolkmer.onco.grzmetadataprocessor.web
import dev.pcvolkmer.onco.grzmetadataprocessor.data.LabDataProfile
import dev.pcvolkmer.onco.grzmetadataprocessor.data.LabDataProfileRepository
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Controller
import org.springframework.ui.Model
import org.springframework.web.bind.annotation.*
@ -14,7 +15,6 @@ class LabDataProfileController(
@GetMapping
fun getAllLabDataProfiles(model: Model): String {
println(repository.findAll().sortedByDescending { it.id })
model.addAttribute("labdataprofiles", repository.findAll().sortedByDescending { it.id })
return "labdataprofiles"
}
@ -26,15 +26,21 @@ class LabDataProfileController(
return "labdataprofiles"
}
@GetMapping(path = ["{labdataProfileId}"])
fun getLabDataProfile(@PathVariable labdataProfileId: Long, model: Model): String {
model.addAttribute("profile", repository.findByIdOrNull(labdataProfileId))
return "labdataprofile"
}
@PutMapping(path = ["{labdataProfileId}"])
fun putLabData(@PathVariable labdataProfileId: Long, labDataProfile: LabDataProfile, model: Model): String {
fun putLabDataProfile(@PathVariable labdataProfileId: Long, labDataProfile: LabDataProfile, model: Model): String {
repository.save(labDataProfile)
model.addAttribute("labdataprofiles", repository.findAll().sortedByDescending { it.id })
return "labdataprofiles"
}
@DeleteMapping(path = ["{labdataProfileId}"])
fun deleteLabData(@PathVariable labdataProfileId: Long, model: Model): String {
fun deleteLabDataProfile(@PathVariable labdataProfileId: Long, model: Model): String {
repository.deleteById(labdataProfileId)
model.addAttribute("labdataprofiles", repository.findAll().sortedByDescending { it.id })
return "labdataprofiles"

View File

@ -2,7 +2,7 @@
<nav>
<b>Falldaten</b>
<ul>
<ul class="datamenu">
<li>
<a th:href="@{/}">
<span>Fallübersicht</span>
@ -23,7 +23,7 @@
</li>
</ul>
<b>Profile</b>
<ul>
<ul class="settingsmenu">
<li>
<a th:href="@{/labdataprofiles}">
<span>Sequenzierprofile</span>

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="de" xmlns="http://www.w3.org/1999/html" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div>
<label class="disabled">
Library Type
<select name="libraryType" disabled>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'panel'}" value="PANEL">panel</option>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'panel_lr'}" value="PANEL_LR">panel_lr</option>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'wes'}" value="WES">wes</option>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'wes_lr'}" value="WES_LR">wes_lr</option>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'wgs'}" value="WGS">wgs</option>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'wgs_lr'}" value="WGS_LR">wgs_lr</option>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'wxs'}" value="WXS">wxs</option>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'wxs_lr'}" value="WXS_LR">wxs_lr</option>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'other'}" value="OTHER">other</option>
<option th:selected="${profile.libraryType != null and profile.libraryType.value == 'unknown'}" value="UNKNOWN">unknown</option>
</select>
</label>
</div>
<div>
<label class="disabled">
Preparation Kit - Name
<input type="text" name="libraryPrepKit" th:value="${profile.libraryPrepKit}" disabled />
</label>
<label class="disabled">
Hersteller
<input type="text" name="libraryPrepKitManufacturer" th:value="${profile.libraryPrepKitManufacturer}" disabled />
</label>
</div>
<div>
<label class="disabled">
Sequencer - Modell
<input type="text" name="sequencerModel" th:value="${profile.sequencerModel}" disabled />
</label>
<label class="disabled">
Hersteller
<input type="text" name="sequencerManufacturer" th:value="${profile.sequencerManufacturer}" disabled />
</label>
</div>
<div>
<label class="disabled">
Kit - Name/Version
<input type="text" name="kitName" th:value="${profile.kitName}" disabled />
</label>
<label class="disabled">
Hersteller
<input type="text" name="kitManufacturer" th:value="${profile.kitManufacturer}" disabled />
</label>
</div>
<div>
<label class="disabled">
Enrichment Kit - Name und Version
<input type="text" name="enrichmentKit" th:value="${profile.enrichmentKit}" disabled />
</label>
<label class="disabled">
Hersteller
<select name="enrichmentKitManufacturer" disabled>
<option th:selected="${profile.enrichmentKitManufacturer != null and profile.enrichmentKitManufacturer.value == 'Illumuna'}" value="ILLUMINA">Illumina</option>
<option th:selected="${profile.enrichmentKitManufacturer != null and profile.enrichmentKitManufacturer.value == 'Agilent'}" value="AGILENT">Agilent</option>
<option th:selected="${profile.enrichmentKitManufacturer != null and profile.enrichmentKitManufacturer.value == 'Twist'}" value="TIST">Twist</option>
<option th:selected="${profile.enrichmentKitManufacturer != null and profile.enrichmentKitManufacturer.value == 'NEB'}" value="NEB">NEB</option>
<option th:selected="${profile.enrichmentKitManufacturer != null and profile.enrichmentKitManufacturer.value == 'other'}" value="OTHER">other</option>
<option th:selected="${profile.enrichmentKitManufacturer != null and profile.enrichmentKitManufacturer.value == 'unknown'}" value="UNKNOWN">unknown</option>
<option th:selected="${profile.enrichmentKitManufacturer != null and profile.enrichmentKitManufacturer.value == 'none'}" value="NONE">none</option>
</select>
</label>
</div>
</body>
</html>

View File

@ -93,14 +93,18 @@
<div>
<label class="optional">
Sequenzierprofil (Optionale Angabe)
<select name="profile">
<option value="">Kein Sequenzierprofil</option>
<option th:each="labdataprofile : ${labdataprofiles}" th:selected="${labdataprofile.id == labdata.profile}" th:value="${labdataprofile.id}" th:text="${labdataprofile.profileName}"></option>
<select name="profile" th:hx-target="${'#labdata_' + labdata.id + '_sequencerprofile'}">
<option value="" th:hx-get="@{/donors/{donorId}/labdatas/{labdataId}/kits(donorId=${donorId},labdataId=${labdata.id})}">Kein Sequenzierprofil</option>
<option th:each="labdataprofile : ${labdataprofiles}"
th:selected="${labdataprofile.id == labdata.profile}"
th:hx-get="@{/labdataprofiles/{labdataprofileId}(labdataprofileId=${labdataprofile.id})}"
th:value="${labdataprofile.id}"
th:text="${labdataprofile.profileName}"></option>
</select>
</label>
</div>
<th:block th:if="${labdata.profileData == null}">
<div th:if="${labdata.profileData == null}" th:id="${'labdata_' + labdata.id + '_sequencerprofile'}">
<div>
<label>
Library Type
@ -174,11 +178,11 @@
</select>
</label>
</div>
</th:block>
</div>
<th:block th:if="${labdata.profileData != null}">
<div th:if="${labdata.profileData != null}" th:id="${'labdata_' + labdata.id + '_sequencerprofile'}">
<div>
<label class="optional">
<label class="disabled">
Library Type
<select name="libraryType" disabled>
<option th:selected="${labdata.profileData.libraryType != null and labdata.profileData.libraryType.value == 'panel'}" value="PANEL">panel</option>
@ -196,48 +200,48 @@
</div>
<div>
<label class="optional">
<label class="disabled">
Preparation Kit - Name
<input type="text" name="libraryPrepKit" th:value="${labdata.profileData.libraryPrepKit}" disabled/>
</label>
<label class="optional">
<label class="disabled">
Hersteller
<input type="text" name="libraryPrepKitManufacturer" th:value="${labdata.profileData.libraryPrepKitManufacturer}" disabled/>
</label>
</div>
<div>
<label class="optional">
<label class="disabled">
Sequencer - Modell
<input type="text" name="sequencerModel" th:value="${labdata.profileData.sequencerModel}" disabled/>
</label>
<label class="optional">
<label class="disabled">
Hersteller
<input type="text" name="sequencerManufacturer" th:value="${labdata.profileData.sequencerManufacturer}" disabled/>
</label>
</div>
<div>
<label class="optional">
<label class="disabled">
Kit - Name/Version
<input type="text" name="kitName" th:value="${labdata.profileData.kitName}" disabled/>
</label>
<label class="optional">
<label class="disabled">
Hersteller
<input type="text" name="kitManufacturer" th:value="${labdata.profileData.kitManufacturer}" disabled/>
</label>
</div>
<div>
<label class="optional">
<label class="disabled">
Enrichment Kit - Name und Version
<input type="text" name="enrichmentKit" th:value="${labdata.profileData.enrichmentKit}" disabled />
</label>
<label class="optional">
<label class="disabled">
Hersteller
<select name="enrichmentKitManufacturer" disabled>
<option th:selected="${labdata.profileData.enrichmentKitManufacturer != null and labdata.profileData.enrichmentKitManufacturer.value == 'Illumina'}" value="ILLUMINA">Illumina</option>
@ -250,7 +254,7 @@
</select>
</label>
</div>
</th:block>
</div>
<div>
<label>

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="de" xmlns="http://www.w3.org/1999/html" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div>
<label>
Library Type
<select name="libraryType">
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'panel'}" value="PANEL">panel</option>
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'panel_lr'}" value="PANEL_LR">panel_lr</option>
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'wes'}" value="WES">wes</option>
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'wes_lr'}" value="WES_LR">wes_lr</option>
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'wgs'}" value="WGS">wgs</option>
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'wgs_lr'}" value="WGS_LR">wgs_lr</option>
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'wxs'}" value="WXS">wxs</option>
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'wxs_lr'}" value="WXS_LR">wxs_lr</option>
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'other'}" value="OTHER">other</option>
<option th:selected="${labdata.libraryType != null and labdata.libraryType.value == 'unknown'}" value="UNKNOWN">unknown</option>
</select>
</label>
</div>
<div>
<label>
Preparation Kit - Name
<input type="text" name="libraryPrepKit" th:value="${labdata.libraryPrepKit}" />
</label>
<label>
Hersteller
<input type="text" name="libraryPrepKitManufacturer" th:value="${labdata.libraryPrepKitManufacturer}" />
</label>
</div>
<div>
<label>
Sequencer - Modell
<input type="text" name="sequencerModel" th:value="${labdata.sequencerModel}" />
</label>
<label>
Hersteller
<input type="text" name="sequencerManufacturer" th:value="${labdata.sequencerManufacturer}" />
</label>
</div>
<div>
<label>
Kit - Name/Version
<input type="text" name="kitName" th:value="${labdata.kitName}" />
</label>
<label>
Hersteller
<input type="text" name="kitManufacturer" th:value="${labdata.kitManufacturer}" />
</label>
</div>
<div>
<label>
Enrichment Kit - Name und Version
<input type="text" name="enrichmentKit" th:value="${labdata.enrichmentKit}" />
</label>
<label>
Hersteller
<select name="enrichmentKitManufacturer">
<option th:selected="${labdata.enrichmentKitManufacturer != null and labdata.enrichmentKitManufacturer.value == 'Illumuna'}" value="ILLUMINA">Illumina</option>
<option th:selected="${labdata.enrichmentKitManufacturer != null and labdata.enrichmentKitManufacturer.value == 'Agilent'}" value="AGILENT">Agilent</option>
<option th:selected="${labdata.enrichmentKitManufacturer != null and labdata.enrichmentKitManufacturer.value == 'Twist'}" value="TIST">Twist</option>
<option th:selected="${labdata.enrichmentKitManufacturer != null and labdata.enrichmentKitManufacturer.value == 'NEB'}" value="NEB">NEB</option>
<option th:selected="${labdata.enrichmentKitManufacturer != null and labdata.enrichmentKitManufacturer.value == 'other'}" value="OTHER">other</option>
<option th:selected="${labdata.enrichmentKitManufacturer != null and labdata.enrichmentKitManufacturer.value == 'unknown'}" value="UNKNOWN">unknown</option>
<option th:selected="${labdata.enrichmentKitManufacturer != null and labdata.enrichmentKitManufacturer.value == 'none'}" value="NONE">none</option>
</select>
</label>
</div>
</body>
</html>

View File

@ -9,7 +9,7 @@ aside {
}
aside > .title {
@apply m-2 text-2xl font-bold
@apply my-2 text-2xl font-bold
}
aside > nav {
@ -17,10 +17,10 @@ aside > nav {
}
aside > nav ul {
@apply m-2
@apply my-2
}
aside > nav a:before {
aside > nav ul.datamenu a:before {
content: '🗎';
margin-right: 4px;
opacity: 0.8;
@ -28,6 +28,14 @@ aside > nav a:before {
text-align: center;
}
aside > nav ul.settingsmenu a:before {
content: '⚙';
margin-right: 4px;
opacity: 0.8;
width: 1.2em;
text-align: center;
}
aside > nav a:hover:before {
opacity: 1;
}
@ -94,6 +102,13 @@ label.optional select {
background: repeating-linear-gradient(135deg, var(--color-white), var(--color-white) 4px, transparent 4px, transparent 8px)
}
label.disabled input,
label.disabled select {
@apply text-gray-600;
font-style: normal;
background: repeating-linear-gradient(135deg, var(--color-white), var(--color-white) 4px, transparent 4px, transparent 8px)
}
input[type=text],
input[type=date],
input[type=number],