diff options
| author | Paul-Christian Volkmer | 2026-09-07 11:03:35 +0200 |
|---|---|---|
| committer | GitHub | 2026-09-07 09:03:35 +0000 |
| commit | 126ce65e344dbf8a7f4c2a4b2303312e5b0ca6e0 (patch) | |
| tree | 06941ba69f1402d7dc47dbe9228830d4e55cc54b /src/main/kotlin/dev/dnpm | |
| parent | 66a765b434210a6d90c1a28ed03f52d4454224bc (diff) | |
fix: handle possible missing start/end in FHIR period (#320)
Diffstat (limited to 'src/main/kotlin/dev/dnpm')
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt b/src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt index 5a31b42..f7df389 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt @@ -325,7 +325,18 @@ class ConsentProcessor( } } + /** + * Checks if the given request date is within the range specified by the provided period. + * + * @param requestDate The date to check, can be null. + * @param provPeriod The period containing the start and end dates for the range, where both `start` and `end` must not be null. + * @return `true` if the request date is within the range (inclusive of start and end), otherwise `false`. + */ fun isRequestDateInRange(requestDate: Date?, provPeriod: Period): Boolean { + if (null == requestDate || null == provPeriod.start || null == provPeriod.end) { + return false + } + val isRequestDateAfterOrEqualStart = provPeriod.start.compareTo(requestDate) val isRequestDateBeforeOrEqualEnd = provPeriod.end.compareTo(requestDate) return isRequestDateAfterOrEqualStart <= 0 && isRequestDateBeforeOrEqualEnd >= 0 |
