Skip to content

Commit 742e900

Browse files
Adding docstrings and addressing PR comments
1 parent 6689c0e commit 742e900

26 files changed

+160
-6
lines changed

classes/asa_grade_type.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ def description(self) -> str:
3333

3434
@classmethod
3535
def _build_maps(cls) -> None:
36+
"""
37+
Initializes internal lookup maps for ASAGradeType enum members.
38+
39+
It ensures these maps are built only once per class, using `hasattr` to prevent
40+
redundant reinitialization.
41+
"""
3642
if not hasattr(cls, "_descriptions"):
3743
cls._descriptions: Dict[str, ASAGradeType] = {}
3844
cls._lowercase_descriptions: Dict[str, ASAGradeType] = {}

classes/cancer_treatment_intent.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ def description(self) -> str:
2929

3030
@classmethod
3131
def _build_maps(cls) -> None:
32+
"""
33+
Initializes internal lookup maps for CanterTreatmentIntent enum members.
34+
35+
It ensures these maps are built only once per class, using `hasattr` to prevent
36+
redundant reinitialization.
37+
"""
3238
if not hasattr(cls, "_descriptions"):
3339
cls._descriptions: Dict[str, CancerTreatmentIntent] = {}
3440
cls._lowercase_descriptions: Dict[str, CancerTreatmentIntent] = {}

classes/diagnosis_date_reason_type.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class DiagnosisDateReasonType(Enum):
1919
PATIENT_CHOICE = (305522, "Patient choice")
2020
PATIENT_COULD_NOT_BE_CONTACTED = (305505, "Patient could not be contacted")
2121
PATIENT_DECEASED = (305503, "Patient deceased")
22-
PATIENT_DECLINIED_ALL_APPOINTMENTS = (305520, "Patient declined all appointments")
22+
PATIENT_DECLINED_ALL_APPOINTMENTS = (305520, "Patient declined all appointments")
2323
PATIENT_EMIGRATED = (305504, "Patient emigrated")
2424
REOPENED_OLD_EPISODE_DATE_UNKNOWN = (305502, "Reopened old episode, date unknown")
2525
SSPI_UPDATE_PATIENT_DECEASED = (305525, "SSPI update - patient deceased")
@@ -47,6 +47,12 @@ def description(self) -> str:
4747

4848
@classmethod
4949
def _build_maps(cls) -> None:
50+
"""
51+
Initializes internal lookup maps for DiagnosisDateReasonType enum members.
52+
53+
It ensures these maps are built only once per class, using `hasattr` to prevent
54+
redundant reinitialization.
55+
"""
5056
if not hasattr(cls, "_descriptions"):
5157
cls._descriptions: Dict[str, DiagnosisDateReasonType] = {}
5258
cls._lowercase_descriptions: Dict[str, DiagnosisDateReasonType] = {}

classes/diagnostic_test_referral_type.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ def description(self) -> str:
2626

2727
@classmethod
2828
def _build_maps(cls) -> None:
29+
"""
30+
Initializes internal lookup maps for DiagnosticTestReferralType enum members.
31+
32+
It ensures these maps are built only once per class, using `hasattr` to prevent
33+
redundant reinitialization.
34+
"""
2935
if not hasattr(cls, "_descriptions"):
3036
cls._descriptions: Dict[str, DiagnosticTestReferralType] = {}
3137
cls._lowercase_descriptions: Dict[str, DiagnosticTestReferralType] = {}

classes/episode_status_reason_type.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ def description(self) -> str:
9292

9393
@classmethod
9494
def _build_maps(cls) -> None:
95+
"""
96+
Initializes internal lookup maps for EpisodeStatusReasonType enum members.
97+
98+
It ensures these maps are built only once per class, using `hasattr` to prevent
99+
redundant reinitialization.
100+
"""
95101
if not hasattr(cls, "_descriptions"):
96102
cls._descriptions: Dict[str, EpisodeStatusReasonType] = {}
97103
cls._lowercase_descriptions: Dict[str, EpisodeStatusReasonType] = {}
@@ -137,6 +143,6 @@ def get_id(self) -> Optional[int]:
137143

138144
def get_description(self) -> str:
139145
"""
140-
Returns
146+
Returns the description for the episode status reason.
141147
"""
142148
return self._description

classes/episode_status_type.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def description(self) -> str:
2828

2929
@classmethod
3030
def _build_maps(cls) -> None:
31+
"""
32+
Initializes internal lookup maps for EpisodeStatusType enum members.
33+
34+
It ensures these maps are built only once per class, using `hasattr` to prevent
35+
redundant reinitialization.
36+
"""
3137
if not hasattr(cls, "_descriptions"):
3238
cls._descriptions: Dict[str, EpisodeStatusType] = {}
3339
cls._lowercase_descriptions: Dict[str, EpisodeStatusType] = {}
@@ -71,6 +77,6 @@ def get_id(self) -> int:
7177

7278
def get_description(self) -> str:
7379
"""
74-
Returns the description for the
80+
Returns the description for the episode status.
7581
"""
7682
return self._description

classes/episode_sub_type.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ def description(self) -> str:
5151
@classmethod
5252
def _build_maps(cls) -> None:
5353
"""
54-
Builds internal lookup maps for descriptions and valid value IDs.
54+
Initializes internal lookup maps for EpisodeSubType enum members.
5555
56-
This method is called automatically before lookups.
56+
It ensures these maps are built only once per class, using `hasattr` to prevent
57+
redundant reinitialization.
5758
"""
5859
if not hasattr(cls, "_descriptions"):
5960
cls._descriptions: Dict[str, EpisodeSubType] = {}

classes/event_code_type.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ def description(self) -> str:
405405

406406
@classmethod
407407
def _build_maps(cls) -> None:
408+
"""
409+
Initializes internal lookup maps for EventCodeType enum members.
410+
411+
It ensures these maps are built only once per class, using `hasattr` to prevent
412+
redundant reinitialization.
413+
"""
408414
if not hasattr(cls, "_codes"):
409415
cls._codes: Dict[str, EventCodeType] = {}
410416
cls._descriptions: Dict[str, EventCodeType] = {}

classes/final_pretreatment_m_category_type.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def description(self) -> str:
2828

2929
@classmethod
3030
def _build_maps(cls) -> None:
31+
"""
32+
Initializes internal lookup maps for FinalPretreatmentMCategoryType enum members.
33+
34+
It ensures these maps are built only once per class, using `hasattr` to prevent
35+
redundant reinitialization.
36+
"""
3137
if not hasattr(cls, "_descriptions"):
3238
cls._descriptions: Dict[str, FinalPretreatmentMCategoryType] = {}
3339
cls._lowercase_descriptions: Dict[str, FinalPretreatmentMCategoryType] = {}

classes/final_pretreatment_n_category_type.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ def description(self) -> str:
3030

3131
@classmethod
3232
def _build_maps(cls) -> None:
33+
"""
34+
Initializes internal lookup maps for FinalPretreatmentNCategoryType enum members.
35+
36+
It ensures these maps are built only once per class, using `hasattr` to prevent
37+
redundant reinitialization.
38+
"""
3339
if not hasattr(cls, "_descriptions"):
3440
cls._descriptions: Dict[str, FinalPretreatmentNCategoryType] = {}
3541
cls._lowercase_descriptions: Dict[str, FinalPretreatmentNCategoryType] = {}

0 commit comments

Comments
 (0)