mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-04-19 17:26:51 +00:00
Do not return specific status code based on remote status code
This commit is contained in:
parent
51cf7a7917
commit
35cb258b13
@ -42,7 +42,7 @@ class RequestProcessor(
|
||||
|
||||
private val logger = LoggerFactory.getLogger(RequestProcessor::class.java)
|
||||
|
||||
fun processMtbFile(mtbFile: MtbFile): RequestStatus {
|
||||
fun processMtbFile(mtbFile: MtbFile) {
|
||||
val pid = mtbFile.patient.id
|
||||
val pseudonymized = pseudonymizeService.pseudonymize(mtbFile)
|
||||
|
||||
@ -62,7 +62,7 @@ class RequestProcessor(
|
||||
)
|
||||
)
|
||||
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
||||
return RequestStatus.DUPLICATION
|
||||
return
|
||||
}
|
||||
|
||||
val request = MtbFileSender.MtbFileRequest(UUID.randomUUID().toString(), pseudonymized)
|
||||
@ -115,11 +115,9 @@ class RequestProcessor(
|
||||
)
|
||||
|
||||
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
||||
|
||||
return requestStatus
|
||||
}
|
||||
|
||||
fun processDeletion(patientId: String): RequestStatus {
|
||||
fun processDeletion(patientId: String) {
|
||||
val requestId = UUID.randomUUID().toString()
|
||||
|
||||
try {
|
||||
@ -178,10 +176,6 @@ class RequestProcessor(
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
||||
|
||||
return overallRequestStatus
|
||||
} catch (e: Exception) {
|
||||
requestRepository.save(
|
||||
Request(
|
||||
@ -194,11 +188,8 @@ class RequestProcessor(
|
||||
report = Report("Fehler bei der Pseudonymisierung")
|
||||
)
|
||||
)
|
||||
|
||||
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
||||
|
||||
return RequestStatus.ERROR
|
||||
}
|
||||
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
||||
}
|
||||
|
||||
private fun fingerprint(mtbFile: MtbFile): String {
|
||||
|
@ -20,7 +20,6 @@
|
||||
package dev.dnpm.etl.processor.web
|
||||
|
||||
import de.ukw.ccc.bwhc.dto.MtbFile
|
||||
import dev.dnpm.etl.processor.monitoring.RequestStatus
|
||||
import dev.dnpm.etl.processor.services.RequestProcessor
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.http.ResponseEntity
|
||||
@ -35,24 +34,16 @@ class MtbFileController(
|
||||
|
||||
@PostMapping(path = ["/mtbfile"])
|
||||
fun mtbFile(@RequestBody mtbFile: MtbFile): ResponseEntity<Void> {
|
||||
val requestStatus = requestProcessor.processMtbFile(mtbFile)
|
||||
|
||||
return if (requestStatus == RequestStatus.ERROR) {
|
||||
ResponseEntity.unprocessableEntity().build()
|
||||
} else {
|
||||
ResponseEntity.noContent().build()
|
||||
}
|
||||
logger.debug("Accepted MTB File for processing")
|
||||
requestProcessor.processMtbFile(mtbFile)
|
||||
return ResponseEntity.accepted().build()
|
||||
}
|
||||
|
||||
@DeleteMapping(path = ["/mtbfile/{patientId}"])
|
||||
fun deleteData(@PathVariable patientId: String): ResponseEntity<Void> {
|
||||
val requestStatus = requestProcessor.processDeletion(patientId)
|
||||
|
||||
return if (requestStatus == RequestStatus.ERROR) {
|
||||
ResponseEntity.unprocessableEntity().build()
|
||||
} else {
|
||||
ResponseEntity.noContent().build()
|
||||
}
|
||||
logger.debug("Accepted patient ID to process deletion")
|
||||
requestProcessor.processDeletion(patientId)
|
||||
return ResponseEntity.accepted().build()
|
||||
}
|
||||
|
||||
}
|
@ -3,5 +3,7 @@ spring:
|
||||
bootstrap-servers: ${app.kafka.servers}
|
||||
template:
|
||||
default-topic: ${app.kafka.topic}
|
||||
consumer:
|
||||
group-id: ${app.kafka.group-id}
|
||||
flyway:
|
||||
locations: "classpath:db/migration/{vendor}"
|
Loading…
x
Reference in New Issue
Block a user