GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( be813a...3d8811 )
by P.R.
06:43 queued 46s
created

Subtraject.telling_zorg_activiteit_cluster()   A

Complexity

Conditions 2

Size

Total Lines 22
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 11
nop 4
dl 0
loc 22
ccs 5
cts 5
cp 1
crap 2
rs 9.85
c 0
b 0
f 0
1
"""
2
Kerapu
3
"""
4 1
from typing import Optional
5
6 1
from kerapu import clean_code, LEN_ZORG_ACTIVITEIT_CODE, LEN_ZORG_PRODUCT_GROEP_CODE, LEN_ZORG_PRODUCT_CODE
7 1
from kerapu.lbz.Diagnose import Diagnose
8 1
from kerapu.lbz.Patient import Patient
9 1
from kerapu.lbz.Specialisme import Specialisme
10 1
from kerapu.lbz.ZorgActiviteit import ZorgActiviteit
11 1
from kerapu.lbz.ZorgInstelling import ZorgInstelling
12 1
from kerapu.lbz.ZorgType import ZorgType
13 1
from kerapu.lbz.ZorgVraag import ZorgVraag
14
15
16 1
class Subtraject:
17
    """
18
    Klasse voor subtrajecten.
19
    """
20
21
    # ------------------------------------------------------------------------------------------------------------------
22 1
    def __init__(self,
23
                 subtraject_nummer: str,
24
                 specialisme_code: str,
25
                 diagnose_code: str,
26
                 zorg_type_code: str,
27
                 zorg_vraag_code: str,
28
                 begin_datum: str,
29
                 geboorte_datum: str,
30
                 geslacht_code: str,
31
                 zorg_instelling_code: str):
32
        """
33
        Object constructor.
34
35
        :param str subtraject_nummer: Het substrajectnummer.
36
        :param str specialisme_code: Het (uitvoerend)specialismecode.
37
        :param str diagnose_code:  De Diagnosecode.
38
        :param str zorg_type_code: Het zorgtypecode.
39
        :param str zorg_vraag_code: De zorgvraagcode.
40
        :param str begin_datum:  De begindatum van het subtraject.
41
        :param str geboorte_datum: De geboortedatum van de patient.
42
        :param str geslacht_code: De code voor het geslacht van de patient.
43
        :param str zorg_instelling_code: De AGB-code van de uitvoerende zorginstelling.
44
        """
45 1
        self.__subtraject_nummer = subtraject_nummer
46
        """
47
        Het subtrajectnummer.
48
        """
49
50 1
        self.__specialisme = Specialisme(specialisme_code)
51
        """
52
        Het uitvoerend specialisme.
53
        """
54
55 1
        self.__begin_datum = begin_datum
56
        """
57
        De begindatum van het subtraject.
58
        """
59
60 1
        self.__patient = Patient(geboorte_datum, geslacht_code)
61
        """
62
        De patient.
63
        """
64
65 1
        self.__zorg_instelling = ZorgInstelling(zorg_instelling_code)
66
        """
67
        De zorginstelling.
68
        """
69
70 1
        self.__zorg_type = ZorgType(specialisme_code, zorg_type_code)
71
        """
72
        Het zorgtype.
73
        """
74
75 1
        self.__zorg_vraag = ZorgVraag(specialisme_code, zorg_vraag_code)
76
        """
77
        De zorgvraag.
78
        """
79
80 1
        self.__diagnose = Diagnose(specialisme_code, diagnose_code)
81
        """
82
        De diagnose.
83
        """
84
85 1
        self.__zorg_activiteiten = []
86
        """
87
        De zorgactiviteiten.
88
89
        :type: list[kerapu.lbz.ZorgActiviteit.ZorgActiviteit]
90
        """
91
92 1
        self.__zorg_product_code = None
93
        """
94
        De zorgproductcode (zoals afgeleid door Kerapu).
95
96
        :type: str|None
97
        """
98
99 1
        self.__zorg_product_groep_code = None
100 1
        """
101
        De zorgproductgroepcode (zoals afgeleid door Kerapu).
102
103
        :type: str|None
104
        """
