Skip to content

Commit 99afe6c

Browse files
committed
Merge remote-tracking branch 'origin' into feature/BCSS-20589-new-regression-release-standard-tests
# Conflicts: # pages/organisations/organisations_page.py # pytest.ini
2 parents cc54d2e + 6fea184 commit 99afe6c

File tree

254 files changed

+26217
-2604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+26217
-2604
lines changed

.gitleaksignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,9 @@ cd9c0efec38c5d63053dd865e5d4e207c0760d91:docs/guides/Perform_static_analysis.md:
221221
751ddbd178e91293c20282df62e8d3fe1086310a:utils/resources/axe.js:ipv4:32080
222222
751ddbd178e91293c20282df62e8d3fe1086310a:utils/resources/axe.js:ipv4:32089
223223
751ddbd178e91293c20282df62e8d3fe1086310a:utils/resources/axe.js:ipv4:32103
224+
cae84544e2852202f5d0abb9ad18f9d83a0c6d80:subject_criteria_builder/criteria.json:generic-api-key:4210
225+
203cd8811be75d33859eb7c7cc8a48beb5a2b8b2:subject_criteria_builder/criteria.json:generic-api-key:4210
226+
60468a7d6f3ff3259616757be85d6f07e62d00b6:subject_criteria_builder/criteria.json:generic-api-key:4210
227+
145171b9e9d169acb136fc527708c997c9ad9f61:subject_criteria_builder/criteria.json:generic-api-key:4210
228+
2ccb5e91033934d4818c1efa2eb1696b5511ebc9:subject_criteria_builder/criteria.json:generic-api-key:4210
229+
145171b9e9d169acb136fc527708c997c9ad9f61:subject_criteria_builder/criteria.json:generic-api-key:4210

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,22 @@ include scripts/init.mk
55

66
# ==============================================================================
77

8-
# NOTE: This project currently only uses this Makefile as part of CI/CD checks.
8+
# This allows the setup of Playwright by using a single command ready to use, and checks
9+
# if the user is in a virtual environment before running the setup.
10+
11+
.PHONY: check-venv
12+
check-venv: # Checks if in a Python venv / VIRTUALENV before installing a bunch of dependencies
13+
@python -c "import sys, os; \
14+
venv = (hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix) or 'VIRTUAL_ENV' in os.environ); \
15+
import sys; sys.exit(0 if venv else 1)"
16+
17+
setup-playwright: # Install Playwright and associated packages, and create local.env
18+
@echo "Checking for virtual environment..."
19+
$(MAKE) check-venv || (echo "ERROR: Not in a virtual environment, please create before running this command!"; exit 1)
20+
21+
@echo "Install Playwright"
22+
pip install -r requirements.txt
23+
playwright install
24+
25+
@echo "Setup local.env file"
26+
python setup_env_file.py

README.md

Lines changed: 388 additions & 69 deletions
Large diffs are not rendered by default.

