Skip to content

Commit 2f85b4e

Browse files
Megha PrasannanMegha Prasannan
authored andcommitted
updates to compartment 3
1 parent 357b70f commit 2f85b4e

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

tests/Smokescreen/test_compartment_3.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,9 @@
1414
def test_compartment_3(page: Page) -> None:
1515
UserTools.user_login(page, "Hub Manager State Registered")
1616

17-
# (STEP 1 & 2) Add results to the test records in the KIT_QUEUE table (i.e. mimic receiving results from the middleware)
17+
# (STEP 1 ,2 & 3) find data , seperate it into normal and abnormal, Add results to the test records in the KIT_QUEUE table (i.e. mimic receiving results from the middleware)
1818
# and get device IDs and their flags
1919
device_ids = process_kit_data()
20-
# (STEP - 4) Run two stored procedures to process any kit queue records at status BCSS_READY
21-
try:
22-
fit_kit_logged.execute_stored_procedures()
23-
logging.info("Stored procedures executed successfully.")
24-
except Exception as e:
25-
logging.error(f"Error executing stored procedures: {str(e)}")
26-
raise
27-
2820
# Retrieve NHS numbers for each device_id and determine normal/abnormal status
2921
nhs_numbers = []
3022
normal_flags = []
@@ -33,7 +25,14 @@ def test_compartment_3(page: Page) -> None:
3325
nhs_number = update_kit_service_management_entity(device_id, is_normal)
3426
nhs_numbers.append(nhs_number)
3527
normal_flags.append(is_normal) # Store the flag (True for normal, False for abnormal)
36-
28+
# (STEP - 4) Run two stored procedures to process any kit queue records at status BCSS_READY
29+
try:
30+
fit_kit_logged.execute_stored_procedures()
31+
logging.info("Stored procedures executed successfully.")
32+
except Exception as e:
33+
logging.error(f"Error executing stored procedures: {str(e)}")
34+
raise
35+
# (STEP - 5) Check the results of the processed FIT kits have correctly updated the status of the associated subjects
3736
# Verify subject event status based on normal or abnormal classification
3837
for nhs_number, is_normal in zip(nhs_numbers, normal_flags):
3938
expected_status = "S2 - Normal" if is_normal else "A8 - Abnormal" # S2 for normal, A8 for abnormal
@@ -46,7 +45,7 @@ def test_compartment_3(page: Page) -> None:
4645
logging.error(f"Verification failed for NHS number {nhs_number} with status {expected_status}: {str(e)}")
4746
raise
4847

49-
# (STEP - 5) Check the results of the processed FIT kits have correctly updated the status of the associated subjects
48+
5049
# Navigate to log devices page
5150
MainMenu(page).go_to_fit_test_kits_page()
5251
FITTestKits(page).go_to_log_devices_page()

utils/fit_kit_logged.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def process_kit_data():
3434

3535
return device_ids
3636

37-
37+
# find test data from db for compartment 3
3838
def get_kit_id_logged_from_db():
3939
kit_id_df = OracleDB().execute_query("""SELECT tk.kitid,tk.device_id,tk.screening_subject_id
4040
FROM tk_items_t tk
@@ -48,11 +48,11 @@ def get_kit_id_logged_from_db():
4848
AND tk.logged_in_at = 23159
4949
AND tk.reading_flag = 'N'
5050
AND tk.test_results IS NULL
51-
fetch first 10 rows only""")
51+
fetch first 9 rows only""")
5252

5353
return kit_id_df
5454

55-
55+
# Seperate kits into normal and abnormal
5656
def split_fit_kits(kit_id_df):
5757
number_of_normal = 1
5858
number_of_abnormal = 9
@@ -61,7 +61,7 @@ def split_fit_kits(kit_id_df):
6161
abnormal_fit_kit_df = kit_id_df.iloc[number_of_normal:number_of_normal + number_of_abnormal]
6262
return normal_fit_kit_df, abnormal_fit_kit_df
6363

64-
64+
# Get device_id from the kit_queue table
6565
def get_service_management_by_device_id(deviceid):
6666
get_service_management_df = OracleDB().execute_query(f"""SELECT kq.device_id, kq.test_kit_name, kq.test_kit_type, kq.test_kit_status,
6767
CASE WHEN tki.logged_in_flag = 'Y' THEN kq.logged_by_hub END AS logged_by_hub,
@@ -95,7 +95,7 @@ def get_service_management_by_device_id(deviceid):
9595
""")
9696
return get_service_management_df
9797

98-
98+
# Stored procedure to to process any kit queue records at status BCSS_READY
9999
def execute_stored_procedures():
100100
db_instance = OracleDB() # Create an instance of the OracleDB class
101101
logging.info("start: oracle.OracleDB.execute_stored_procedure")
@@ -104,7 +104,7 @@ def execute_stored_procedures():
104104
logging.info("exit: oracle.OracleDB.execute_stored_procedure")
105105

106106

107-
107+
# Add kits to the kit queue table
108108
def update_kit_service_management_entity(device_id, normal):
109109
get_service_management_df = get_service_management_by_device_id(device_id)
110110

0 commit comments

Comments
 (0)