105
106
    # ------------------------------------------------------------------------------------------------------------------
107 1
    def add_zorg_activiteit(self, zorg_activiteit_code: str, aantal: int):
108
        """
109
        Voegt een zorgactiviteit toe and dit subtraject.
110
111
        :param str zorg_activiteit_code: De zorgactiviteitcode.
112
        :param int aantal: Het aantal malen (of eenheden) dat de zorgactiviteit is uitgevoerd.
113
        """
114 1
        self.__zorg_activiteiten.append(ZorgActiviteit(zorg_activiteit_code, aantal))
115
116
    # ------------------------------------------------------------------------------------------------------------------
117 1
    @property
118 1
    def begin_datum(self) -> str:
119
        """
120
        Geeft de begindatum van dit subtraject.
121
122
        :rtype: str
123
        """
124 1
        return self.__begin_datum
125
126
    # ------------------------------------------------------------------------------------------------------------------
127 1
    @property
128 1
    def leeftijd(self) -> int:
129
        """
130
        Geeft de leeftijd van de patient van dit subtraject.
131
132
        :rtype: int
133
        """
134 1
        return self.__patient.leeftijd(self.__begin_datum)
135
136
    # ------------------------------------------------------------------------------------------------------------------
137 1
    @property
138 1
    def subtraject_nummer(self) -> str:
139
        """
140
        Geeft het subtrajectnummer van dit subtraject.
141
142
        :rtype: str
143
        """
144 1
        return self.__subtraject_nummer
145
146
    # ------------------------------------------------------------------------------------------------------------------
147 1
    def telling_behandel_klasse(self, behandel_klasse_code: str, weeg_factor_nummer: int) -> int:
148
        """
149
        Geeft het aantal zorgactiviteiten (met inachtneming van weegfactor) dat in dit subtraject voorkomt in een
150
        behandelklasse.
151
152
        :param str behandel_klasse_code: De behandelklassecode waartegen getest moet worden.
153
        :param int weeg_factor_nummer: Het weegfactornummer (0..2).
154
155
        :rtype: int
156
        """
157 1
        aantal = 0
158 1
        for zorg_activiteit in self.__zorg_activiteiten:
159 1
            aantal += zorg_activiteit.behandel_klasse_aantal(self.__zorg_product_groep_code,
160
                                                             behandel_klasse_code,
161
                                                             weeg_factor_nummer,
162
                                                             self.__begin_datum)
163
164 1
        return aantal
165
166
    # ------------------------------------------------------------------------------------------------------------------
167 1
    def telling_diagnose_attribuut(self, diagnose_attribuut_code: str) -> int:
168
        """
169
        Geeft het aantal malen (d.w.z. 0 of 1) dat de diagnose van dit subtraject voldoet aan een
170
        (specialismecode, diagnosecode) combinatie.
171
172
        :param str diagnose_attribuut_code: De attribuutcode voor de (specialismecode, diagnosecode) combinatie.
173
174
        :rtype: int
175
        """
176 1
        return self.__diagnose.diagnose_attribute_aantal(diagnose_attribuut_code, self.__begin_datum)
177
178
    # ------------------------------------------------------------------------------------------------------------------
179 1
    def telling_diagnose_cluster(self, cluster_code: str, cluster_nummer: int) -> int:
180
        """
181
        Geeft het aantal malen (d.w.z. 0 of 1) dat in dit subtraject voldoet aan een diagnoseclustercode.
182
183
        :param str cluster_code: De cluster_code waartegen getest moet worden.
184
        :param int cluster_nummer: Het clusternummer (1..6).
185
186
        :rtype: int
187
        """
188 1
        return self.__diagnose.diagnose_cluster_aantal(cluster_code, cluster_nummer, self.__begin_datum)
189
190
    # ------------------------------------------------------------------------------------------------------------------
191 1
    def telling_geslacht_code(self, geslacht_code: str) -> int:
192
        """
193
        Geeft het aantal malen (d.w.z. 0 of 1) dat de patient van dit subtraject voldoet aan een geslacht.
194
195
        :param str geslacht_code: De geslachtscode waartegen getest moet worden.
196
197
        :rtype: int
198
        """