classes/address/address.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from dataclasses import dataclass
2+
3+
4+
@dataclass
5+
class Address:
6+
"""
7+
Represents a postal address with up to five address lines and a postcode.
8+
Provides methods to format the address as a string.
9+
"""
10+
11+
address_line1: str = ""
12+
address_line2: str = ""
13+
address_line3: str = ""
14+
address_line4: str = ""
15+
address_line5: str = ""
16+
post_code: str = ""
17+
18+
def set_address_line(self, line_number: int, address_line: str) -> None:
19+
"""
20+
Sets the specified address line (1-5) to the given value.
21+
22+
Args:
23+
line_number (int): The address line number (1-5).
24+
address_line (str): The value to set for the address line.
25+
26+
Raises:
27+
ValueError: If line_number is not between 1 and 5.
28+
"""
29+
if not 1 <= line_number <= 5:
30+
raise ValueError(
31+
f"Invalid line number {line_number}, must be between 1 and 5"
32+
)
33+
34+
setattr(self, f"address_line{line_number}", address_line)
35+
36+
def __str__(self) -> str:
37+
"""
38+
Returns the formatted address as a single string.
39+
"""
40+
address_parts = [
41+
self.address_line1,
42+
self.address_line2,
43+
self.address_line3,
44+
self.address_line4,
45+
self.address_line5,
46+
self.post_code,
47+
]
48+
return ", ".join([part for part in address_parts if part])
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
from enum import Enum
2+
from typing import Optional
3+
4+
5+
class AppointmentSlotType(Enum):
6+
"""
7+
Enum representing appointment slot types, mapped to valid value IDs and descriptions.
8+
Provides utility methods for lookup by description (case-sensitive and insensitive) and by valid value ID.
9+
"""
10+
11+
COLONOSCOPY_ASSESSMENT = (209028, "Colonoscopy Assessment")
12+
BOWEL_SCOPE_AUTOMATIC = (200526, "FS Automatic")
13+
BOWEL_SCOPE_MANUAL = (200527, "FS Manual")
14+
POSITIVE_ASSESSMENT = (6016, "Positive Assessment")
15+
POST_INVESTIGATION = (6017, "Post-Investigation")
16+
SURVEILLANCE = (20061, "Surveillance")
17+
18+
def __init__(self, valid_value_id: int, description: str) -> None:
19+
self._valid_value_id = valid_value_id
20+
self._description = description
21+
22+
@property
23+
def valid_value_id(self) -> int:
24+
"""
25+
Returns the valid value ID for the appointment slot type.
26+
"""
27+
return self._valid_value_id
28+
29+
@property
30+
def description(self) -> str:
31+
"""
32+
Returns the description for the appointment slot type.
33+
"""
34+
return self._description
35+
36+
@classmethod
37+
def by_description(cls, description: str) -> Optional["AppointmentSlotType"]:
38+
"""
39+
Returns the enum member matching the given description (case-sensitive).
40+
"""
41+
for member in cls:
42+
if member.description == description:
43+
return member
44+
return None
45+
46+
@classmethod
47+
def by_description_case_insensitive(
48+
cls, description: str
49+
) -> Optional["AppointmentSlotType"]:
50+
"""
51+
Returns the enum member matching the given description (case-insensitive).
52+
"""
53+
desc_lower = description.lower()
54+
for member in cls:
55+
if member.description.lower() == desc_lower:
56+
return member
57+
return None
58+
59+
@classmethod
60+
def by_valid_value_id(cls, valid_value_id: int) -> Optional["AppointmentSlotType"]:
61+
"""
62+
Returns the enum member matching the given valid value ID.
63+
"""
64+
for member in cls:
65+
if member.valid_value_id == valid_value_id:
66+
return member
67+
return None
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
from enum import Enum
2+
from typing import Optional
3+
4+
5+
class AppointmentStatusType(Enum):
6+
"""
7+
Enum representing appointment status types, mapped to valid value IDs and descriptions.
8+
"""
9+
10+
ATTENDED = (6121, "Attended")
11+
BOOKED = (6120, "Booked")
12+
CANCELLED = (6122, "Cancelled")
13+
DID_NOT_ATTEND = (6123, "Did Not Attend")
14+
15+
def __init__(self, valid_value_id: int, description: str) -> None:
16+
self._valid_value_id = valid_value_id
17+
self._description = description
18+
19+
@property
20+
def valid_value_id(self) -> int:
21+
"""
22+
Returns the valid value ID for the appointment status type.
23+
"""
24+
return self._valid_value_id
25+
26+
@property
27+
def description(self) -> str:
28+
"""
29+
Returns the description for the appointment status type.
30+
"""
31+
return self._description
32+
33+
@classmethod
34+
def by_description(cls, description: str) -> Optional["AppointmentStatusType"]:
35+
"""
36+
Returns the enum member matching the given description (case-sensitive).
37+
"""
38+
for member in cls:
39+
if member.description == description:
40+
return member
41+
return None
42+
43+
@classmethod
44+
def by_description_case_insensitive(
45+
cls, description: str
46+
) -> Optional["AppointmentStatusType"]:
47+
"""
48+
Returns the enum member matching the given description (case-insensitive).
49+
"""
50+
desc_lower = description.lower()
51+
for member in cls:
52+
if member.description.lower() == desc_lower:
53+
return member
54+
return None
55+
56+
@classmethod
57+
def by_valid_value_id(
58+
cls, valid_value_id: int
59+
) -> Optional["AppointmentStatusType"]:
60+
"""
61+
Returns the enum member matching the given valid value ID.
62+
"""
63+
for member in cls:
64+
if member.valid_value_id == valid_value_id:
65+
return member
66+
return None

classes/appointment_status_type.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

classes/appointments_slot_type.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)