summaryrefslogtreecommitdiff
path: root/src/main/kotlin/dev/dnpm/etl/processor/config/AppConfigProperties.kt
blob: 01bab3294cf0dfb25f27431a1fec35a3a778db7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 * This file is part of ETL-Processor
 *
 * Copyright (c) 2023       Comprehensive Cancer Center Mainfranken
 * Copyright (c) 2025-2026  Paul-Christian Volkmer, Datenintegrationszentrum Philipps-Universität Marburg and Contributors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package dev.dnpm.etl.processor.config

import dev.dnpm.etl.processor.security.Role
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty

@ConfigurationProperties(AppConfigProperties.NAME)
data class AppConfigProperties(
    var transformations: List<TransformationProperties> = listOf(),
    var maxRetryAttempts: Int = 3,
    var duplicationDetection: Boolean = true,
    var genomDeTestSubmission: Boolean = false,
    var postInitialSubmissionBlock: Boolean = false,
) {
    companion object {
        const val NAME = "app"
    }
}

@ConfigurationProperties(PseudonymizeConfigProperties.NAME)
data class PseudonymizeConfigProperties(
    var generator: PseudonymGenerator = PseudonymGenerator.BUILDIN,
    val prefix: String = "UNKNOWN",
) {
    companion object {
        const val NAME = "app.pseudonymize"
    }
}

@ConfigurationProperties(GPasConfigProperties.NAME)
data class GPasConfigProperties(
    val uri: String?,
    val soapEndpoint: String?,
    @get:DeprecatedConfigurationProperty(since = "0.12") val pidDomain: String?,
    val patientDomain: String = pidDomain ?: "etl-processor",
    val genomDeTanDomain: String = "ccdn",
    val username: String?,
    val password: String?,
) {
    companion object {
        const val NAME = "app.pseudonymize.gpas"
    }
}

@ConfigurationProperties(ConsentConfigProperties.NAME)
data class ConsentConfigProperties(
    var service: ConsentService = ConsentService.NONE,
) {
    companion object {
        const val NAME = "app.consent"
    }
}

@ConfigurationProperties(GIcsConfigProperties.NAME)
data class GIcsConfigProperties(
    /** Base URL to gICS System */
    val uri: String?,
    val username: String? = null,
    val password: String? = null,
    /**
     * gICS specific system
     * *
     */
    val personIdentifierSystem: String =
        "https://ths-greifswald.de/fhir/gics/identifiers/Patienten-ID",
    /** Domain of broad consent resources */
    val broadConsentDomainName: String = "MII",
    /** Domain of Modelvorhaben 64e consent resources */
    val genomDeConsentDomainName: String? = null,
    /** Value to expect in case of positiv consent */
    val broadConsentPolicyCode: String = "2.16.840.1.113883.3.1937.777.24.5.3.6",
    /** Consent Policy which should be used for consent check */
    val broadConsentPolicySystem: String = "urn:oid:2.16.840.1.113883.3.1937.777.24.5.3",
    /** Consent Policy uri for MII Broad Consent Version */
    val broadConsentPolicyUri: String = "urn:oid:2.16.840.1.113883.3.1937.777.24.2.1790",
    /** Value to expect in case of positiv consent */
    val genomeDePolicyCode: String = "sequencing",
    /** Consent Policy which should be used for consent check */
    val genomeDePolicySystem: String =
        "https://ths-greifswald.de/fhir/CodeSystem/gics/Policy/GenomDE_MV",
    /** Consent version (fixed version) */
    val genomeDeConsentVersion: String = "2.0",
) {
    companion object {
        const val NAME = "app.consent.gics"
    }
}

@ConfigurationProperties(RestTargetProperties.NAME)
data class RestTargetProperties(
    val uri: String?,
    val username: String?,
    val password: String?,
) {
    companion object {
        const val NAME = "app.rest"
    }
}

@ConfigurationProperties(KafkaProperties.NAME)
data class KafkaProperties(
    val inputTopic: String?,
    val outputTopic: String = "etl-processor",
    val outputResponseTopic: String = "${outputTopic}_response",
    val groupId: String = "${outputTopic}_group",
    val servers: String = "",
) {
    companion object {
        const val NAME = "app.kafka"
    }
}

@ConfigurationProperties(SecurityConfigProperties.NAME)
data class SecurityConfigProperties(
    val adminUser: String?,
    val adminPassword: String?,
    val enableTokens: Boolean = false,
    val enableOidc: Boolean = false,
    val defaultNewUserRole: Role = Role.USER,
    val users: List<UserProperties> = listOf(),
) {
    companion object {
        const val NAME = "app.security"
    }
}

data class UserProperties(
    val username: String,
    val password: String,
)

enum class PseudonymGenerator {
    BUILDIN,
    GPAS,
}

enum class ConsentService {
    NONE,
    GICS,
    GICS_GET_BC,
}

data class TransformationProperties(
    val path: String,
    val from: String,
    val to: String,
)