summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/dev/dnpm/etl/processor/consent/GicsConsentService.java23
-rw-r--r--src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java7
-rw-r--r--src/main/java/dev/dnpm/etl/processor/pseudonym/GpasPseudonymGenerator.java5
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/config/AppRestConfiguration.kt1
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/consent/ConsentEvaluator.kt12
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/input/KafkaInputListener.kt10
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt16
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/pseudonym/PseudonymizeService.kt8
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/web/StatisticsRestController.kt4
9 files changed, 52 insertions, 34 deletions
diff --git a/src/main/java/dev/dnpm/etl/processor/consent/GicsConsentService.java b/src/main/java/dev/dnpm/etl/processor/consent/GicsConsentService.java
index 4c8e820..0a00d1f 100644
--- a/src/main/java/dev/dnpm/etl/processor/consent/GicsConsentService.java
+++ b/src/main/java/dev/dnpm/etl/processor/consent/GicsConsentService.java
@@ -169,10 +169,9 @@ public class GicsConsentService extends AbstractConsentService {
new HttpEntity<>(parameterAsXml, this.headersWithHttpBasicAuth());
try {
var responseEntity =
- retryTemplate.execute(
- ctx ->
- restTemplate.exchange(
- endpointUri(endpoint), HttpMethod.POST, requestEntity, String.class));
+ retryTemplate.execute(ctx ->
+ restTemplate.exchange(
+ endpointUri(endpoint), HttpMethod.POST, requestEntity, String.class));
if (responseEntity.getStatusCode().is2xxSuccessful()) {
return responseEntity.getBody();
@@ -332,10 +331,8 @@ public class GicsConsentService extends AbstractConsentService {
consentAsOne
.getCategory()
- .removeIf(
- category ->
- category.hasCoding(
- "http://fhir.de/ConsentManagement/CodeSystem/ResultType", "policy"));
+ .removeIf(category ->
+ category.hasCoding("http://fhir.de/ConsentManagement/CodeSystem/ResultType", "policy"));
final var miiConsentCategory = new CodeableConcept();
miiConsentCategory.addCoding(
@@ -347,12 +344,10 @@ public class GicsConsentService extends AbstractConsentService {
gIcsResultBundle.getEntry().stream()
.skip(1)
- .forEach(
- c ->
- consentAsOne
- .getProvision()
- .addProvision(
- ((Consent) c.getResource()).getProvision().getProvisionFirstRep()));
+ .forEach(c ->
+ consentAsOne
+ .getProvision()
+ .addProvision(((Consent) c.getResource()).getProvision().getProvisionFirstRep()));
gIcsResultBundle.getEntry().clear();
gIcsResultBundle.addEntry(bundleEntryComponent);
diff --git a/src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java b/src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java
index fdf0a65..eb99ebf 100644
--- a/src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java
+++ b/src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java
@@ -129,10 +129,9 @@ public class GicsGetBroadConsentService extends AbstractConsentService {
}
final var response =
- this.retryTemplate.execute(
- retryContext ->
- this.restTemplate.exchange(
- uri, HttpMethod.GET, new HttpEntity<>(requestHeaders), String.class));
+ this.retryTemplate.execute(retryContext ->
+ this.restTemplate.exchange(
+ uri, HttpMethod.GET, new HttpEntity<>(requestHeaders), String.class));
if (response.getStatusCode().is2xxSuccessful()) {
return response.getBody();
} else {
diff --git a/src/main/java/dev/dnpm/etl/processor/pseudonym/GpasPseudonymGenerator.java b/src/main/java/dev/dnpm/etl/processor/pseudonym/GpasPseudonymGenerator.java
index b4641aa..2e8adf7 100644
--- a/src/main/java/dev/dnpm/etl/processor/pseudonym/GpasPseudonymGenerator.java
+++ b/src/main/java/dev/dnpm/etl/processor/pseudonym/GpasPseudonymGenerator.java
@@ -152,9 +152,8 @@ public class GpasPseudonymGenerator implements Generator {
try {
var targetUrl = buildRequestUrl(apiEndpoint);
ResponseEntity<String> responseEntity =
- retryTemplate.execute(
- ctx ->
- restTemplate.exchange(targetUrl, HttpMethod.POST, requestEntity, String.class));
+ retryTemplate.execute(ctx ->
+ restTemplate.exchange(targetUrl, HttpMethod.POST, requestEntity, String.class));
if (responseEntity.getStatusCode().is2xxSuccessful()) {
log.debug("API request succeeded. Response: {}", responseEntity.getStatusCode());
return responseEntity;
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/config/AppRestConfiguration.kt b/src/main/kotlin/dev/dnpm/etl/processor/config/AppRestConfiguration.kt
index 70cfca9..7965f96 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/config/AppRestConfiguration.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/config/AppRestConfiguration.kt
@@ -57,6 +57,7 @@ class AppRestConfiguration {
logger.info("Selected 'RestDipMtbFileSender'")
RestDipMtbFileSender(restTemplate, restTargetProperties, retryTemplate, reportService)
}
+
RestTargetType.NNGM -> {
logger.info("Selected 'RestNngmMtbFileSender'")
RestNngmMtbFileSender(restTemplate, restTargetProperties, retryTemplate, reportService)
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/consent/ConsentEvaluator.kt b/src/main/kotlin/dev/dnpm/etl/processor/consent/ConsentEvaluator.kt
index 1f867e8..cc5e54e 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/consent/ConsentEvaluator.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/consent/ConsentEvaluator.kt
@@ -36,11 +36,13 @@ class ConsentEvaluator(
ttpConsentStatus == TtpConsentStatus.BROAD_CONSENT_GIVEN ||
ttpConsentStatus == TtpConsentStatus.GENOM_DE_CONSENT_SEQUENCING_PERMIT ||
// Aktuell nur Modellvorhaben Consent im File
- ttpConsentStatus == TtpConsentStatus.UNKNOWN_CHECK_FILE &&
- mtbFile.metadata?.modelProjectConsent?.provisions?.any {
- it.purpose == ModelProjectConsentPurpose.SEQUENCING &&
- it.type == ConsentProvisionType.PERMIT
- } == true
+ (
+ ttpConsentStatus == TtpConsentStatus.UNKNOWN_CHECK_FILE &&
+ mtbFile.metadata?.modelProjectConsent?.provisions?.any {
+ it.purpose == ModelProjectConsentPurpose.SEQUENCING &&
+ it.type == ConsentProvisionType.PERMIT
+ } == true
+ )
return ConsentEvaluation(ttpConsentStatus, consentGiven)
}
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/input/KafkaInputListener.kt b/src/main/kotlin/dev/dnpm/etl/processor/input/KafkaInputListener.kt
index 51d093b..b752473 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/input/KafkaInputListener.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/input/KafkaInputListener.kt
@@ -43,8 +43,14 @@ class KafkaInputListener(
override fun onMessage(record: ConsumerRecord<String, String>) {
when (guessMimeType(record)) {
- MediaType.APPLICATION_JSON_VALUE -> handleDnpmV2Message(record)
- CustomMediaType.APPLICATION_VND_DNPM_V2_MTB_JSON_VALUE -> handleDnpmV2Message(record)
+ MediaType.APPLICATION_JSON_VALUE -> {
+ handleDnpmV2Message(record)
+ }
+
+ CustomMediaType.APPLICATION_VND_DNPM_V2_MTB_JSON_VALUE -> {
+ handleDnpmV2Message(record)
+ }
+
else -> {
// ignore other messages
}
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt b/src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt
index e198952..dd988ed 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt
@@ -51,13 +51,14 @@ class KafkaMtbFileSender(
record.headers().add("requestId", request.requestId.value.toByteArray())
record.headers().add("requestMethod", "POST".toByteArray())
when (request) {
- is DnpmV2MtbFileRequest ->
+ is DnpmV2MtbFileRequest -> {
record
.headers()
.add(
"contentType",
CustomMediaType.APPLICATION_VND_DNPM_V2_MTB_JSON_VALUE.toByteArray(),
)
+ }
}
val result = kafkaTemplate.send(record)
@@ -114,9 +115,16 @@ class KafkaMtbFileSender(
private fun key(request: MtbRequest): String =
when (request) {
- is DnpmV2MtbFileRequest -> "{\"pid\": \"${request.content.patient?.id}\"}"
- is DeleteRequest -> "{\"pid\": \"${request.patientId.value}\"}"
- else ->
+ is DnpmV2MtbFileRequest -> {
+ "{\"pid\": \"${request.content.patient?.id}\"}"
+ }
+
+ is DeleteRequest -> {
+ "{\"pid\": \"${request.patientId.value}\"}"
+ }
+
+ else -> {
throw IllegalArgumentException("Unsupported request type: ${request::class.simpleName}")
+ }
}
}
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/pseudonym/PseudonymizeService.kt b/src/main/kotlin/dev/dnpm/etl/processor/pseudonym/PseudonymizeService.kt
index c74345d..e8619bc 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/pseudonym/PseudonymizeService.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/pseudonym/PseudonymizeService.kt
@@ -32,9 +32,13 @@ class PseudonymizeService(
when (generator) {
is GpasPseudonymGenerator,
is VfpsPseudonymGenerator,
- -> PatientPseudonym(generator.generate(patientId.value))
- else ->
+ -> {
+ PatientPseudonym(generator.generate(patientId.value))
+ }
+
+ else -> {
PatientPseudonym("${configProperties.prefix}_${generator.generate(patientId.value)}")
+ }
}
fun genomDeTan(patientId: PatientId): String = generator.generateGenomDeTan(patientId.value)
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/web/StatisticsRestController.kt b/src/main/kotlin/dev/dnpm/etl/processor/web/StatisticsRestController.kt
index 3ea9667..bba2b2a 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/web/StatisticsRestController.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/web/StatisticsRestController.kt
@@ -49,11 +49,15 @@ class StatisticsRestController(
private fun statusColor(status: RequestStatus) =
when (status) {
RequestStatus.ERROR -> "#FF0000"
+
RequestStatus.WARNING -> "#FF8C00"
+
RequestStatus.SUCCESS -> "#008000"
+
RequestStatus.NO_CONSENT,
RequestStatus.BLOCKED_INITIAL,
-> "#004A9D"
+
else -> "#708090"
}