Skip to content

Commit 0d1ce66

Browse files
committed
Addressed sonarqube commit errors
1 parent 9b0ddc7 commit 0d1ce66

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/utility-guides/NotifyCriteriaParser.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Utility Guide: Notify Criteria Parser
2+
23
**Source:** [`utils/notify_criteria_parser.py`](../../utils/notify_criteria_parser.py)
34

45
The Notify Criteria Parser is a lightweight utility that extracts structured values from compact Notify message criteria strings. It is used by selection builders to support Notify filter logic—like `"S1 - new"` or `"S1 (S1w) - sending"` — by parsing these inputs into cleanly separated parts: `message type`, `message code (optional)`, and `status`.
@@ -40,6 +41,7 @@ parts = parse_notify_criteria("S1 (S1w) - sending")
4041
```
4142

4243
## Expected Input Formats
44+
4345
The parser supports the following input patterns:
4446

4547
| Format | Meaning |
@@ -49,6 +51,7 @@ The parser supports the following input patterns:
4951
| `none` (case-insensitive) | Special case meaning “no message should exist” |
5052

5153
## Example Usage
54+
5255
Here are a few examples of what the parser returns. Think of it like splitting a sentence into parts so each part can be used in a database search:
5356

5457
```python
@@ -63,6 +66,7 @@ parse_notify_criteria("None")
6366
```
6467

6568
## Output Structure
69+
6670
The returned value is a dictionary containing:
6771

6872
```python
@@ -72,26 +76,32 @@ The returned value is a dictionary containing:
7276
"status": str # the message’s progress, such as "new", "sending", or "none"
7377
}
7478
```
79+
7580
## Edge Case: none
81+
7682
If someone enters `none` as the criteria, it means "we're looking for subjects who do not have a matching message." The parser handles this specially, and the SQL builder will write `NOT EXISTS` logic behind the scenes to exclude those cases, so the parser returns:
7783

7884
```python
7985
{'status': 'none'}
8086
```
87+
8188
This signals `NOT EXISTS` logic for Notify message filtering.
8289

8390
## Error Handling
91+
8492
If the input doesn’t match an expected pattern, the parser raises:
8593

8694
```python
8795
ValueError("Invalid Notify criteria format: 'your_input'")
8896
```
97+
8998
e.g. If a tester or user types something like `S1 - banana` or forgets the - status bit, the parser will throw an error. This helps catch typos or unsupported formats early.
9099

91100
## Integration Points
101+
92102
These are the parts of the system that use the parser to decide whether to include or exclude Notify messages from a search:
93103
`SubjectSelectionQueryBuilder._add_criteria_notify_queued_message_status()` – for messages currently in the system
94104

95105
`SubjectSelectionQueryBuilder._add_criteria_notify_archived_message_status()` – for messages already sent or stored
96106

97-
You can also reuse it in any other part of the system that needs to interpret Notify message filters.
107+
You can also reuse it in any other part of the system that needs to interpret Notify message filters.

0 commit comments

Comments
 (0)