You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- markdownlint-disable-next-line first-line-heading -->
## Description
<!-- Describe your changes in detail. -->
Altering the utility markdown document to address comments found in
reviews
Makes the utility easier to understand
## Type of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply. -->
- [x ] Refactoring (non-breaking change)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would change existing
functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [ x] I am familiar with the [contributing
guidelines](https://github.com/nhs-england-tools/playwright-python-blueprint/blob/main/CONTRIBUTING.md)
- [x ] I have followed the code style of the project
- [ ] I have added tests to cover my changes (where appropriate)
- [x ] I have updated the documentation accordingly
- [ ] This PR is a result of pair or mob programming
---
## Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others
privacy, we kindly ask you to NOT including [PII (Personal Identifiable
Information) / PID (Personal Identifiable
Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public)
or any other sensitive data in this PR (Pull Request) and the codebase
changes. We will remove any PR that do contain any sensitive
information. We really appreciate your cooperation in this matter.
- [x ] I confirm that neither PII/PID nor sensitive data are included in
this PR and the codebase changes.
Copy file name to clipboardExpand all lines: docs/utility-guides/BatchProcessing.md
+30-10Lines changed: 30 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,40 @@
1
1
# Utility Guide: Batch Processing
2
2
3
-
The Batch Processing utility allows for the processing of batches on the active batch list page to be completed in one method
3
+
The Batch Processing utility provides a one-stop function for processing batches on the active batch list page, streamlining all necessary steps into a single call. **To process a batch, call the `batch_processing` function as described below.**
-[How This Function Works](#how-this-function-works)
14
15
-[Prepare And Print Batch](#prepare-and-print-batch)
15
16
-[Arguments](#arguments)
17
+
-[Optional Arguments](#optional-arguments-1)
16
18
-[How This Function Works](#how-this-function-works-1)
17
19
-[Check Batch In Archived Batch List](#check-batch-in-archived-batch-list)
18
20
-[Arguments](#arguments-1)
19
21
-[How This Function Works](#how-this-function-works-2)
20
22
23
+
## Example Usage
24
+
25
+
```python
26
+
from utils.batch_processing import batch_processing
27
+
28
+
batch_processing(
29
+
page=page,
30
+
batch_type="S1",
31
+
batch_description="Pre-invitation (FIT)",
32
+
latest_event_status=["Status1", "Status2"], # Can be str or list[str]
33
+
run_timed_events=True,
34
+
get_subjects_from_pdf=False
35
+
)
36
+
```
37
+
21
38
## Functions Overview
22
39
23
40
For this utility we have the following functions:
@@ -28,8 +45,7 @@ For this utility we have the following functions:
28
45
29
46
### Batch Processing
30
47
31
-
This is the main function that is called in order to process a batch.
32
-
This will call the other two functions in order to successfully process a batch.
48
+
This is the **main entry point function** that should be called to process a batch. It manages and coordinates all the required steps by internally calling the other two functions and auxiliary utilities as needed.
33
49
34
50
#### Required Arguments
35
51
@@ -43,14 +59,15 @@ This will call the other two functions in order to successfully process a batch.
43
59
- Type: `str`
44
60
- This is the description of the batch. For example: **Pre-invitation (FIT)** or **Post-investigation Appointment NOT Required**
45
61
-`latest_event_status`:
46
-
- Type: `str | None`
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. If there are multiple different status in the same batch, provide them all in a list.
62
+
- Type: `str | list[str] |`
63
+
- This is the status or list of statuses the subject(s) will get updated to after the batch has been processed. It is used to check that the subject(s) have been updated to the correct status after a batch has been printed.
48
64
49
65
#### Optional Arguments
50
66
51
67
-`run_timed_events`:
52
68
- Type: `bool`
53
69
- If this is set to **True**, then bcss_timed_events will be executed against all the subjects found in the batch
70
+
- These timed events simulate the passage of time-dependent processing steps.
54
71
-`get_subjects_from_pdf`:
55
72
- Type: `bool`
56
73
- If this is set to **True**, then the subjects will be retrieved from the downloaded PDF file instead of from the DB
@@ -65,8 +82,7 @@ This will call the other two functions in order to successfully process a batch.
65
82
5. 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
83
6. After the ID is stored, it clicks on the ID to get to the Manage Active Batch page
67
84
7. 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
-
2. For more Info on `get_nhs_no_from_batch_id` please look at: [`PDFReader`](PDFReader.md)
85
+
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 DB and stores them as a pandas DataFrame - **nhs_no_df**
70
86
8. Once this is complete it calls the `check_batch_in_archived_batch_list` function
71
87
9. Finally, once that function is complete it calls `verify_subject_event_status_by_nhs_no` which is imported from *utils/screening_subject_page_searcher*
72
88
@@ -83,17 +99,21 @@ It is in charge of pressing on the following button: **Prepare Batch**, **Retrie
83
99
-`link_text`:
84
100
- Type: `str`
85
101
- This is the batch ID of the batch currently being processed
102
+
103
+
#### Optional Arguments
104
+
86
105
-`get_subjects_from_pdf`:
87
106
- Type: `bool`
88
-
-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
107
+
-If this is set to **True**, then the subjects will be retrieved from the downloaded PDF file instead of from the DB
89
108
90
109
#### How This Function Works
91
110
92
111
1. It starts off by clicking on the **Prepare Batch** button.
93
112
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.
94
113
3. Now It clicks on each **Retrieve** button visible.
95
-
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**
96
-
2. After a file is downloaded, it gets deleted.
114
+
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 PDF and stores them as a pandas DataFrame - **nhs_no_df**
115
+
2. For more Info on `extract_nhs_no_from_pdf` please look at: [`PDFReader`](PDFReader.md)
116
+
3. After a file is downloaded, it gets deleted.
97
117
4. Then it clicks on each **Confirm Printed** button ensuring to handle the dialog that appears.
98
118
5. Finally it checks for the message: *Batch Successfully Archived and Printed*
0 commit comments