diff options
| author | Paul-Christian Volkmer | 2026-06-11 08:11:11 +0200 |
|---|---|---|
| committer | GitHub | 2026-06-11 06:11:11 +0000 |
| commit | 7298078077d27380255ad5eb42a30876a4babede (patch) | |
| tree | 015f86e027a5ba8098cb52234965cb59f097d902 /src/main/kotlin/dev | |
| parent | 20d1182da9d8f9900d5580b8f4525847e03cbaba (diff) | |
feat: count follow-ups to update submission type (#297)
This is done in addition to the check by date.
The submission type will be set to "followup" if:
* It is not an initial submission
* There are follow-ups in submission content
* The date or the count is less than the last successful submission
In the database, existing requests will be initialized with
followup_count = -1.
Diffstat (limited to 'src/main/kotlin/dev')
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt | 1 | ||||
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt | 39 |
2 files changed, 23 insertions, 17 deletions
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt b/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt index a1f5c3d..67f450f 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt @@ -53,6 +53,7 @@ data class Request( @LastModifiedBy var updatedBy: String? = null, @Embedded.Nullable var report: Report? = null, @Column("submission_accepted") var submissionAccepted: Boolean = false, + @Column("followup_count") var followupCount: Int = 0, ) { constructor( uuid: RequestId, diff --git a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt index 4b7afff..00e6b73 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt @@ -120,14 +120,15 @@ class RequestProcessor( ) { requestService.save( Request( - request.requestId, - request.patientPseudonym(), - emptyPatientId(), - fingerprint(request), - RequestType.MTB_FILE, - submissionType, - RequestStatus.BLOCKED_INITIAL, - Tan(request.content.metadata?.transferTan.orEmpty()) + uuid = request.requestId, + patientPseudonym = request.patientPseudonym(), + pid = emptyPatientId(), + fingerprint = fingerprint(request), + type = RequestType.MTB_FILE, + submissionType = submissionType, + status = RequestStatus.BLOCKED_INITIAL, + tan = Tan(request.content.metadata?.transferTan.orEmpty()), + followupCount = request.content.followUps?.size ?: 0, ) ) // Exit - no further processing @@ -157,14 +158,15 @@ class RequestProcessor( requestService.save( Request( - request.requestId, - request.patientPseudonym(), - emptyPatientId(), - fingerprint(request), - RequestType.MTB_FILE, - submissionType, - RequestStatus.UNKNOWN, - Tan(request.content.metadata?.transferTan.orEmpty()), + uuid = request.requestId, + patientPseudonym = request.patientPseudonym(), + pid = emptyPatientId(), + fingerprint = fingerprint(request), + type = RequestType.MTB_FILE, + submissionType = submissionType, + status = RequestStatus.UNKNOWN, + tan = Tan(request.content.metadata?.transferTan.orEmpty()), + followupCount = request.content.followUps?.size ?: 0, ) ) @@ -207,7 +209,10 @@ class RequestProcessor( ?.sortedBy { it.date } ?.lastOrNull { it.date != null } ?: return false - return lastSuccessfulSubmission.processedAt.isBefore( lastFollowUp.date.toInstant()) + // Follow-up after last successful submission by date or ... + return lastSuccessfulSubmission.processedAt.isBefore(lastFollowUp.date.toInstant()) || + // ... more follow-ups than on last successful submission + lastSuccessfulSubmission.followupCount < (request.content.followUps?.size ?: 0) } private fun hasSuccessfulInitialSubmission(patientPseudonym: PatientPseudonym): Boolean { |
