Skip to content

Commit d0181ca

Browse files
Fixing incorrect docstrings and adding utility guide.
1 parent 5b38453 commit d0181ca

File tree

2 files changed

+112
-3
lines changed

2 files changed

+112
-3
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Utility Guide: Generate Health Check Forms
2+
3+
The **Generate Health Check Forms utility** provides helper methods for generating health check forms and inviting surveillance subjects early in BCSS.<br>
4+
This utility interacts with the UI and database to automate the process of producing health check forms for eligible subjects.
5+
6+
## Table of Contents
7+
8+
- [Utility Guide: Generate Health Check Forms](#utility-guide-generate-health-check-forms)
9+
- [Table of Contents](#table-of-contents)
10+
- [Summary of Utility Methods](#summary-of-utility-methods)
11+
- [Main Methods](#main-methods)
12+
- [`invite_surveillance_subjects_early`](#invite_surveillance_subjects_early)
13+
- [`find_early_invite_subjects`](#find_early_invite_subjects)
14+
- [Prerequisites](#prerequisites)
15+
- [Supporting Classes](#supporting-classes)
16+
- [Example Usage](#example-usage)
17+
18+
---
19+
20+
## Summary of Utility Methods
21+
22+
| Method | Purpose | Key Arguments | Expected Behaviour |
23+
|--------------------------------------|-------------------------------------------------------------------------|------------------------------|--------------------|
24+
| `invite_surveillance_subjects_early` | Generates health check forms and invites a surveillance subject early. | `screening_centre_id` (`str`)| Navigates UI, recalculates due count, finds subject, generates forms, returns NHS number. |
25+
| `find_early_invite_subjects` | Finds an eligible subject for early surveillance invitation. | `screening_centre_id` (`str`), `surveillance_due_count_date` (`str`) | Returns NHS number of eligible subject. |
26+
27+
---
28+
29+
## Main Methods
30+
31+
### `invite_surveillance_subjects_early`
32+
33+
Generates health check forms and invites a surveillance subject early by automating the relevant UI steps.
34+
35+
**Arguments:**
36+
37+
- `screening_centre_id` (`str`): The screening centre ID for which to generate forms and invite a subject.
38+
39+
**How it works:**
40+
41+
1. Navigates to the Surveillance page and then to the Produce Health Check Forms page.
42+
2. Sets the "Surveillance Due Count Volume" to 1.
43+
3. Clicks the "Recalculate" button to update the due count.
44+
4. Retrieves the current "Surveillance Due Count Date" from the UI.
45+
5. Finds an eligible subject for early invitation using the due count date and centre ID.
46+
6. Clicks the "Generate Health Check Forms" button.
47+
7. Returns the NHS number of the invited subject.
48+
49+
**Returns:**
50+
51+
- `str`: The NHS number of the early-invite subject.
52+
53+
---
54+
55+
### `find_early_invite_subjects`
56+
57+
Finds an eligible subject for early surveillance invitation based on the due count date and screening centre.
58+
59+
**Arguments:**
60+
61+
- `screening_centre_id` (`str`): The screening centre ID.
62+
- `surveillance_due_count_date` (`str`): The due count date as a string.
63+
64+
**How it works:**
65+
66+
1. Uses the `SubjectRepository` to query the database for a subject eligible for early surveillance invitation.
67+
2. Returns the NHS number of the found subject.
68+
69+
**Returns:**
70+
71+
- `str`: The NHS number of the eligible subject.
72+
73+
---
74+
75+
## Prerequisites
76+
77+
Before using the Generate Health Check Forms utility, ensure that the following prerequisites are met:
78+
79+
1. **UI Access**: The utility requires access to the BCSS UI and a valid Playwright `Page` object.
80+
2. **Database Access**: The utility uses the `SubjectRepository` to query the database for eligible subjects.
81+
3. **Screening Centre ID**: You must provide a valid screening centre ID for which to generate forms and invite subjects.
82+
83+
---
84+
85+
## Supporting Classes
86+
87+
These classes are required by the utility:
88+
89+
- `BasePage` — Provides navigation and common UI actions.
90+
- `SurveillancePage` — Handles navigation to the surveillance section.
91+
- `ProduceHealthCheckFormsPage` — Interacts with the health check forms UI.
92+
- `SubjectRepository` — Queries the database for eligible subjects.
93+
94+
---
95+
96+
## Example Usage
97+
98+
```python
99+
from utils.generate_health_check_forms_util import GenerateHealthCheckFormsUtil
100+
101+
# Assume you have a Playwright page object and a valid screening centre ID
102+
page = ... # Playwright Page object
103+
screening_centre_id = "12345"
104+
105+
# Create the utility
106+
health_check_util = GenerateHealthCheckFormsUtil(page)
107+
108+
# Invite a surveillance subject early and generate health check forms
109+
nhs_no = health_check_util.invite_surveillance_subjects_early(screening_centre_id)
110+
111+
print(f"Invited subject NHS number: {nhs_no}")
112+
```

utils/appointments.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ def book_post_investigation_appointment(
145145
Args:
146146
page (Page): The Playwright page object.
147147
site (str): The name of the site.
148-
appointment_start_time (str): The start time for the appointment.
149148
"""
150149
book_appointments_page = BookAppointmentPage(page)
151150
book_appointments_page.select_site_dropdown_option(
@@ -210,8 +209,6 @@ def book_practitioner_appointment(
210209
Args:
211210
page (Page): The Playwright page object.
212211
site (str): The name of the site.
213-
screening_practitioner_index (int): The index of the screening practitioner to select.
214-
appointment_start_time (str): The start time for the appointment.
215212
"""
216213
book_post_investigation_appointment(page, site)
217214

0 commit comments

Comments
 (0)