1
0
mirror of https://github.com/pcvolkmer/mv64e-onkostar-data.git synced 2025-09-13 07:52:52 +00:00

feat: add model project consent to mv metadata

This commit is contained in:
2025-07-12 20:29:26 +02:00
parent 15009c0015
commit a6ba6c54e2
4 changed files with 35 additions and 13 deletions

View File

@@ -99,6 +99,10 @@ public class DataCatalogueFactory {
return RebiopsieCatalogue.create(jdbcTemplate);
} else if (c == ReevaluationCatalogue.class) {
return ReevaluationCatalogue.create(jdbcTemplate);
} else if (c == ConsentMvCatalogue.class) {
return ConsentMvCatalogue.create(jdbcTemplate);
} else if (c == ConsentMvVerlaufCatalogue.class) {
return ConsentMvVerlaufCatalogue.create(jdbcTemplate);
}
throw new DataCatalogueCreationException(clazz);
});

View File

@@ -60,15 +60,18 @@ public class ConsentMvDataMapper implements DataMapper<ModelProjectConsent> {
*/
@Override
public ModelProjectConsent getById(int id) {
var data = catalogue.getById(id);
try {
var data = catalogue.getById(id);
var builder = ModelProjectConsent.builder();
builder
.date(data.getDate("date"))
.version(getLatestVersion(id))
.provisions(getProvisions(data))
;
return builder.build();
var builder = ModelProjectConsent.builder();
builder
.version(getLatestVersion(id))
.provisions(getProvisions(data))
;
return builder.build();
} catch (Exception e) {
return null;
}
}
private String getLatestVersion(int id) {

View File

@@ -20,9 +20,7 @@
package dev.pcvolkmer.onco.datamapper.mapper;
import dev.pcvolkmer.mv64e.mtb.Mtb;
import dev.pcvolkmer.mv64e.mtb.Reference;
import dev.pcvolkmer.mv64e.mtb.TumorSpecimen;
import dev.pcvolkmer.mv64e.mtb.*;
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
import dev.pcvolkmer.onco.datamapper.datacatalogues.*;
import dev.pcvolkmer.onco.datamapper.exceptions.DataAccessException;
@@ -139,6 +137,11 @@ public class MtbDataMapper implements DataMapper<Mtb> {
propertyCatalogue
);
var consentMvDataMapper = new ConsentMvDataMapper(
catalogueFactory.catalogue(ConsentMvCatalogue.class),
catalogueFactory.catalogue(ConsentMvVerlaufCatalogue.class)
);
var resultBuilder = Mtb.builder();
try {
@@ -194,8 +197,19 @@ public class MtbDataMapper implements DataMapper<Mtb> {
.ngsReports(
kpaMolekulargenetikDataMapper.getAllByKpaId(kpaId)
)
;
// Consent - as far as present
var consentId = kpaCatalogue.getById(kpaId).getString("consentmv64e");
if (null != consentId) {
resultBuilder.metadata(
MvhMetadata.builder()
.modelProjectConsent(
consentMvDataMapper.getById(kpaCatalogue.getById(kpaId).getInteger("consentmv64e"))
)
.build()
);
}
} catch (DataAccessException e) {
logger.error("Error while getting Mtb.", e);
}

View File

@@ -104,7 +104,8 @@ class ConsentMvDataMapperTest {
var actual = this.dataMapper.getById(1);
assertThat(actual).isInstanceOf(ModelProjectConsent.class);
assertThat(actual.getDate()).isEqualTo(Date.from(Instant.parse("2025-07-12T00:00:00Z")));
// Intentionally left blank/null
assertThat(actual.getDate()).isNull();
assertThat(actual.getVersion()).isEqualTo("02");
assertThat(actual.getProvisions()).hasSize(3);
assertThat(actual.getProvisions()).containsAll(