|
1 | 1 | # Utility Guide: fit_kit_generation |
2 | 2 |
|
3 | | -The FitKitGeneration Utility provides methods to generate and manage FIT test kits for testing purposes. |
| 3 | +The fit_kit_generation Utility provides methods to generate and manage FIT test kits for testing purposes. |
4 | 4 |
|
5 | 5 | ## Table of Contents |
6 | 6 |
|
7 | 7 | - [Utility Guide: fit\_kit\_generation](#utility-guide-fit_kit_generation) |
8 | 8 | - [Table of Contents](#table-of-contents) |
9 | | - - [Using the FitKitGeneration Utility](#using-the-fitkitgeneration-utility) |
| 9 | + - [Using the fit\_kit\_generation Utility](#using-the-fit_kit_generation-utility) |
10 | 10 | - [Required Arguments](#required-arguments) |
11 | | - - [FitKitGeneration Specific Functions](#fitkitgeneration-specific-functions) |
| 11 | + - [fit\_kit\_generation Specific Functions](#fit_kit_generation-specific-functions) |
| 12 | + - [fit\_kit\_generation Specific Functions](#fit_kit_generation-specific-functions-1) |
12 | 13 | - [Example Usage](#example-usage) |
13 | | -- [Call the example usage function](#call-the-example-usage-function) |
14 | 14 |
|
15 | | -## Using the FitKitGeneration Utility |
| 15 | +## Using the fit_kit_generation Utility |
16 | 16 |
|
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 | +To use the fit_kit_generation Utility, import the `fit_kit_generation` module, from the `utils` directory, into your test file and call its methods from within your tests, as required. |
18 | 18 |
|
19 | 19 | ## Required Arguments |
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 | +The methods in this utility require specific arguments. Below is a summary of the required arguments for key methods: |
| 22 | +- `generate_kit`: Requires `batch_id` (int) and `kit_type` (str). |
| 23 | +## fit_kit_generation Specific Functions |
22 | 24 |
|
23 | | -## FitKitGeneration Specific Functions |
| 25 | +The fit_kit_generation 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: |
24 | 26 |
|
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: |
| 27 | +1. **`create_fit_id_df(tk_type_id: int, hub_id: int, no_of_kits: int) -> DataFrame`** |
| 28 | + Creates a DataFrame containing FIT kit IDs based on the provided parameters. |
| 29 | + - **Arguments**: |
| 30 | + - `tk_type_id` (int): The type ID of the test kit. |
| 31 | + - `hub_id` (int): The hub ID associated with the kits. |
| 32 | + - `no_of_kits` (int): The number of kits to retrieve. |
| 33 | + - **Returns**: A pandas DataFrame with the FIT kit IDs. |
| 34 | + |
| 35 | +2. **`calculate_check_digit(kit_id: str) -> str`** |
| 36 | + Calculates and appends a check digit to the given kit ID. |
| 37 | + - **Arguments**: |
| 38 | + - `kit_id` (str): The kit ID to process. |
| 39 | + - **Returns**: The kit ID with the appended check digit. |
| 40 | + |
| 41 | +3. **`convert_kit_id_to_fit_device_id(kit_id: str) -> str`** |
| 42 | + Converts a kit ID into a FIT Device ID. |
| 43 | + - **Arguments**: |
| 44 | + - `kit_id` (str): The kit ID to convert. |
| 45 | + - **Returns**: The corresponding FIT Device ID. |
| 46 | + |
| 47 | +## fit_kit_generation Specific Functions |
| 48 | + |
| 49 | +The fit_kit_generation 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: |
26 | 50 |
|
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. |
| 51 | +1. **`generate_kit(batch_id: int, kit_type: str) -> dict`** |
| 52 | + Generates a FIT test kit with the specified batch ID and kit type. |
29 | 53 | - **Arguments**: |
30 | 54 | - `batch_id` (int): The ID of the batch to which the kit belongs. |
31 | 55 | - `kit_type` (str): The type of kit to generate (e.g., "Standard", "Advanced"). |
32 | 56 | - **Returns**: A dictionary containing the details of the generated kit. |
33 | 57 |
|
34 | | -2. **`validate_kit(kit_id: int) -> bool`** |
35 | | - Validates a FIT test kit by its ID. |
| 58 | +2. **`validate_kit(kit_id: int) -> bool`** |
| 59 | + Validates a FIT test kit by its ID. |
36 | 60 | - **Arguments**: |
37 | 61 | - `kit_id` (int): The ID of the kit to validate. |
38 | 62 | - **Returns**: `True` if the kit is valid, `False` otherwise. |
39 | 63 |
|
40 | | -3. **`manage_kits(action: str, kit_ids: list[int]) -> None`** |
41 | | - Performs bulk actions on a list of FIT test kits. |
| 64 | +3. **`manage_kits(action: str, kit_ids: list[int]) -> None`** |
| 65 | + Performs bulk actions on a list of FIT test kits. |
42 | 66 | - **Arguments**: |
43 | 67 | - `action` (str): The action to perform (e.g., "activate", "deactivate"). |
44 | 68 | - `kit_ids` (list[int]): A list of kit IDs to apply the action to. |
45 | 69 |
|
46 | 70 | ## Example Usage |
47 | 71 |
|
| 72 | +```python |
48 | 73 | from utils.fit_kit_generation import create_fit_id_df, calculate_check_digit, convert_kit_id_to_fit_device_id |
49 | 74 |
|
50 | 75 | def example_usage() -> None: |
51 | 76 | # Example inputs |
52 | | - tk_type_id = 1 |
53 | | - hub_id = 101 |
54 | | - no_of_kits_to_retrieve = 2 |
| 77 | + tk_type_id = 1 |
| 78 | + hub_id = 101 |
| 79 | + no_of_kits_to_retrieve = 2 |
55 | 80 |
|
56 | 81 | # 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) |
| 82 | + fit_kit_df = create_fit_id_df(tk_type_id, hub_id, no_of_kits_to_retrieve) |
| 83 | + print("Processed FIT Kit DataFrame:") |
| 84 | + print(fit_kit_df) |
60 | 85 |
|
61 | 86 | # 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}") |
| 87 | + kit_id = "ABC123" |
| 88 | + kit_with_check_digit = calculate_check_digit(kit_id) |
| 89 | + print(f"Kit ID with Check Digit: {kit_with_check_digit}") |
65 | 90 |
|
66 | 91 | # 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}") |
| 92 | + fit_device_id = convert_kit_id_to_fit_device_id(kit_with_check_digit) |
| 93 | + print(f"FIT Device ID: {fit_device_id}") |
69 | 94 |
|
70 | | -# Call the example usage function |
71 | 95 | example_usage() |
0 commit comments