199 1
        if self.__patient.geslacht_code == geslacht_code:
200 1
            return 1
201
202 1
        return 0
203
204
    # ------------------------------------------------------------------------------------------------------------------
205 1
    def telling_specialisme(self, specialisme_code: str) -> int:
206
        """
207
        Geeft het aantal malen (d.w.z. 0 of 1) dat het uitvoerend specialisme van dit subtraject voldoet aan een
208
        specialismecode.
209
210
        :param str specialisme_code: De specialismecode.
211
212
        :rtype: int
213
        """
214 1
        return self.__specialisme.specialisme_aantal(specialisme_code, self.__begin_datum)
215
216
    # ------------------------------------------------------------------------------------------------------------------
217 1
    def telling_specialisme_cluster(self, cluster_code: str, cluster_nummer: int) -> int:
218
        """
219
        Geeft het aantal malen (d.w.z. 0 of 1) dat het uitvoerend specialisme van dit subtraject voldoet aan een
220
        specialismecluster.
221
222
        :param str cluster_code: De clustercode waartegen getest moet worden.
223
        :param int cluster_nummer: Het clusternummer (1..2).
224
225
        :rtype: int
226
        """
227 1
        return self.__specialisme.specialisme_cluster_aantal(cluster_code, cluster_nummer, self.__begin_datum)
228
229
    # ------------------------------------------------------------------------------------------------------------------
230 1
    def telling_zorg_activiteit(self, zorg_activiteit_code: str, weeg_factor_nummer: int) -> int:
231
        """
232
        Geeft het aantal zorgactiviteiten (met inachtneming van weegfactor) dat in dit subtraject voldoet aan een
233
        zorgactiviteitcode.
234
235
        :param str zorg_activiteit_code: De zorgactiviteitcode.
236
        :param int weeg_factor_nummer: Het weegfactornummer (0..2).
237
238
        :rtype: int
239
        """
240 1
        aantal = 0
241 1
        zorg_activiteit_code = clean_code(zorg_activiteit_code, LEN_ZORG_ACTIVITEIT_CODE)
242 1
        for zorg_activiteit in self.__zorg_activiteiten:
243 1
            aantal += zorg_activiteit.zorg_activiteit_aantal(zorg_activiteit_code,
244
                                                             weeg_factor_nummer,
245
                                                             self.__begin_datum)
246
247 1
        return aantal
248
249
    # ------------------------------------------------------------------------------------------------------------------
250 1
    def telling_zorg_activiteit_cluster(self,
251
                                        cluster_code: str,
252
                                        cluster_nummer: int,
253
                                        weeg_factor_nummer: int) -> int:
254
        """
255
        Geeft het aantal zorgactiviteiten (met inachtneming van weegfactor) dat in dit subtraject voorkomt in een
256
        zorgactiviteitcluster.
257
258
        :param str cluster_code: De zorgactiviteitclustercode.
259
        :param int cluster_nummer: Het clusternummer (1..10).
260
        :param int weeg_factor_nummer: Het weegfactornummer (0..2).
261
262
        :rtype: int
263
        """
264 1
        aantal = 0
265 1
        for zorg_activiteit in self.__zorg_activiteiten:
266 1
            aantal += zorg_activiteit.zorg_activiteit_cluster_aantal(cluster_code,
267
                                                                     cluster_nummer,
268
                                                                     weeg_factor_nummer,
269
                                                                     self.__begin_datum)
270
271 1
        return aantal
272
273
    # ------------------------------------------------------------------------------------------------------------------
274 1
    def telling_zorg_instelling(self, agb_code: str) -> int:
275
        """
276
        Geeft het aantal malen (d.w.z. 0 of 1) dat de zorginstelling van dit subtraject voldoet aan AGB-code.
277
278
        :param str agb_code: De AGB-code waaraan de zorginstelling moet voldoen.
279
280
        :rtype: int
281
        """
282 1
        return self.__zorg_instelling.zorg_instelling_aantal(agb_code)
