1
0
mirror of https://github.com/pcvolkmer/etl-processor.git synced 2025-07-03 23:12:54 +00:00

feat: patient pid may be replaced with gPAS pseudonym, now.

This commit is contained in:
Jakub Lidke
2023-07-27 13:01:58 +02:00
parent 79d83ef04a
commit 90c5b81c2b
9 changed files with 302 additions and 30 deletions

View File

@ -45,7 +45,11 @@ data class PseudonymizeConfigProperties(
@ConfigurationProperties(GPasConfigProperties.NAME)
data class GPasConfigProperties(
val uri: String?,
val target: String = "etl-processor"
val target: String = "etl-processor",
val username: String?,
val password: String?,
val sslCaLocation: String?,
) {
companion object {
const val NAME = "app.pseudonymize.gpas"

View File

@ -24,20 +24,14 @@ import dev.dnpm.etl.processor.monitoring.ReportService
import dev.dnpm.etl.processor.output.KafkaMtbFileSender
import dev.dnpm.etl.processor.output.MtbFileSender
import dev.dnpm.etl.processor.output.RestMtbFileSender
import dev.dnpm.etl.processor.pseudonym.AnonymizingGenerator
import dev.dnpm.etl.processor.pseudonym.Generator
import dev.dnpm.etl.processor.pseudonym.GpasPseudonymGenerator
import dev.dnpm.etl.processor.pseudonym.PseudonymizeService
import org.reactivestreams.Publisher
import dev.dnpm.etl.processor.pseudonym.*
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.kafka.core.KafkaTemplate
import reactor.core.publisher.Flux
import reactor.core.publisher.Sinks
import java.net.URI
import java.time.Duration
@Configuration
@EnableConfigurationProperties(
@ -54,7 +48,7 @@ class AppConfiguration {
@ConditionalOnProperty(value = ["app.pseudonymizer"], havingValue = "GPAS")
@Bean
fun gpasPseudonymGenerator(configProperties: GPasConfigProperties): Generator {
return GpasPseudonymGenerator(URI.create(configProperties.uri!!), configProperties.target)
return GpasPseudonymGenerator(configProperties)
}
@ConditionalOnProperty(value = ["app.pseudonymizer"], havingValue = "BUILDIN", matchIfMissing = true)

View File

@ -35,21 +35,21 @@ class KafkaMtbFileSender(
override fun send(mtbFile: MtbFile): MtbFileSender.Response {
return try {
var result = kafkaTemplate.sendDefault(
val result = kafkaTemplate.sendDefault(
String.format(
"{\"pid\": \"%s\", \"eid\": \"%s\"}", mtbFile.patient.id,
mtbFile.episode.id
), objectMapper.writeValueAsString(mtbFile)
)
if (result.get() != null) {
logger.debug("Sent file via KafkaMtbFileSender");
MtbFileSender.Response(MtbFileSender.ResponseStatus.SUCCESS);
logger.debug("Sent file via KafkaMtbFileSender")
MtbFileSender.Response(MtbFileSender.ResponseStatus.SUCCESS)
} else {
MtbFileSender.Response(MtbFileSender.ResponseStatus.ERROR)
}
} catch (e: Exception) {
logger.error("An error occured sending to kafka", e)
logger.error("An error occurred sending to kafka", e)
MtbFileSender.Response(MtbFileSender.ResponseStatus.UNKNOWN)
}
}