|
1 | | -# Utility Guide: FitKitGeneration |
| 1 | +# Utility Guide: fit_kit_generation |
2 | 2 |
|
3 | | -The FitKitGeneration Utility provides methods to generate and manage FIT test kits for screening purposes. |
| 3 | +The FitKitGeneration Utility provides methods to generate and manage FIT test kits for testing purposes. |
4 | 4 |
|
5 | 5 | ## Table of Contents |
6 | 6 |
|
7 | | -- [Utility Guide: FitKitGeneration](#utility-guide-fitkitgeneration) |
| 7 | +- [Utility Guide: fit\_kit\_generation](#utility-guide-fit_kit_generation) |
8 | 8 | - [Table of Contents](#table-of-contents) |
9 | 9 | - [Using the FitKitGeneration Utility](#using-the-fitkitgeneration-utility) |
10 | 10 | - [Required Arguments](#required-arguments) |
11 | | - - [Example Usage](#example-usage) |
12 | 11 | - [FitKitGeneration Specific Functions](#fitkitgeneration-specific-functions) |
| 12 | + - [Example Usage](#example-usage) |
| 13 | +- [Call the example usage function](#call-the-example-usage-function) |
13 | 14 |
|
14 | 15 | ## Using the FitKitGeneration Utility |
15 | 16 |
|
16 | | -To use the fit_kit_generation Utility, import the `fit_kit_generation` module into your test file and call it's methods from within your tests, as required |
| 17 | +To use the fit_kit_generation Utility, import the `fit_kit_generation` module, from the `utils` directory, into your test file and call it's methods from within your tests, as required. |
17 | 18 |
|
18 | 19 | ## Required Arguments |
19 | 20 |
|
20 | 21 | The methods in this utility require specific arguments. Refer to the docstrings in the `fit_kit_generation.py` file for details on required and optional arguments. |
21 | 22 |
|
22 | | -## Example Usage |
23 | | - |
24 | | -from utils.fit_kit_generation import FitKitGenerator |
25 | | - |
26 | | -def test_generate_fit_kit() -> None: |
27 | | - fit_kit = FitKitGenerator().generate_kit(batch_id=12345, kit_type="Standard") |
28 | | - assert fit_kit is not None |
29 | | - |
30 | 23 | ## FitKitGeneration Specific Functions |
31 | 24 |
|
32 | 25 | The FitKitGeneration Utility includes methods for generating, validating, and managing FIT test kits. These methods are designed to streamline the process of creating test kits for various scenarios. Below are some key functions: |
33 | 26 |
|
34 | | -1. **`generate_kit(batch_id: int, kit_type: str) -> dict`** |
35 | | - Generates a FIT test kit with the specified batch ID and kit type. |
| 27 | +1. **`generate_kit(batch_id: int, kit_type: str) -> dict`** |
| 28 | + Generates a FIT test kit with the specified batch ID and kit type. |
36 | 29 | - **Arguments**: |
37 | 30 | - `batch_id` (int): The ID of the batch to which the kit belongs. |
38 | 31 | - `kit_type` (str): The type of kit to generate (e.g., "Standard", "Advanced"). |
39 | 32 | - **Returns**: A dictionary containing the details of the generated kit. |
40 | 33 |
|
41 | | -2. **`validate_kit(kit_id: int) -> bool`** |
42 | | - Validates a FIT test kit by its ID. |
| 34 | +2. **`validate_kit(kit_id: int) -> bool`** |
| 35 | + Validates a FIT test kit by its ID. |
43 | 36 | - **Arguments**: |
44 | 37 | - `kit_id` (int): The ID of the kit to validate. |
45 | 38 | - **Returns**: `True` if the kit is valid, `False` otherwise. |
46 | 39 |
|
47 | | -3. **`manage_kits(action: str, kit_ids: list[int]) -> None`** |
48 | | - Performs bulk actions on a list of FIT test kits. |
| 40 | +3. **`manage_kits(action: str, kit_ids: list[int]) -> None`** |
| 41 | + Performs bulk actions on a list of FIT test kits. |
49 | 42 | - **Arguments**: |
50 | 43 | - `action` (str): The action to perform (e.g., "activate", "deactivate"). |
51 | 44 | - `kit_ids` (list[int]): A list of kit IDs to apply the action to. |
52 | 45 |
|
53 | 46 | ## Example Usage |
54 | 47 |
|
55 | | - from utils.fit_kit_generation import FitKitGenerator |
| 48 | +from utils.fit_kit_generation import create_fit_id_df, calculate_check_digit, convert_kit_id_to_fit_device_id |
| 49 | + |
| 50 | +def example_usage() -> None: |
| 51 | + # Example inputs |
| 52 | + tk_type_id = 1 |
| 53 | + hub_id = 101 |
| 54 | + no_of_kits_to_retrieve = 2 |
| 55 | + |
| 56 | + # Step 1: Retrieve and process FIT kit data |
| 57 | + fit_kit_df = create_fit_id_df(tk_type_id, hub_id, no_of_kits_to_retrieve) |
| 58 | + print("Processed FIT Kit DataFrame:") |
| 59 | + print(fit_kit_df) |
56 | 60 |
|
57 | | - def test_fit_kit_functions() -> None: |
58 | | - # Generate a new FIT kit |
59 | | - fit_kit = FitKitGenerator().generate_kit(batch_id=12345, kit_type="Standard") |
60 | | - assert fit_kit["kit_type"] == "Standard" |
| 61 | + # Step 2: Calculate a check digit for a single kit ID |
| 62 | + kit_id = "ABC123" |
| 63 | + kit_with_check_digit = calculate_check_digit(kit_id) |
| 64 | + print(f"Kit ID with Check Digit: {kit_with_check_digit}") |
61 | 65 |
|
62 | | - # Validate the generated kit |
63 | | - is_valid = FitKitGenerator().validate_kit(kit_id=fit_kit["kit_id"]) |
64 | | - assert is_valid |
| 66 | + # Step 3: Convert a kit ID to a FIT Device ID |
| 67 | + fit_device_id = convert_kit_id_to_fit_device_id(kit_with_check_digit) |
| 68 | + print(f"FIT Device ID: {fit_device_id}") |
65 | 69 |
|
66 | | - # Manage multiple kits |
67 | | - FitKitGenerator().manage_kits(action="activate", kit_ids=[fit_kit["kit_id"]]) |
68 | | - |
| 70 | +# Call the example usage function |
| 71 | +example_usage() |
0 commit comments