truthound-dashboard 1.2.0__py3-none-any.whl → 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- truthound_dashboard/api/deps.py +28 -0
- truthound_dashboard/api/drift.py +1 -0
- truthound_dashboard/api/mask.py +164 -0
- truthound_dashboard/api/profile.py +11 -3
- truthound_dashboard/api/router.py +22 -0
- truthound_dashboard/api/scan.py +168 -0
- truthound_dashboard/api/schemas.py +13 -4
- truthound_dashboard/api/validations.py +33 -1
- truthound_dashboard/api/validators.py +85 -0
- truthound_dashboard/core/__init__.py +8 -0
- truthound_dashboard/core/phase5/activity.py +1 -1
- truthound_dashboard/core/services.py +457 -7
- truthound_dashboard/core/truthound_adapter.py +441 -26
- truthound_dashboard/db/__init__.py +6 -0
- truthound_dashboard/db/models.py +250 -1
- truthound_dashboard/schemas/__init__.py +52 -1
- truthound_dashboard/schemas/collaboration.py +1 -1
- truthound_dashboard/schemas/drift.py +118 -3
- truthound_dashboard/schemas/mask.py +209 -0
- truthound_dashboard/schemas/profile.py +45 -2
- truthound_dashboard/schemas/scan.py +312 -0
- truthound_dashboard/schemas/schema.py +30 -2
- truthound_dashboard/schemas/validation.py +60 -3
- truthound_dashboard/schemas/validators/__init__.py +59 -0
- truthound_dashboard/schemas/validators/aggregate_validators.py +238 -0
- truthound_dashboard/schemas/validators/anomaly_validators.py +723 -0
- truthound_dashboard/schemas/validators/base.py +263 -0
- truthound_dashboard/schemas/validators/completeness_validators.py +269 -0
- truthound_dashboard/schemas/validators/cross_table_validators.py +375 -0
- truthound_dashboard/schemas/validators/datetime_validators.py +253 -0
- truthound_dashboard/schemas/validators/distribution_validators.py +422 -0
- truthound_dashboard/schemas/validators/drift_validators.py +615 -0
- truthound_dashboard/schemas/validators/geospatial_validators.py +486 -0
- truthound_dashboard/schemas/validators/multi_column_validators.py +706 -0
- truthound_dashboard/schemas/validators/privacy_validators.py +531 -0
- truthound_dashboard/schemas/validators/query_validators.py +510 -0
- truthound_dashboard/schemas/validators/registry.py +318 -0
- truthound_dashboard/schemas/validators/schema_validators.py +408 -0
- truthound_dashboard/schemas/validators/string_validators.py +396 -0
- truthound_dashboard/schemas/validators/table_validators.py +412 -0
- truthound_dashboard/schemas/validators/uniqueness_validators.py +355 -0
- truthound_dashboard/schemas/validators.py +59 -0
- truthound_dashboard/static/assets/index-BCA8H1hO.js +574 -0
- truthound_dashboard/static/assets/index-BNsSQ2fN.css +1 -0
- truthound_dashboard/static/assets/logo--IpBiMPK.png +0 -0
- truthound_dashboard/static/assets/unmerged_dictionaries-CsJWCRx9.js +1 -0
- truthound_dashboard/static/favicon.ico +0 -0
- truthound_dashboard/static/index.html +3 -3
- {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/METADATA +46 -11
- {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/RECORD +53 -28
- truthound_dashboard/static/assets/index-BqJMyAHX.js +0 -110
- truthound_dashboard/static/assets/index-DMDxHCTs.js +0 -465
- truthound_dashboard/static/assets/index-Dm2D11TK.css +0 -1
- truthound_dashboard/static/mockServiceWorker.js +0 -349
- {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/WHEEL +0 -0
- {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/entry_points.txt +0 -0
- {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
"""String validators.
|
|
2
|
+
|
|
3
|
+
Validators for pattern matching, format validation, and text content.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .base import (
|
|
7
|
+
ParameterDefinition,
|
|
8
|
+
ParameterType,
|
|
9
|
+
ValidatorCategory,
|
|
10
|
+
ValidatorDefinition,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
STRING_VALIDATORS: list[ValidatorDefinition] = [
|
|
14
|
+
ValidatorDefinition(
|
|
15
|
+
name="Regex",
|
|
16
|
+
display_name="Regex Pattern",
|
|
17
|
+
category=ValidatorCategory.STRING,
|
|
18
|
+
description="Validates strings against a regular expression pattern.",
|
|
19
|
+
parameters=[
|
|
20
|
+
ParameterDefinition(
|
|
21
|
+
name="column",
|
|
22
|
+
label="Column",
|
|
23
|
+
type=ParameterType.COLUMN,
|
|
24
|
+
required=True,
|
|
25
|
+
),
|
|
26
|
+
ParameterDefinition(
|
|
27
|
+
name="pattern",
|
|
28
|
+
label="Regex Pattern",
|
|
29
|
+
type=ParameterType.REGEX,
|
|
30
|
+
description="Regular expression pattern",
|
|
31
|
+
required=True,
|
|
32
|
+
placeholder=r"^[A-Z]{2,3}-\d{4}$",
|
|
33
|
+
),
|
|
34
|
+
ParameterDefinition(
|
|
35
|
+
name="mostly",
|
|
36
|
+
label="Mostly (Threshold)",
|
|
37
|
+
type=ParameterType.FLOAT,
|
|
38
|
+
min_value=0,
|
|
39
|
+
max_value=1,
|
|
40
|
+
),
|
|
41
|
+
],
|
|
42
|
+
tags=["string", "regex", "pattern"],
|
|
43
|
+
severity_default="medium",
|
|
44
|
+
),
|
|
45
|
+
ValidatorDefinition(
|
|
46
|
+
name="RegexList",
|
|
47
|
+
display_name="Regex List",
|
|
48
|
+
category=ValidatorCategory.STRING,
|
|
49
|
+
description="Validates against multiple regex patterns (any match passes).",
|
|
50
|
+
parameters=[
|
|
51
|
+
ParameterDefinition(
|
|
52
|
+
name="column",
|
|
53
|
+
label="Column",
|
|
54
|
+
type=ParameterType.COLUMN,
|
|
55
|
+
required=True,
|
|
56
|
+
),
|
|
57
|
+
ParameterDefinition(
|
|
58
|
+
name="patterns",
|
|
59
|
+
label="Patterns",
|
|
60
|
+
type=ParameterType.STRING_LIST,
|
|
61
|
+
description="List of regex patterns (any match is valid)",
|
|
62
|
+
required=True,
|
|
63
|
+
),
|
|
64
|
+
],
|
|
65
|
+
tags=["string", "regex", "pattern", "list"],
|
|
66
|
+
severity_default="medium",
|
|
67
|
+
),
|
|
68
|
+
ValidatorDefinition(
|
|
69
|
+
name="NotMatchRegex",
|
|
70
|
+
display_name="Not Match Regex",
|
|
71
|
+
category=ValidatorCategory.STRING,
|
|
72
|
+
description="Ensures values do not match a specified pattern.",
|
|
73
|
+
parameters=[
|
|
74
|
+
ParameterDefinition(
|
|
75
|
+
name="column",
|
|
76
|
+
label="Column",
|
|
77
|
+
type=ParameterType.COLUMN,
|
|
78
|
+
required=True,
|
|
79
|
+
),
|
|
80
|
+
ParameterDefinition(
|
|
81
|
+
name="pattern",
|
|
82
|
+
label="Forbidden Pattern",
|
|
83
|
+
type=ParameterType.REGEX,
|
|
84
|
+
required=True,
|
|
85
|
+
),
|
|
86
|
+
],
|
|
87
|
+
tags=["string", "regex", "forbidden"],
|
|
88
|
+
severity_default="high",
|
|
89
|
+
),
|
|
90
|
+
ValidatorDefinition(
|
|
91
|
+
name="Length",
|
|
92
|
+
display_name="String Length",
|
|
93
|
+
category=ValidatorCategory.STRING,
|
|
94
|
+
description="Validates string length constraints.",
|
|
95
|
+
parameters=[
|
|
96
|
+
ParameterDefinition(
|
|
97
|
+
name="column",
|
|
98
|
+
label="Column",
|
|
99
|
+
type=ParameterType.COLUMN,
|
|
100
|
+
required=True,
|
|
101
|
+
),
|
|
102
|
+
ParameterDefinition(
|
|
103
|
+
name="min_length",
|
|
104
|
+
label="Minimum Length",
|
|
105
|
+
type=ParameterType.INTEGER,
|
|
106
|
+
min_value=0,
|
|
107
|
+
),
|
|
108
|
+
ParameterDefinition(
|
|
109
|
+
name="max_length",
|
|
110
|
+
label="Maximum Length",
|
|
111
|
+
type=ParameterType.INTEGER,
|
|
112
|
+
min_value=0,
|
|
113
|
+
),
|
|
114
|
+
],
|
|
115
|
+
tags=["string", "length", "size"],
|
|
116
|
+
severity_default="medium",
|
|
117
|
+
),
|
|
118
|
+
ValidatorDefinition(
|
|
119
|
+
name="Email",
|
|
120
|
+
display_name="Email Format",
|
|
121
|
+
category=ValidatorCategory.STRING,
|
|
122
|
+
description="Validates email address format using RFC 5322 patterns.",
|
|
123
|
+
parameters=[
|
|
124
|
+
ParameterDefinition(
|
|
125
|
+
name="column",
|
|
126
|
+
label="Column",
|
|
127
|
+
type=ParameterType.COLUMN,
|
|
128
|
+
required=True,
|
|
129
|
+
),
|
|
130
|
+
],
|
|
131
|
+
tags=["string", "email", "format"],
|
|
132
|
+
severity_default="medium",
|
|
133
|
+
),
|
|
134
|
+
ValidatorDefinition(
|
|
135
|
+
name="Url",
|
|
136
|
+
display_name="URL Format",
|
|
137
|
+
category=ValidatorCategory.STRING,
|
|
138
|
+
description="Validates URL format.",
|
|
139
|
+
parameters=[
|
|
140
|
+
ParameterDefinition(
|
|
141
|
+
name="column",
|
|
142
|
+
label="Column",
|
|
143
|
+
type=ParameterType.COLUMN,
|
|
144
|
+
required=True,
|
|
145
|
+
),
|
|
146
|
+
],
|
|
147
|
+
tags=["string", "url", "format"],
|
|
148
|
+
severity_default="medium",
|
|
149
|
+
),
|
|
150
|
+
ValidatorDefinition(
|
|
151
|
+
name="Phone",
|
|
152
|
+
display_name="Phone Number",
|
|
153
|
+
category=ValidatorCategory.STRING,
|
|
154
|
+
description="Validates phone number format with international support.",
|
|
155
|
+
parameters=[
|
|
156
|
+
ParameterDefinition(
|
|
157
|
+
name="column",
|
|
158
|
+
label="Column",
|
|
159
|
+
type=ParameterType.COLUMN,
|
|
160
|
+
required=True,
|
|
161
|
+
),
|
|
162
|
+
ParameterDefinition(
|
|
163
|
+
name="country_code",
|
|
164
|
+
label="Country Code",
|
|
165
|
+
type=ParameterType.STRING,
|
|
166
|
+
description="Expected country code (e.g., 'US', 'KR')",
|
|
167
|
+
placeholder="US",
|
|
168
|
+
),
|
|
169
|
+
],
|
|
170
|
+
tags=["string", "phone", "format"],
|
|
171
|
+
severity_default="medium",
|
|
172
|
+
),
|
|
173
|
+
ValidatorDefinition(
|
|
174
|
+
name="Uuid",
|
|
175
|
+
display_name="UUID Format",
|
|
176
|
+
category=ValidatorCategory.STRING,
|
|
177
|
+
description="Validates UUID format (versions 1-5).",
|
|
178
|
+
parameters=[
|
|
179
|
+
ParameterDefinition(
|
|
180
|
+
name="column",
|
|
181
|
+
label="Column",
|
|
182
|
+
type=ParameterType.COLUMN,
|
|
183
|
+
required=True,
|
|
184
|
+
),
|
|
185
|
+
],
|
|
186
|
+
tags=["string", "uuid", "format"],
|
|
187
|
+
severity_default="medium",
|
|
188
|
+
),
|
|
189
|
+
ValidatorDefinition(
|
|
190
|
+
name="IpAddress",
|
|
191
|
+
display_name="IP Address",
|
|
192
|
+
category=ValidatorCategory.STRING,
|
|
193
|
+
description="Validates IPv4 and IPv6 address formats.",
|
|
194
|
+
parameters=[
|
|
195
|
+
ParameterDefinition(
|
|
196
|
+
name="column",
|
|
197
|
+
label="Column",
|
|
198
|
+
type=ParameterType.COLUMN,
|
|
199
|
+
required=True,
|
|
200
|
+
),
|
|
201
|
+
ParameterDefinition(
|
|
202
|
+
name="version",
|
|
203
|
+
label="IP Version",
|
|
204
|
+
type=ParameterType.SELECT,
|
|
205
|
+
description="IP version to validate",
|
|
206
|
+
options=[
|
|
207
|
+
{"value": "", "label": "Any (IPv4 or IPv6)"},
|
|
208
|
+
{"value": "4", "label": "IPv4 only"},
|
|
209
|
+
{"value": "6", "label": "IPv6 only"},
|
|
210
|
+
],
|
|
211
|
+
),
|
|
212
|
+
],
|
|
213
|
+
tags=["string", "ip", "network", "format"],
|
|
214
|
+
severity_default="medium",
|
|
215
|
+
),
|
|
216
|
+
ValidatorDefinition(
|
|
217
|
+
name="Format",
|
|
218
|
+
display_name="Common Format",
|
|
219
|
+
category=ValidatorCategory.STRING,
|
|
220
|
+
description="Validates common format types.",
|
|
221
|
+
parameters=[
|
|
222
|
+
ParameterDefinition(
|
|
223
|
+
name="column",
|
|
224
|
+
label="Column",
|
|
225
|
+
type=ParameterType.COLUMN,
|
|
226
|
+
required=True,
|
|
227
|
+
),
|
|
228
|
+
ParameterDefinition(
|
|
229
|
+
name="format_type",
|
|
230
|
+
label="Format Type",
|
|
231
|
+
type=ParameterType.SELECT,
|
|
232
|
+
required=True,
|
|
233
|
+
options=[
|
|
234
|
+
{"value": "email", "label": "Email"},
|
|
235
|
+
{"value": "url", "label": "URL"},
|
|
236
|
+
{"value": "phone", "label": "Phone"},
|
|
237
|
+
{"value": "uuid", "label": "UUID"},
|
|
238
|
+
{"value": "ipv4", "label": "IPv4"},
|
|
239
|
+
{"value": "ipv6", "label": "IPv6"},
|
|
240
|
+
{"value": "credit_card", "label": "Credit Card"},
|
|
241
|
+
{"value": "ssn", "label": "SSN"},
|
|
242
|
+
],
|
|
243
|
+
),
|
|
244
|
+
],
|
|
245
|
+
tags=["string", "format"],
|
|
246
|
+
severity_default="medium",
|
|
247
|
+
),
|
|
248
|
+
ValidatorDefinition(
|
|
249
|
+
name="JsonParseable",
|
|
250
|
+
display_name="JSON Parseable",
|
|
251
|
+
category=ValidatorCategory.STRING,
|
|
252
|
+
description="Ensures string values are valid JSON.",
|
|
253
|
+
parameters=[
|
|
254
|
+
ParameterDefinition(
|
|
255
|
+
name="column",
|
|
256
|
+
label="Column",
|
|
257
|
+
type=ParameterType.COLUMN,
|
|
258
|
+
required=True,
|
|
259
|
+
),
|
|
260
|
+
],
|
|
261
|
+
tags=["string", "json", "format"],
|
|
262
|
+
severity_default="medium",
|
|
263
|
+
),
|
|
264
|
+
ValidatorDefinition(
|
|
265
|
+
name="JsonSchema",
|
|
266
|
+
display_name="JSON Schema",
|
|
267
|
+
category=ValidatorCategory.STRING,
|
|
268
|
+
description="Validates JSON strings against a JSON Schema.",
|
|
269
|
+
parameters=[
|
|
270
|
+
ParameterDefinition(
|
|
271
|
+
name="column",
|
|
272
|
+
label="Column",
|
|
273
|
+
type=ParameterType.COLUMN,
|
|
274
|
+
required=True,
|
|
275
|
+
),
|
|
276
|
+
ParameterDefinition(
|
|
277
|
+
name="schema",
|
|
278
|
+
label="JSON Schema",
|
|
279
|
+
type=ParameterType.SCHEMA,
|
|
280
|
+
description="JSON Schema specification",
|
|
281
|
+
required=True,
|
|
282
|
+
),
|
|
283
|
+
],
|
|
284
|
+
tags=["string", "json", "schema"],
|
|
285
|
+
severity_default="medium",
|
|
286
|
+
),
|
|
287
|
+
ValidatorDefinition(
|
|
288
|
+
name="Alphanumeric",
|
|
289
|
+
display_name="Alphanumeric",
|
|
290
|
+
category=ValidatorCategory.STRING,
|
|
291
|
+
description="Ensures values contain only alphanumeric characters.",
|
|
292
|
+
parameters=[
|
|
293
|
+
ParameterDefinition(
|
|
294
|
+
name="column",
|
|
295
|
+
label="Column",
|
|
296
|
+
type=ParameterType.COLUMN,
|
|
297
|
+
required=True,
|
|
298
|
+
),
|
|
299
|
+
],
|
|
300
|
+
tags=["string", "alphanumeric", "characters"],
|
|
301
|
+
severity_default="low",
|
|
302
|
+
),
|
|
303
|
+
ValidatorDefinition(
|
|
304
|
+
name="ConsistentCasing",
|
|
305
|
+
display_name="Consistent Casing",
|
|
306
|
+
category=ValidatorCategory.STRING,
|
|
307
|
+
description="Validates consistent casing patterns.",
|
|
308
|
+
parameters=[
|
|
309
|
+
ParameterDefinition(
|
|
310
|
+
name="column",
|
|
311
|
+
label="Column",
|
|
312
|
+
type=ParameterType.COLUMN,
|
|
313
|
+
required=True,
|
|
314
|
+
),
|
|
315
|
+
ParameterDefinition(
|
|
316
|
+
name="casing",
|
|
317
|
+
label="Casing Style",
|
|
318
|
+
type=ParameterType.SELECT,
|
|
319
|
+
required=True,
|
|
320
|
+
options=[
|
|
321
|
+
{"value": "lower", "label": "lowercase"},
|
|
322
|
+
{"value": "upper", "label": "UPPERCASE"},
|
|
323
|
+
{"value": "title", "label": "Title Case"},
|
|
324
|
+
{"value": "snake", "label": "snake_case"},
|
|
325
|
+
{"value": "camel", "label": "camelCase"},
|
|
326
|
+
{"value": "pascal", "label": "PascalCase"},
|
|
327
|
+
{"value": "kebab", "label": "kebab-case"},
|
|
328
|
+
],
|
|
329
|
+
),
|
|
330
|
+
],
|
|
331
|
+
tags=["string", "casing", "style"],
|
|
332
|
+
severity_default="low",
|
|
333
|
+
),
|
|
334
|
+
ValidatorDefinition(
|
|
335
|
+
name="LikePattern",
|
|
336
|
+
display_name="LIKE Pattern",
|
|
337
|
+
category=ValidatorCategory.STRING,
|
|
338
|
+
description="SQL LIKE pattern matching with % and _ wildcards.",
|
|
339
|
+
parameters=[
|
|
340
|
+
ParameterDefinition(
|
|
341
|
+
name="column",
|
|
342
|
+
label="Column",
|
|
343
|
+
type=ParameterType.COLUMN,
|
|
344
|
+
required=True,
|
|
345
|
+
),
|
|
346
|
+
ParameterDefinition(
|
|
347
|
+
name="pattern",
|
|
348
|
+
label="LIKE Pattern",
|
|
349
|
+
type=ParameterType.STRING,
|
|
350
|
+
description="SQL LIKE pattern (use % for any, _ for single char)",
|
|
351
|
+
required=True,
|
|
352
|
+
placeholder="PRD-%",
|
|
353
|
+
),
|
|
354
|
+
],
|
|
355
|
+
tags=["string", "like", "sql", "pattern"],
|
|
356
|
+
severity_default="medium",
|
|
357
|
+
),
|
|
358
|
+
ValidatorDefinition(
|
|
359
|
+
name="NotLikePattern",
|
|
360
|
+
display_name="Not LIKE Pattern",
|
|
361
|
+
category=ValidatorCategory.STRING,
|
|
362
|
+
description="Ensures values do not match a LIKE pattern.",
|
|
363
|
+
parameters=[
|
|
364
|
+
ParameterDefinition(
|
|
365
|
+
name="column",
|
|
366
|
+
label="Column",
|
|
367
|
+
type=ParameterType.COLUMN,
|
|
368
|
+
required=True,
|
|
369
|
+
),
|
|
370
|
+
ParameterDefinition(
|
|
371
|
+
name="pattern",
|
|
372
|
+
label="Forbidden LIKE Pattern",
|
|
373
|
+
type=ParameterType.STRING,
|
|
374
|
+
required=True,
|
|
375
|
+
),
|
|
376
|
+
],
|
|
377
|
+
tags=["string", "like", "forbidden"],
|
|
378
|
+
severity_default="high",
|
|
379
|
+
),
|
|
380
|
+
ValidatorDefinition(
|
|
381
|
+
name="DateutilParseable",
|
|
382
|
+
display_name="Date Parseable",
|
|
383
|
+
category=ValidatorCategory.STRING,
|
|
384
|
+
description="Validates that strings can be parsed as dates.",
|
|
385
|
+
parameters=[
|
|
386
|
+
ParameterDefinition(
|
|
387
|
+
name="column",
|
|
388
|
+
label="Column",
|
|
389
|
+
type=ParameterType.COLUMN,
|
|
390
|
+
required=True,
|
|
391
|
+
),
|
|
392
|
+
],
|
|
393
|
+
tags=["string", "date", "parseable"],
|
|
394
|
+
severity_default="medium",
|
|
395
|
+
),
|
|
396
|
+
]
|