mirror of
https://github.com/pcvolkmer/mv64e-onkostar-data.git
synced 2025-09-13 16:02:52 +00:00
feat: add custom metadata request
This commit is contained in:
17
README.md
17
README.md
@@ -78,3 +78,20 @@ enthalten.
|
|||||||
|
|
||||||
Diese Liste der Gene unterliegt der folgenden Lizenz und ist frei
|
Diese Liste der Gene unterliegt der folgenden Lizenz und ist frei
|
||||||
verfügbar: [Creative Commons Public Domain (CC0) License](https://creativecommons.org/public-domain/cc0/).
|
verfügbar: [Creative Commons Public Domain (CC0) License](https://creativecommons.org/public-domain/cc0/).
|
||||||
|
|
||||||
|
## Zusätzliche Informationen
|
||||||
|
|
||||||
|
Weitere benötigte Informationen können ebenfalls abgerufen werden.
|
||||||
|
|
||||||
|
```java
|
||||||
|
var customMetadataMapper = new CustomMetadataDataMapper(
|
||||||
|
KpaCatalogue.create(new JdbcTemplate(datasource)),
|
||||||
|
PatientCatalogue.create(new JdbcTemplate(datasource))
|
||||||
|
);
|
||||||
|
|
||||||
|
var additional1 = customMetadataMapper.getByCaseId("16000123");
|
||||||
|
// oder
|
||||||
|
var additional2 = customMetadataMapper.getLatestByPatientIdAndTumorId("2000123456", 1);
|
||||||
|
```
|
||||||
|
|
||||||
|
Aktuell wird hier die Fallnummer und Krankenversicherungsnummer abgerufen.
|
||||||
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of mv64e-onkostar-data
|
||||||
|
*
|
||||||
|
* Copyright (C) 2025 Paul-Christian Volkmer
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.pcvolkmer.onco.datamapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom metadata containing additional information
|
||||||
|
*
|
||||||
|
* @author Paul-Christian Volkmer
|
||||||
|
* @since 0.1
|
||||||
|
*/
|
||||||
|
public class CustomMetadata {
|
||||||
|
|
||||||
|
private final String fallnummer;
|
||||||
|
private final String kvnr;
|
||||||
|
|
||||||
|
public CustomMetadata(String fallnummer, String kvnr) {
|
||||||
|
this.fallnummer = fallnummer;
|
||||||
|
this.kvnr = kvnr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFallnummer() {
|
||||||
|
return fallnummer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKvnr() {
|
||||||
|
return kvnr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of mv64e-onkostar-data
|
||||||
|
*
|
||||||
|
* Copyright (C) 2025 Paul-Christian Volkmer
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.pcvolkmer.onco.datamapper.mapper;
|
||||||
|
|
||||||
|
import dev.pcvolkmer.mv64e.mtb.Mtb;
|
||||||
|
import dev.pcvolkmer.onco.datamapper.CustomMetadata;
|
||||||
|
import dev.pcvolkmer.onco.datamapper.datacatalogues.KpaCatalogue;
|
||||||
|
import dev.pcvolkmer.onco.datamapper.datacatalogues.PatientCatalogue;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class to load and map custom metadata from database
|
||||||
|
*
|
||||||
|
* @author Paul-Christian Volkmer
|
||||||
|
* @since 0.1
|
||||||
|
*/
|
||||||
|
public class CustomMetadataDataMapper implements DataMapper<CustomMetadata> {
|
||||||
|
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
private final KpaCatalogue kpaCatalogue;
|
||||||
|
private final PatientCatalogue patientCatalogue;
|
||||||
|
|
||||||
|
public CustomMetadataDataMapper(final KpaCatalogue kpaCatalogue, final PatientCatalogue patientCatalogue) {
|
||||||
|
this.kpaCatalogue = kpaCatalogue;
|
||||||
|
this.patientCatalogue = patientCatalogue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CustomMetadata getById(int id) {
|
||||||
|
var kpaData = kpaCatalogue.getById(id);
|
||||||
|
var patientData = patientCatalogue.getById(kpaData.getInteger("patient_id"));
|
||||||
|
|
||||||
|
return new CustomMetadata(
|
||||||
|
kpaData.getString("fallnummermv"),
|
||||||
|
patientData.getString("verischerungsnummer")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads and maps using the case id
|
||||||
|
*
|
||||||
|
* @param caseId The case id
|
||||||
|
* @return The loaded Mtb file
|
||||||
|
*/
|
||||||
|
public CustomMetadata getByCaseId(String caseId) {
|
||||||
|
return this.getById(
|
||||||
|
this.kpaCatalogue.getProcedureIdByCaseId(caseId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads and maps using the patient id and tumor id
|
||||||
|
*
|
||||||
|
* @param patientId The patients id (not database id)
|
||||||
|
* @param tumorId The tumor identification
|
||||||
|
* @return The loaded Mtb file
|
||||||
|
*/
|
||||||
|
public CustomMetadata getLatestByPatientIdAndTumorId(String patientId, int tumorId) {
|
||||||
|
return this.getById(
|
||||||
|
this.kpaCatalogue
|
||||||
|
.getLatestProcedureIdByPatientIdAndTumor(patientId, tumorId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user