Skip to content

Commit 39ce0db

Browse files
Adding markdown document for the batch processing util
1 parent 5fc7575 commit 39ce0db

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Utility Guide: Batch Processing
2+
3+
The Batch Processing utility allows for the processing of batches on the active batch list page to be completed in one method
4+
5+
## Table of Contents
6+
7+
- [Utility Guide: Batch Processing](#utility-guide-batch-processing)
8+
- [Table of Contents](#table-of-contents)
9+
- [Functions Overview](#functions-overview)
10+
- [Batch Processing](#batch-processing)
11+
- [Required Arguments](#required-arguments)
12+
- [Optional Arguments](#optional-arguments)
13+
- [How This Function Works](#how-this-function-works)
14+
- [Prepare And Print Batch](#prepare-and-print-batch)
15+
- [Arguments](#arguments)
16+
- [How This Function Works](#how-this-function-works-1)
17+
- [Check Batch In Archived Batch List](#check-batch-in-archived-batch-list)
18+
- [Arguments](#arguments-1)
19+
- [How This Function Works](#how-this-function-works-2)
20+
21+
## Functions Overview
22+
23+
For this utility we have the following functions/methods:
24+
25+
- `batch_processing`
26+
- `prepare_and_print_batch`
27+
- `check_batch_in_archived_batch_list`
28+
29+
### Batch Processing
30+
31+
This is the main function that is called in order to precess a batch.
32+
This will call the other two functions in order to successfully process a batch.
33+
34+
#### Required Arguments
35+
36+
- `page`:
37+
- Type: **Page**
38+
- This is the playwright page object which is used to tell playwright what page the test is currently on.
39+
- `batch_type`:
40+
- Type: **str**
41+
- This is the event code for the batch. For example: **S1** or **A323**
42+
- `batch_description`:
43+
- Type: **str**
44+
- This is the description of the batch. For example: **Pre-invitation (FIT)** or **Post-investigation Appointment NOT Required**
45+
- `latest_event_status`:
46+
- Type: **str**
47+
- This is the status the subject will get updated to after the batch has been processed. It is used to check that the subject has been updated to the correct status after a batch has been printed
48+
49+
#### Optional Arguments
50+
51+
- `run_timed_events`:
52+
- Type: **bool**
53+
- If this is set to **True**, then bcss_timed_events will be executed against all the subjects found in the batch
54+
- `get_subjects_from_pdf`:
55+
- Type: **bool**
56+
- If this is set to **True**, then the subjects will be retrieved from the downloaded PDF file instead of from the DB
57+
58+
#### How This Function Works
59+
60+
1. It starts off by navigating the the main menu if not already on this page. This is done to ensure that this can be called from any page
61+
2. Once on the main menu it navigates to the active batch list
62+
3. From here it fills in the search filters to narrow down the list of active batches to only those which match the arguments provided
63+
4. Once only the expected batches are shown it checks the status colun of the records
64+
5. If *Prepared* is found then it ignores it, otherwise if *Open* is found then it carries on
65+
6. Now it extracts the ID of the batch and stores it in the local variable `link_text`, this is used later on to extracts the subjects in the batch from the DB
66+
7. After the ID is stored, it clicks on the ID to get to the Manage Active Batch page
67+
8. From Here it calls the `prepare_and_print_batch` function.
68+
1. If `get_subjects_from_pdf` was set to False it calls `get_nhs_no_from_batch_id`, which is imported from *utils.oracle.oracle_specific_functions*, to get the subjects from the batch and stores them as a pandas dataframe - **nhs_no_df**
69+
9. Once this is complete it calls the `check_batch_in_archived_batch_list` function
70+
10. Finally, once that function is complete it calls `verify_subject_event_status_by_nhs_no` which is imported from *utils/screening_subject_page_searcher*
71+
72+
### Prepare And Print Batch
73+
74+
This is used when on the Manage Active Batch page.
75+
It is in charge of pressing on the following button: **Prepare Batch**, **Retrieve** and **Confirm Printed**
76+
77+
#### Arguments
78+
79+
- `page`:
80+
- Type: **Page**
81+
- This is the playwright page object which is used to tell playwright what page the test is currently on.
82+
- `link_text`:
83+
- Type: **str**
84+
- This is the batch ID of the batch currently being processed
85+
- `get_subjects_from_pdf`:
86+
- Type: **bool**
87+
- This is an optional argument and if this is set to **True**, then the subjects will be retrieved from the downloaded PDF file instead of from the DB
88+
89+
#### How This Function Works
90+
91+
1. It starts off by clicking on the **Prepare Batch** button.
92+
2. After this it waits for the button to turn into **Re-Prepare Batch**. Once this happens it means that the batch is ready to be printed.
93+
3. Now It clicks on each **Retrieve** button visible.
94+
1. If `get_subjects_from_pdf` was set to True and the file is a **.pdf**, then it calls `extract_nhs_no_from_pdf`, which is imported from *utils/pdf_reader*, to get the subjects from the batch and stores them as a pandas dataframe - **nhs_no_df**
95+
2. After a file is downloaded, it gets deleted.
96+
4. Then it clicks on each **Confirm Printed** button ensuring to handle the dialog that appears.
97+
5. Finally it checks for the message: *Batch Successfully Archived and Printed*
98+
99+
### Check Batch In Archived Batch List
100+
101+
This function checks the the batch that was just prepared and printed is now visible in the archived batch list
102+
103+
#### Arguments
104+
105+
- `page`:
106+
- Type: **Page**
107+
- This is the playwright page object which is used to tell playwright what page the test is currently on.
108+
- `link_text`:
109+
- Type: **str**
110+
- This is the batch ID of the batch currently being processed
111+
112+
#### How This Function Works
113+
114+
1. This starts off by navigating to the main menu.
115+
2. From here it goes to the archived batch list page.
116+
3. Once on the archived batch list page, it enters `link_text` into the ID filter.
117+
4. Finally it checks that the batch is visible in the table.

0 commit comments

Comments
 (0)