Skip to content

Commit cae8454

Browse files
Updating gitleaks.toml to ignore SUBJECT_75TH_BIRTHDAY
1 parent 203cd88 commit cae8454

File tree

4 files changed

+162
-151
lines changed

4 files changed

+162
-151
lines changed

docs/SubjectCriteriaBuilderApllication.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Each entry in the file looks like this:
122122

123123
```json
124124
{
125-
"key_name": "NHS_NUMBER",
125+
"key": "NHS_NUMBER",
126126
"value_source": "",
127127
"notes": "Enter the 10-digit NHS Number of the subject you want to search for."
128128
}
@@ -132,7 +132,7 @@ Or, with allowed values and dependencies:
132132

133133
```json
134134
{
135-
"key_name": "SUBJECT_HUB_CODE",
135+
"key": "SUBJECT_HUB_CODE",
136136
"value_source": "SubjectHubCode.by_description",
137137
"notes": "Select the hub or organisation for the subject.",
138138
"allowed_values": [
@@ -145,7 +145,7 @@ Or, with allowed values and dependencies:
145145
}
146146
```
147147

148-
- **`key_name`:** The unique identifier for the criterion (must match the code).
148+
- **`key`:** The unique identifier for the criterion (must match the code).
149149
- **`value_source`:** (Optional) The source of the value, can be left blank. This refers to the class + method used in the subject selection query builder. This is not used by the code but is there to allow easier tracking/mapping.
150150
- **`notes`:** A clear, user-focused description of what the key is and what the user should input.
151151
- **`allowed_values`:** (Optional) An array of allowed values for the dropdown selection.
@@ -154,7 +154,7 @@ Or, with allowed values and dependencies:
154154
#### To add a new criterion
155155

156156
1. Add a new object to the JSON array with the following fields:
157-
- `"key_name"`: The `Enum` member name (must match the code).
157+
- `"key"`: The `Enum` member name (must match the code).
158158
- `"value_source"`: (Optional) The value source, can be left blank.
159159
- `"notes"`: A clear, user-focused description of what the key is and what the user should input.
160160
- `"allowed_values"`: (Optional) An array of allowed values for the dropdown selection.
@@ -164,7 +164,7 @@ Or, with allowed values and dependencies:
164164

165165
#### To edit a criterion
166166

167-
- Find the object with the matching `"key_name"` and update the `"notes"`, `"allowed_values"`, or `"dependencies"` as needed.
167+
- Find the object with the matching `"key"` and update the `"notes"`, `"allowed_values"`, or `"dependencies"` as needed.
168168
- Save the file and reload the app.
169169

170170
#### To remove a criterion
@@ -236,7 +236,7 @@ If you add new keys to the `SubjectSelectionCriteriaKey` `Enum` in your code, yo
236236

237237
```json
238238
{
239-
"key_name": "SCREENING_STATUS",
239+
"key": "SCREENING_STATUS",
240240
"value_source": "ScreeningStatusType.by_description_case_insensitive",
241241
"notes": "Select the current screening status for the subject.",
242242
"allowed_values": [

scripts/config/gitleaks.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@ regexes = [
1717

1818
[allowlist]
1919
paths = ['''poetry.lock''', '''yarn.lock''']
20+
21+
[[rules]]
22+
description = "Ignore SUBJECT_75TH_BIRTHDAY key"
23+
id = "ignore_subject_75th_birthday"
24+
regex = '''"key":\s*"SUBJECT_75TH_BIRTHDAY"'''
25+
26+
[rules.allowlist]
27+
regexTarget = "match"
28+
regexes = [
29+
'''"key":\s*"SUBJECT_75TH_BIRTHDAY"'''
30+
]

subject_criteria_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import sqlparse
1212
from typing import Optional
1313

14-
# Load environment variables from local.env. Needed for DB connectios
14+
# Load environment variables from local.env. Needed for DB connections
1515
load_dotenv(dotenv_path=os.path.join(os.path.dirname(__file__), "local.env"))
1616

1717
CRITERIA_JSON_PATH = os.path.join(
@@ -51,7 +51,7 @@ def get_metadata_for_key(enum_key: str) -> dict:
5151
dict: The metadata for the specified criteria key, or an empty dictionary if not found.
5252
"""
5353
for entry in CRITERIA_METADATA:
54-
if entry["key_name"] == enum_key:
54+
if entry["key"] == enum_key:
5555
return entry
5656
return {}
5757

@@ -169,7 +169,7 @@ def get_filtered_keys(search_term: str) -> list:
169169
"""
170170
Get a list of keys that match the search term.
171171
Args:
172-
search_term (str): What the user is seraching
172+
search_term (str): What the user is searching
173173
Returns:
174174
list: A list of all criteria matching the user's search
175175
"""

0 commit comments

Comments
 (0)