Skip to content

Commit e551f6e

Browse files
Seperating out oracle_specific_functions into seperate files
1 parent 145171b commit e551f6e

31 files changed

+985
-935
lines changed

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from _pytest.config.argparsing import Parser
1616
from _pytest.fixtures import FixtureRequest
1717
from playwright.sync_api import Page
18-
from utils.oracle.oracle_specific_functions import (
18+
from utils.oracle.oracle_specific_functions.organisation_parameters import (
1919
set_org_parameter_value,
2020
check_parameter,
2121
)

docs/utility-guides/FitKit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ This example is showing how we are using this utility in compartment 3.
145145

146146
```python
147147
from utils.fit_kit import FitKitLogged
148-
from utils.oracle.oracle_specific_functions import update_kit_service_management_entity
148+
from utils.oracle.oracle_specific_functions.kit_management import update_kit_service_management_entity
149149

150150
def test_compartment_3(page: Page, smokescreen_properties: dict):
151151
device_ids = FitKitLogged().process_kit_data(smokescreen_properties)

docs/utility-guides/Oracle.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ You might use this utility for:
2424
- [Oracle Utility Methods](#oracle-utility-methods)
2525
- [Example usage](#example-usage)
2626
- [Oracle Specific Functions](#oracle-specific-functions)
27-
- [How to Add New Oracle-Specific Functions](#how-to-add-new-oracle-specific-functions)
28-
- [Example Usage](#example-usage-1)
27+
- [How to Add New Oracle-Specific Functions](#how-to-add-new-oracle-specific-functions)
28+
- [Example Usage](#example-usage-1)
2929

3030
## Using the Oracle Utility
3131

@@ -94,23 +94,45 @@ OracleDB().create_subjects_via_sspi(
9494

9595
## Oracle Specific Functions
9696

97-
This contains SQL queries that can be used to run tests.<br>
98-
These are all stored in one location to make it easier to edit the query at a later date and to make it accessible to multiple tests.
97+
Oracle-specific functions are now organized into separate files under `utils/oracle/oracle_specific_functions/` for better maintainability and discoverability.
98+
Each file groups related functions by their domain or purpose.
9999

100-
Common values are placed in the `SqlQueryValues` class to avoid repeating the same values in the queries.
100+
Below is a table showing the current structure and which functions are found in each file:
101101

102-
## How to Add New Oracle-Specific Functions
102+
| File Name | Functions/Classes Included |
103+
|--------------------------------------------|--------------------------------------------------------------------------------------------------------------|
104+
| **enums.py** | `SqlQueryValues` (common enum values for queries) |
105+
| **kit_management.py** | `get_kit_id_from_db`, `get_kit_id_logged_from_db`, `get_service_management_by_device_id`,<br>`update_kit_service_management_entity`, `execute_fit_kit_stored_procedures` |
106+
| **organisation_parameters.py** | `set_org_parameter_value`, `get_org_parameter_value`, `check_parameter` |
107+
| **screening_colonoscopist.py** | `build_accredited_screening_colonoscopist_query`, `get_accredited_screening_colonoscopist_in_bcs001` |
108+
| **subject_address.py** | `check_if_subject_has_temporary_address` |
109+
| **subject_appointment.py** | `get_subjects_for_appointments`, `get_subjects_with_booked_appointments` |
110+
| **subject_batch.py** | `get_nhs_no_from_batch_id` |
111+
| **supporting_notes.py** | `get_subjects_by_note_count`, `get_supporting_notes`, `get_subjects_with_multiple_notes` |
112+
| **investigation_dataset.py** | `get_investigation_dataset_polyp_category`, `get_investigation_dataset_polyp_algorithm_size`,<br>`get_subjects_for_investigation_dataset_updates` |
113+
| **subject_selector.py** | `SubjectSelector` (class for subject selection logic) |
103114

104-
- Define a new function in `utils/oracle/oracle_specific_functions.py`.
105-
- Create your SQL query, `parameterizing` as needed.
106-
- Call the relevant methods from the oracle `util` based on your needs (e.g., `execute_query`, stored procedure methods, etc.).
107-
- Return the result in the appropriate format for your function.
108-
- Document the function with a clear docstring.
115+
> **Note:**
116+
> If you are looking for a specific function, check the relevant file in `utils/oracle/oracle_specific_functions/`.
117+
> Common values used in queries are placed in `enums.py` as the `SqlQueryValues` class.
109118
110-
## Example Usage
119+
---
120+
121+
### How to Add New Oracle-Specific Functions
122+
123+
- Add your new function to the most appropriate file in `utils/oracle/oracle_specific_functions/`.
124+
- If your function does not fit an existing category, create a new file with a descriptive name.
125+
- Document your function with a clear docstring.
126+
- If your function uses common query values, consider adding them to `enums.py`.
127+
- Once done add the function to the table above
128+
129+
---
130+
131+
### Example Usage
111132

112133
```python
113134
from utils.oracle.oracle import OracleDB
135+
from utils.oracle.oracle_specific_functions.enums import SqlQueryValues
114136

115137
def example_query() -> pd.DataFrame:
116138
"""

pages/datasets/investigation_dataset_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from playwright.sync_api import Page, expect, Locator
33
from pages.base_page import BasePage
44
from enum import Enum, StrEnum
5-
from utils.oracle.oracle_specific_functions import (
5+
from utils.oracle.oracle_specific_functions.subject_datasets import (
66
get_investigation_dataset_polyp_category,
77
get_investigation_dataset_polyp_algorithm_size,
88
)

tests/regression/communications_production/test_fit_self_refer_letter_processing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
SubjectScreeningSummaryPage,
2424
)
2525
from utils.table_util import TableUtils
26-
from utils.oracle.oracle_specific_functions import get_nhs_no_from_batch_id
26+
from utils.oracle.oracle_specific_functions.subject_batch import (
27+
get_nhs_no_from_batch_id,
28+
)
2729
from utils import batch_processing
2830
from utils import screening_subject_page_searcher
2931

tests/regression/manual_cease/test_manually_cease_a_subject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pandas as pd
44
from playwright.sync_api import Page, expect
55
from pages.base_page import BasePage
6-
from utils.oracle.oracle_specific_functions import SubjectSelector
6+
from utils.oracle.subject_selector import SubjectSelector
77
from utils.oracle.oracle import OracleDB
88
from pages.base_page import BasePage
99
from pages.manual_cease.manual_cease_page import ManualCeasePage

tests/regression/notes/test_additional_care_notes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
SubjectEventsNotes,
1616
AdditionalCareNoteTypeOptions,
1717
)
18-
from utils.oracle.oracle_specific_functions import (
18+
from utils.oracle.oracle_specific_functions.subject_notes import (
1919
get_subjects_by_note_count,
2020
get_subjects_with_multiple_notes,
2121
)

tests/regression/notes/test_episode_notes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
SubjectEventsNotes,
1616
)
1717
from utils.table_util import TableUtils
18-
from utils.oracle.oracle_specific_functions import get_subjects_by_note_count
18+
from utils.oracle.oracle_specific_functions.subject_notes import (
19+
get_subjects_by_note_count,
20+
)
1921
from utils.screening_subject_page_searcher import search_subject_episode_by_nhs_number
2022
from utils.subject_notes import (
2123
fetch_supporting_notes_from_db,

tests/regression/notes/test_kit_notes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
NotesStatusOptions,
1616
SubjectEventsNotes,
1717
)
18-
from utils.oracle.oracle_specific_functions import get_subjects_by_note_count
18+
from utils.oracle.oracle_specific_functions.subject_notes import (
19+
get_subjects_by_note_count,
20+
)
1921
from utils.subject_notes import (
2022
fetch_supporting_notes_from_db,
2123
verify_note_content_matches_expected,

tests/regression/notes/test_subject_notes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
NotesStatusOptions,
1616
SubjectEventsNotes,
1717
)
18-
from utils.oracle.oracle_specific_functions import (
18+
from utils.oracle.oracle_specific_functions.subject_notes import (
1919
get_subjects_by_note_count,
2020
get_subjects_with_multiple_notes,
2121
)

0 commit comments

Comments
 (0)