You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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")
40
41
```
41
42
42
43
## Expected Input Formats
44
+
43
45
The parser supports the following input patterns:
44
46
45
47
| Format | Meaning |
@@ -49,6 +51,7 @@ The parser supports the following input patterns:
49
51
|`none` (case-insensitive) | Special case meaning “no message should exist” |
50
52
51
53
## Example Usage
54
+
52
55
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:
53
56
54
57
```python
@@ -63,6 +66,7 @@ parse_notify_criteria("None")
63
66
```
64
67
65
68
## Output Structure
69
+
66
70
The returned value is a dictionary containing:
67
71
68
72
```python
@@ -72,26 +76,32 @@ The returned value is a dictionary containing:
72
76
"status": str# the message’s progress, such as "new", "sending", or "none"
73
77
}
74
78
```
79
+
75
80
## Edge Case: none
81
+
76
82
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:
77
83
78
84
```python
79
85
{'status': 'none'}
80
86
```
87
+
81
88
This signals `NOT EXISTS` logic for Notify message filtering.
82
89
83
90
## Error Handling
91
+
84
92
If the input doesn’t match an expected pattern, the parser raises:
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.
90
99
91
100
## Integration Points
101
+
92
102
These are the parts of the system that use the parser to decide whether to include or exclude Notify messages from a search:
93
103
`SubjectSelectionQueryBuilder._add_criteria_notify_queued_message_status()` – for messages currently in the system
94
104
95
105
`SubjectSelectionQueryBuilder._add_criteria_notify_archived_message_status()` – for messages already sent or stored
96
106
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