283
284
    # ------------------------------------------------------------------------------------------------------------------
285 1
    def telling_zorg_type_attribuut(self, zorg_type_attribuut_code: str) -> int:
286
        """
287
        Geeft het aantal malen (d.w.z. 0 of 1) dat de zorgtype van dit subtraject voldoet aan een
288
        (specialismecode, zorgtypecode) combinatie.
289
290
        :param str zorg_type_attribuut_code: De attribuutcode voor de (specialismecode, zorgtypecode) combinatie.
291
292
        :rtype: int
293
        """
294 1
        return self.__zorg_type.zorg_type_attribute_aantal(zorg_type_attribuut_code, self.__begin_datum)
295
296
    # ------------------------------------------------------------------------------------------------------------------
297 1
    def telling_zorg_vraag_attribuut(self, zorg_vraag_attribuut_code: str) -> int:
298
        """
299
        Geeft het aantal malen (d.w.z. 0 of 1) dat de zorgvraag van dit subtraject voldoet aan een
300
        (specialismecode, zorgvraagcode) combinatie.
301
302
        :param str zorg_vraag_attribuut_code: De attribuutcode voor de (specialismecode, zorgvraagcode) combinatie.
303
304
        :rtype: int
305
        """
306 1
        return self.__zorg_vraag.zorg_vraag_attribute_aantal(zorg_vraag_attribuut_code, self.__begin_datum)
307
308
    # ------------------------------------------------------------------------------------------------------------------
309 1
    def telling_zorg_vraag_cluster(self, cluster_code: str, cluster_nummer: int) -> int:
310
        """
311
        Geeft het aantal malen (d.w.z. 0 of 1) dat de zorgvraag van een subtraject voorkomt in een zorgvraagcluster.
312
313
        :param str cluster_code: De cluster_code waartegen getest moet worden.
314
        :param int cluster_nummer: Het clusternummer (1..2).
315
316
        :rtype: int
317
        """
318 1
        return self.__zorg_vraag.zorg_vraag_cluster_aantal(cluster_code, cluster_nummer, self.__begin_datum)
319
320
    # ------------------------------------------------------------------------------------------------------------------
321 1
    @property
322 1
    def zorg_product_code(self) -> Optional[str]:
323
        """
324
        Geeft de zorgproductcode van dit subtraject.
325
326
        :rtype: str|None
327
        """
328 1
        return self.__zorg_product_code
329
330
    # ------------------------------------------------------------------------------------------------------------------
331 1
    @zorg_product_code.setter
332 1
    def zorg_product_code(self, zorg_product_code: Optional[str]) -> None:
333
        """
334
        Zet de zorgproductcode van dit subtraject.
335
336
        :param str zorg_product_code: De zorgproductcode.
337
        """
338 1
        if zorg_product_code != '' and zorg_product_code is not None:
339 1
            self.__zorg_product_code = clean_code(zorg_product_code, LEN_ZORG_PRODUCT_CODE)
340
        else:
341
            self.__zorg_product_groep_code = None
342
343
    # ------------------------------------------------------------------------------------------------------------------
344 1
    @property
345 1
    def zorg_product_groep_code(self) -> Optional[str]:
346
        """
347
        Geeft de zorgproductgroepcode van dit subtraject.
348
349
        :rtype: str|None
350
        """
351 1
        return self.__zorg_product_groep_code
352
353
    # ------------------------------------------------------------------------------------------------------------------
354 1
    @zorg_product_groep_code.setter
355 1
    def zorg_product_groep_code(self, zorg_product_groep_code: Optional[str]):
356
        """
357
        Zet de zorgproductgroepcode van dit subtraject.
358
359
        :param str zorg_product_groep_code: De zorgproductgroepcode.
360
        """
361 1
        if zorg_product_groep_code != '' and zorg_product_groep_code is not None:
362 1
            self.__zorg_product_groep_code = clean_code(zorg_product_groep_code, LEN_ZORG_PRODUCT_GROEP_CODE)
363
        else:
364
            self.__zorg_product_groep_code = None
365
366
# ----------------------------------------------------------------------------------------------------------------------
367