|
59 | 59 | from utils.screening_subject_page_searcher import ( |
60 | 60 | search_subject_episode_by_nhs_number, |
61 | 61 | ) |
| 62 | +from utils.datasets.investigation_datasets import ( |
| 63 | + get_subject_with_investigation_dataset_ready, |
| 64 | + go_from_investigation_dataset_complete_to_a259_status, |
| 65 | +) |
62 | 66 | from utils.user_tools import UserTools |
63 | 67 |
|
64 | 68 | # Defining dictionaries used in tests |
@@ -108,7 +112,7 @@ def before_test(page: Page, request: FixtureRequest) -> None: |
108 | 112 | """ |
109 | 113 | if request.node.get_closest_marker("skip_before_test"): |
110 | 114 | return |
111 | | - df = obtain_test_data() |
| 115 | + df = get_subject_with_investigation_dataset_ready() |
112 | 116 | nhs_no = df.iloc[0]["subject_nhs_number"] |
113 | 117 | logging.info(f"NHS Number: {nhs_no}") |
114 | 118 |
|
@@ -1020,88 +1024,7 @@ def test_identify_advanced_colorectal_polyp_from_histology_r(page: Page) -> None |
1020 | 1024 | polyp_histology=polyp_histology, |
1021 | 1025 | ) |
1022 | 1026 |
|
1023 | | - # Enter the test outcome > A315 |
1024 | | - BasePage(page).click_back_button() |
1025 | | - BasePage(page).click_back_button() |
1026 | | - SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button() |
1027 | | - AdvanceFOBTScreeningEpisodePage(page).click_enter_diagnostic_test_outcome_button() |
1028 | | - DiagnosticTestOutcomePage(page).select_test_outcome_option( |
1029 | | - OutcomeOfDiagnosticTest.FAILED_TEST_REFER_ANOTHER |
1030 | | - ) |
1031 | | - DiagnosticTestOutcomePage(page).click_save_button() |
1032 | | - SubjectScreeningSummaryPage(page).verify_latest_event_status_value( |
1033 | | - "A315 - Diagnostic Test Outcome Entered" |
1034 | | - ) |
1035 | | - |
1036 | | - # Make post investigation contact > A361 |
1037 | | - SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button() |
1038 | | - AdvanceFOBTScreeningEpisodePage(page).click_other_post_investigation_button() |
1039 | | - AdvanceFOBTScreeningEpisodePage(page).verify_latest_event_status_value( |
1040 | | - "A361 - Other Post-investigation Contact Required" |
1041 | | - ) |
1042 | | - |
1043 | | - AdvanceFOBTScreeningEpisodePage( |
1044 | | - page |
1045 | | - ).click_record_other_post_investigation_contact_button() |
1046 | | - ContactWithPatientPage(page).select_direction_dropdown_option("To patient") |
1047 | | - ContactWithPatientPage(page).select_caller_id_dropdown_index_option(1) |
1048 | | - ContactWithPatientPage(page).click_calendar_button() |
1049 | | - CalendarPicker(page).v1_calender_picker(datetime.today()) |
1050 | | - ContactWithPatientPage(page).enter_start_time("11:00") |
1051 | | - ContactWithPatientPage(page).enter_end_time("12:00") |
1052 | | - ContactWithPatientPage(page).enter_discussion_record_text("Test Automation") |
1053 | | - ContactWithPatientPage(page).select_outcome_dropdown_option( |
1054 | | - "Post-investigation Appointment Not Required" |
1055 | | - ) |
1056 | | - ContactWithPatientPage(page).click_save_button() |
1057 | | - BasePage(page).click_back_button() |
1058 | | - SubjectScreeningSummaryPage(page).verify_latest_event_status_value( |
1059 | | - "A318 - Post-investigation Appointment NOT Required - Result Letter Created" |
1060 | | - ) |
1061 | | - |
1062 | | - # Process the A318 letters > A380 |
1063 | | - batch_processing( |
1064 | | - page, |
1065 | | - "A318", |
1066 | | - "Result Letters - No Post-investigation Appointment", |
1067 | | - "A380 - Failed Diagnostic Test - Refer Another", |
1068 | | - ) |
1069 | | - |
1070 | | - # Another contact to bring the subject back to A99 |
1071 | | - SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button() |
1072 | | - AdvanceFOBTScreeningEpisodePage(page).click_record_contact_with_patient_button() |
1073 | | - ContactWithPatientPage(page).select_direction_dropdown_option("To patient") |
1074 | | - ContactWithPatientPage(page).select_caller_id_dropdown_index_option(1) |
1075 | | - ContactWithPatientPage(page).click_calendar_button() |
1076 | | - CalendarPicker(page).v1_calender_picker(datetime.today()) |
1077 | | - ContactWithPatientPage(page).enter_start_time("11:00") |
1078 | | - ContactWithPatientPage(page).enter_end_time("12:00") |
1079 | | - ContactWithPatientPage(page).enter_discussion_record_text("Test Automation") |
1080 | | - ContactWithPatientPage(page).select_outcome_dropdown_option( |
1081 | | - "Suitable for Endoscopic Test" |
1082 | | - ) |
1083 | | - ContactWithPatientPage(page).click_save_button() |
1084 | | - AdvanceFOBTScreeningEpisodePage(page).verify_latest_event_status_value( |
1085 | | - "A99 - Suitable for Endoscopic Test" |
1086 | | - ) |
1087 | | - |
1088 | | - # Invite for 2nd diagnostic test > A59 - check options |
1089 | | - AdvanceFOBTScreeningEpisodePage(page).click_calendar_button() |
1090 | | - CalendarPicker(page).v1_calender_picker(datetime.today()) |
1091 | | - AdvanceFOBTScreeningEpisodePage(page).select_test_type_dropdown_option_2( |
1092 | | - "Colonoscopy" |
1093 | | - ) |
1094 | | - AdvanceFOBTScreeningEpisodePage(page).click_invite_for_diagnostic_test_button() |
1095 | | - AdvanceFOBTScreeningEpisodePage(page).click_attend_diagnostic_test_button() |
1096 | | - AttendDiagnosticTestPage(page).select_actual_type_of_test_dropdown_option( |
1097 | | - "Colonoscopy" |
1098 | | - ) |
1099 | | - AttendDiagnosticTestPage(page).click_calendar_button() |
1100 | | - CalendarPicker(page).v1_calender_picker(datetime.today()) |
1101 | | - AttendDiagnosticTestPage(page).click_save_button() |
1102 | | - SubjectScreeningSummaryPage(page).verify_latest_event_status_value( |
1103 | | - "A259 - Attended Diagnostic Test" |
1104 | | - ) |
| 1027 | + go_from_investigation_dataset_complete_to_a259_status(page) |
1105 | 1028 | SubjectScreeningSummaryPage(page).click_datasets_link() |
1106 | 1029 | SubjectDatasetsPage(page).click_investigation_show_datasets() |
1107 | 1030 |
|
@@ -1163,32 +1086,6 @@ def test_identify_advanced_colorectal_polyp_from_histology_s(page: Page) -> None |
1163 | 1086 | assert_test_results(page, "32") |
1164 | 1087 |
|
1165 | 1088 |
|
1166 | | -def obtain_test_data() -> pd.DataFrame: |
1167 | | - """ |
1168 | | - This function builds a query to retrieve subjects based on specific criteria |
1169 | | - and returns a DataFrame containing the results. |
1170 | | - """ |
1171 | | - criteria = { |
1172 | | - "latest episode status": "open", |
1173 | | - "latest episode latest investigation dataset": "colonoscopy_new", |
1174 | | - "latest episode started": "less than 4 years ago", |
1175 | | - } |
1176 | | - user = User() |
1177 | | - subject = Subject() |
1178 | | - |
1179 | | - builder = SubjectSelectionQueryBuilder() |
1180 | | - |
1181 | | - query, bind_vars = builder.build_subject_selection_query( |
1182 | | - criteria=criteria, |
1183 | | - user=user, |
1184 | | - subject=subject, |
1185 | | - subjects_to_retrieve=1, |
1186 | | - ) |
1187 | | - |
1188 | | - df = OracleDB().execute_query(query, bind_vars) |
1189 | | - return df |
1190 | | - |
1191 | | - |
1192 | 1089 | def make_polyp_1_information(**overrides): |
1193 | 1090 | """ |
1194 | 1091 | Create a dictionary containing default information about Polyp 1. |
|
0 commit comments