Skip to content

Commit 6689c0e

Browse files
Fixing line ending on final newline
1 parent 7c9faee commit 6689c0e

File tree

3 files changed

+260
-260
lines changed

3 files changed

+260
-260
lines changed

classes/location_type.py

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,95 @@
1-
from enum import Enum
2-
from typing import Optional, Dict
3-
4-
5-
class LocationType(Enum):
6-
"""
7-
Enum representing anatomical locations for datasets,
8-
with valid value IDs and descriptions.
9-
"""
10-
11-
ANUS = (17231, "Anus")
12-
RECTUM = (17232, "Rectum")
13-
RECTO_SIGMOID = (17243, "Recto/Sigmoid") # Used in CADS
14-
SIGMOID_COLON = (17233, "Sigmoid Colon")
15-
DESCENDING_COLON = (17234, "Descending Colon")
16-
SPLENIC_FLEXURE = (17235, "Splenic Flexure")
17-
TRANSVERSE_COLON = (17236, "Transverse Colon")
18-
HEPATIC_FLEXURE = (17237, "Hepatic Flexure")
19-
ASCENDING_COLON = (17238, "Ascending Colon")
20-
CAECUM = (17239, "Caecum")
21-
ILEUM = (17240, "Ileum")
22-
ANASTOMOSIS = (17241, "Anastomosis")
23-
APPENDIX = (17242, "Appendix")
24-
LEFT_COLON = (17244, "Left colon") # Used in investigation datasets, other findings
25-
ENTIRE_COLON = (
26-
17245,
27-
"Entire colon",
28-
) # Used in investigation datasets, other findings
29-
RIGHT_COLON = (
30-
200619,
31-
"Right colon",
32-
) # Used in investigation datasets, other findings
33-
PATCHY_AREAS = (
34-
200618,
35-
"Patchy areas",
36-
) # Used in investigation datasets, other findings
37-
38-
def __init__(self, valid_value_id: int, description: str):
39-
self._valid_value_id: int = valid_value_id
40-
self._description: str = description
41-
42-
@property
43-
def valid_value_id(self) -> int:
44-
"""Returns the valid value ID for the location."""
45-
return self._valid_value_id
46-
47-
@property
48-
def description(self) -> str:
49-
"""Returns the description for the location."""
50-
return self._description
51-
52-
@classmethod
53-
def _build_maps(cls) -> None:
54-
if not hasattr(cls, "_descriptions"):
55-
cls._descriptions: Dict[str, LocationType] = {}
56-
cls._lowercase_descriptions: Dict[str, LocationType] = {}
57-
cls._valid_value_ids: Dict[int, LocationType] = {}
58-
for item in cls:
59-
cls._descriptions[item.description] = item
60-
cls._lowercase_descriptions[item.description.lower()] = item
61-
cls._valid_value_ids[item.valid_value_id] = item
62-
63-
@classmethod
64-
def by_description(cls, description: str) -> Optional["LocationType"]:
65-
"""
66-
Returns the LocationType matching the given description.
67-
"""
68-
cls._build_maps()
69-
return cls._descriptions.get(description)
70-
71-
@classmethod
72-
def by_description_case_insensitive(
73-
cls, description: str
74-
) -> Optional["LocationType"]:
75-
"""
76-
Returns the LocationType matching the given description (case-insensitive).
77-
"""
78-
cls._build_maps()
79-
return cls._lowercase_descriptions.get(description.lower())
80-
81-
@classmethod
82-
def by_valid_value_id(cls, valid_value_id: int) -> Optional["LocationType"]:
83-
"""
84-
Returns the LocationType matching the given valid value ID.
85-
"""
86-
cls._build_maps()
87-
return cls._valid_value_ids.get(valid_value_id)
88-
89-
def get_id(self) -> int:
90-
"""Returns the valid value ID for the location."""
91-
return self._valid_value_id
92-
93-
def get_description(self) -> str:
94-
"""Returns the description for the location."""
95-
return self._description
1+
from enum import Enum
2+
from typing import Optional, Dict
3+
4+
5+
class LocationType(Enum):
6+
"""
7+
Enum representing anatomical locations for datasets,
8+
with valid value IDs and descriptions.
9+
"""
10+
11+
ANUS = (17231, "Anus")
12+
RECTUM = (17232, "Rectum")
13+
RECTO_SIGMOID = (17243, "Recto/Sigmoid") # Used in CADS
14+
SIGMOID_COLON = (17233, "Sigmoid Colon")
15+
DESCENDING_COLON = (17234, "Descending Colon")
16+
SPLENIC_FLEXURE = (17235, "Splenic Flexure")
17+
TRANSVERSE_COLON = (17236, "Transverse Colon")
18+
HEPATIC_FLEXURE = (17237, "Hepatic Flexure")
19+
ASCENDING_COLON = (17238, "Ascending Colon")
20+
CAECUM = (17239, "Caecum")
21+
ILEUM = (17240, "Ileum")
22+
ANASTOMOSIS = (17241, "Anastomosis")
23+
APPENDIX = (17242, "Appendix")
24+
LEFT_COLON = (17244, "Left colon") # Used in investigation datasets, other findings
25+
ENTIRE_COLON = (
26+
17245,
27+
"Entire colon",
28+
) # Used in investigation datasets, other findings
29+
RIGHT_COLON = (
30+
200619,
31+
"Right colon",
32+
) # Used in investigation datasets, other findings
33+
PATCHY_AREAS = (
34+
200618,
35+
"Patchy areas",
36+
) # Used in investigation datasets, other findings
37+
38+
def __init__(self, valid_value_id: int, description: str):
39+
self._valid_value_id: int = valid_value_id
40+
self._description: str = description
41+
42+
@property
43+
def valid_value_id(self) -> int:
44+
"""Returns the valid value ID for the location."""
45+
return self._valid_value_id
46+
47+
@property
48+
def description(self) -> str:
49+
"""Returns the description for the location."""
50+
return self._description
51+
52+
@classmethod
53+
def _build_maps(cls) -> None:
54+
if not hasattr(cls, "_descriptions"):
55+
cls._descriptions: Dict[str, LocationType] = {}
56+
cls._lowercase_descriptions: Dict[str, LocationType] = {}
57+
cls._valid_value_ids: Dict[int, LocationType] = {}
58+
for item in cls:
59+
cls._descriptions[item.description] = item
60+
cls._lowercase_descriptions[item.description.lower()] = item
61+
cls._valid_value_ids[item.valid_value_id] = item
62+
63+
@classmethod
64+
def by_description(cls, description: str) -> Optional["LocationType"]:
65+
"""
66+
Returns the LocationType matching the given description.
67+
"""
68+
cls._build_maps()
69+
return cls._descriptions.get(description)
70+
71+
@classmethod
72+
def by_description_case_insensitive(
73+
cls, description: str
74+
) -> Optional["LocationType"]:
75+
"""
76+
Returns the LocationType matching the given description (case-insensitive).
77+
"""
78+
cls._build_maps()
79+
return cls._lowercase_descriptions.get(description.lower())
80+
81+
@classmethod
82+
def by_valid_value_id(cls, valid_value_id: int) -> Optional["LocationType"]:
83+
"""
84+
Returns the LocationType matching the given valid value ID.
85+
"""
86+
cls._build_maps()
87+
return cls._valid_value_ids.get(valid_value_id)
88+
89+
def get_id(self) -> int:
90+
"""Returns the valid value ID for the location."""
91+
return self._valid_value_id
92+
93+
def get_description(self) -> str:
94+
"""Returns the description for the location."""
95+
return self._description
Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
1-
from enum import Enum
2-
from typing import Optional, Dict
3-
4-
5-
class PreviouslyExcisedTumourType(Enum):
6-
"""
7-
Enum representing whether a tumour was previously excised for cancer audit datasets,
8-
with valid value IDs and descriptions.
9-
"""
10-
11-
YES = (17058, "Yes")
12-
NO = (17059, "No")
13-
UNKNOWN = (202197, "Unknown")
14-
NOT_REPORTED = (202140, "Not Reported")
15-
16-
def __init__(self, valid_value_id: int, description: str):
17-
self._valid_value_id: int = valid_value_id
18-
self._description: str = description
19-
20-
@property
21-
def valid_value_id(self) -> int:
22-
"""Returns the valid value ID for the previously excised tumour type."""
23-
return self._valid_value_id
24-
25-
@property
26-
def description(self) -> str:
27-
"""Returns the description for the previously excised tumour type."""
28-
return self._description
29-
30-
@classmethod
31-
def _build_maps(cls) -> None:
32-
if not hasattr(cls, "_descriptions"):
33-
cls._descriptions: Dict[str, PreviouslyExcisedTumourType] = {}
34-
cls._lowercase_descriptions: Dict[str, PreviouslyExcisedTumourType] = {}
35-
cls._valid_value_ids: Dict[int, PreviouslyExcisedTumourType] = {}
36-
for item in cls:
37-
cls._descriptions[item.description] = item
38-
cls._lowercase_descriptions[item.description.lower()] = item
39-
cls._valid_value_ids[item.valid_value_id] = item
40-
41-
@classmethod
42-
def by_description(
43-
cls, description: str
44-
) -> Optional["PreviouslyExcisedTumourType"]:
45-
"""
46-
Returns the PreviouslyExcisedTumourType matching the given description.
47-
"""
48-
cls._build_maps()
49-
return cls._descriptions.get(description)
50-
51-
@classmethod
52-
def by_description_case_insensitive(
53-
cls, description: str
54-
) -> Optional["PreviouslyExcisedTumourType"]:
55-
"""
56-
Returns the PreviouslyExcisedTumourType matching the given description (case-insensitive).
57-
"""
58-
cls._build_maps()
59-
return cls._lowercase_descriptions.get(description.lower())
60-
61-
@classmethod
62-
def by_valid_value_id(
63-
cls, valid_value_id: int
64-
) -> Optional["PreviouslyExcisedTumourType"]:
65-
"""
66-
Returns the PreviouslyExcisedTumourType matching the given valid value ID.
67-
"""
68-
cls._build_maps()
69-
return cls._valid_value_ids.get(valid_value_id)
70-
71-
def get_id(self) -> int:
72-
"""Returns the valid value ID for the previously excised tumour type."""
73-
return self._valid_value_id
74-
75-
def get_description(self) -> str:
76-
"""Returns the description for the previously excised tumour type."""
77-
return self._description
1+
from enum import Enum
2+
from typing import Optional, Dict
3+
4+
5+
class PreviouslyExcisedTumourType(Enum):
6+
"""
7+
Enum representing whether a tumour was previously excised for cancer audit datasets,
8+
with valid value IDs and descriptions.
9+
"""
10+
11+
YES = (17058, "Yes")
12+
NO = (17059, "No")
13+
UNKNOWN = (202197, "Unknown")
14+
NOT_REPORTED = (202140, "Not Reported")
15+
16+
def __init__(self, valid_value_id: int, description: str):
17+
self._valid_value_id: int = valid_value_id
18+
self._description: str = description
19+
20+
@property
21+
def valid_value_id(self) -> int:
22+
"""Returns the valid value ID for the previously excised tumour type."""
23+
return self._valid_value_id
24+
25+
@property
26+
def description(self) -> str:
27+
"""Returns the description for the previously excised tumour type."""
28+
return self._description
29+
30+
@classmethod
31+
def _build_maps(cls) -> None:
32+
if not hasattr(cls, "_descriptions"):
33+
cls._descriptions: Dict[str, PreviouslyExcisedTumourType] = {}
34+
cls._lowercase_descriptions: Dict[str, PreviouslyExcisedTumourType] = {}
35+
cls._valid_value_ids: Dict[int, PreviouslyExcisedTumourType] = {}
36+
for item in cls:
37+
cls._descriptions[item.description] = item
38+
cls._lowercase_descriptions[item.description.lower()] = item
39+
cls._valid_value_ids[item.valid_value_id] = item
40+
41+
@classmethod
42+
def by_description(
43+
cls, description: str
44+
) -> Optional["PreviouslyExcisedTumourType"]:
45+
"""
46+
Returns the PreviouslyExcisedTumourType matching the given description.
47+
"""
48+
cls._build_maps()
49+
return cls._descriptions.get(description)
50+
51+
@classmethod
52+
def by_description_case_insensitive(
53+
cls, description: str
54+
) -> Optional["PreviouslyExcisedTumourType"]:
55+
"""
56+
Returns the PreviouslyExcisedTumourType matching the given description (case-insensitive).
57+
"""
58+
cls._build_maps()
59+
return cls._lowercase_descriptions.get(description.lower())
60+
61+
@classmethod
62+
def by_valid_value_id(
63+
cls, valid_value_id: int
64+
) -> Optional["PreviouslyExcisedTumourType"]:
65+
"""
66+
Returns the PreviouslyExcisedTumourType matching the given valid value ID.
67+
"""
68+
cls._build_maps()
69+
return cls._valid_value_ids.get(valid_value_id)
70+
71+
def get_id(self) -> int:
72+
"""Returns the valid value ID for the previously excised tumour type."""
73+
return self._valid_value_id
74+
75+
def get_description(self) -> str:
76+
"""Returns the description for the previously excised tumour type."""
77+
return self._description

0 commit comments

Comments
 (0)