truthound-dashboard 1.2.1__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.
Files changed (53) hide show
  1. truthound_dashboard/api/deps.py +28 -0
  2. truthound_dashboard/api/drift.py +1 -0
  3. truthound_dashboard/api/mask.py +164 -0
  4. truthound_dashboard/api/profile.py +11 -3
  5. truthound_dashboard/api/router.py +22 -0
  6. truthound_dashboard/api/scan.py +168 -0
  7. truthound_dashboard/api/schemas.py +13 -4
  8. truthound_dashboard/api/validations.py +33 -1
  9. truthound_dashboard/api/validators.py +85 -0
  10. truthound_dashboard/core/__init__.py +8 -0
  11. truthound_dashboard/core/phase5/activity.py +1 -1
  12. truthound_dashboard/core/services.py +457 -7
  13. truthound_dashboard/core/truthound_adapter.py +441 -26
  14. truthound_dashboard/db/__init__.py +6 -0
  15. truthound_dashboard/db/models.py +250 -1
  16. truthound_dashboard/schemas/__init__.py +52 -1
  17. truthound_dashboard/schemas/collaboration.py +1 -1
  18. truthound_dashboard/schemas/drift.py +118 -3
  19. truthound_dashboard/schemas/mask.py +209 -0
  20. truthound_dashboard/schemas/profile.py +45 -2
  21. truthound_dashboard/schemas/scan.py +312 -0
  22. truthound_dashboard/schemas/schema.py +30 -2
  23. truthound_dashboard/schemas/validation.py +60 -3
  24. truthound_dashboard/schemas/validators/__init__.py +59 -0
  25. truthound_dashboard/schemas/validators/aggregate_validators.py +238 -0
  26. truthound_dashboard/schemas/validators/anomaly_validators.py +723 -0
  27. truthound_dashboard/schemas/validators/base.py +263 -0
  28. truthound_dashboard/schemas/validators/completeness_validators.py +269 -0
  29. truthound_dashboard/schemas/validators/cross_table_validators.py +375 -0
  30. truthound_dashboard/schemas/validators/datetime_validators.py +253 -0
  31. truthound_dashboard/schemas/validators/distribution_validators.py +422 -0
  32. truthound_dashboard/schemas/validators/drift_validators.py +615 -0
  33. truthound_dashboard/schemas/validators/geospatial_validators.py +486 -0
  34. truthound_dashboard/schemas/validators/multi_column_validators.py +706 -0
  35. truthound_dashboard/schemas/validators/privacy_validators.py +531 -0
  36. truthound_dashboard/schemas/validators/query_validators.py +510 -0
  37. truthound_dashboard/schemas/validators/registry.py +318 -0
  38. truthound_dashboard/schemas/validators/schema_validators.py +408 -0
  39. truthound_dashboard/schemas/validators/string_validators.py +396 -0
  40. truthound_dashboard/schemas/validators/table_validators.py +412 -0
  41. truthound_dashboard/schemas/validators/uniqueness_validators.py +355 -0
  42. truthound_dashboard/schemas/validators.py +59 -0
  43. truthound_dashboard/static/assets/{index-BqXVFyqj.js → index-BCA8H1hO.js} +95 -95
  44. truthound_dashboard/static/assets/index-BNsSQ2fN.css +1 -0
  45. truthound_dashboard/static/assets/unmerged_dictionaries-CsJWCRx9.js +1 -0
  46. truthound_dashboard/static/index.html +2 -2
  47. {truthound_dashboard-1.2.1.dist-info → truthound_dashboard-1.3.0.dist-info}/METADATA +46 -11
  48. {truthound_dashboard-1.2.1.dist-info → truthound_dashboard-1.3.0.dist-info}/RECORD +51 -27
  49. truthound_dashboard/static/assets/index-o8qHVDte.css +0 -1
  50. truthound_dashboard/static/assets/unmerged_dictionaries-n_T3wZTf.js +0 -1
  51. {truthound_dashboard-1.2.1.dist-info → truthound_dashboard-1.3.0.dist-info}/WHEEL +0 -0
  52. {truthound_dashboard-1.2.1.dist-info → truthound_dashboard-1.3.0.dist-info}/entry_points.txt +0 -0
  53. {truthound_dashboard-1.2.1.dist-info → truthound_dashboard-1.3.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,355 @@
1
+ """Uniqueness validators.
2
+
3
+ Validators for detecting duplicates, validating keys, and ensuring distinctness.
4
+ """
5
+
6
+ from .base import (
7
+ ParameterDefinition,
8
+ ParameterType,
9
+ ValidatorCategory,
10
+ ValidatorDefinition,
11
+ )
12
+
13
+ UNIQUENESS_VALIDATORS: list[ValidatorDefinition] = [
14
+ ValidatorDefinition(
15
+ name="Unique",
16
+ display_name="Unique",
17
+ category=ValidatorCategory.UNIQUENESS,
18
+ description="Ensures all values in a column are unique.",
19
+ parameters=[
20
+ ParameterDefinition(
21
+ name="column",
22
+ label="Column",
23
+ type=ParameterType.COLUMN,
24
+ required=True,
25
+ ),
26
+ ParameterDefinition(
27
+ name="mostly",
28
+ label="Mostly (Threshold)",
29
+ type=ParameterType.FLOAT,
30
+ description="Minimum unique ratio (0.0-1.0)",
31
+ min_value=0,
32
+ max_value=1,
33
+ ),
34
+ ],
35
+ tags=["uniqueness", "duplicate", "distinct"],
36
+ severity_default="high",
37
+ ),
38
+ ValidatorDefinition(
39
+ name="UniqueRatio",
40
+ display_name="Unique Ratio",
41
+ category=ValidatorCategory.UNIQUENESS,
42
+ description="Validates that the unique value ratio falls within a range.",
43
+ parameters=[
44
+ ParameterDefinition(
45
+ name="column",
46
+ label="Column",
47
+ type=ParameterType.COLUMN,
48
+ required=True,
49
+ ),
50
+ ParameterDefinition(
51
+ name="min_ratio",
52
+ label="Minimum Ratio",
53
+ type=ParameterType.FLOAT,
54
+ min_value=0,
55
+ max_value=1,
56
+ ),
57
+ ParameterDefinition(
58
+ name="max_ratio",
59
+ label="Maximum Ratio",
60
+ type=ParameterType.FLOAT,
61
+ min_value=0,
62
+ max_value=1,
63
+ ),
64
+ ],
65
+ tags=["uniqueness", "ratio"],
66
+ severity_default="medium",
67
+ ),
68
+ ValidatorDefinition(
69
+ name="DistinctCount",
70
+ display_name="Distinct Count",
71
+ category=ValidatorCategory.UNIQUENESS,
72
+ description="Validates the number of distinct values in a column.",
73
+ parameters=[
74
+ ParameterDefinition(
75
+ name="column",
76
+ label="Column",
77
+ type=ParameterType.COLUMN,
78
+ required=True,
79
+ ),
80
+ ParameterDefinition(
81
+ name="min_count",
82
+ label="Minimum Count",
83
+ type=ParameterType.INTEGER,
84
+ min_value=0,
85
+ ),
86
+ ParameterDefinition(
87
+ name="max_count",
88
+ label="Maximum Count",
89
+ type=ParameterType.INTEGER,
90
+ min_value=0,
91
+ ),
92
+ ],
93
+ tags=["uniqueness", "distinct", "count"],
94
+ severity_default="medium",
95
+ ),
96
+ ValidatorDefinition(
97
+ name="Duplicate",
98
+ display_name="Duplicate Detection",
99
+ category=ValidatorCategory.UNIQUENESS,
100
+ description="Detects duplicate values within specified columns.",
101
+ parameters=[
102
+ ParameterDefinition(
103
+ name="columns",
104
+ label="Columns",
105
+ type=ParameterType.COLUMN_LIST,
106
+ description="Columns to check for duplicates (leave empty for all)",
107
+ ),
108
+ ],
109
+ tags=["uniqueness", "duplicate"],
110
+ severity_default="high",
111
+ ),
112
+ ValidatorDefinition(
113
+ name="DuplicateWithinGroup",
114
+ display_name="Duplicate Within Group",
115
+ category=ValidatorCategory.UNIQUENESS,
116
+ description="Detects duplicates within specified groups.",
117
+ parameters=[
118
+ ParameterDefinition(
119
+ name="column",
120
+ label="Column to Check",
121
+ type=ParameterType.COLUMN,
122
+ description="Column to check for duplicates",
123
+ required=True,
124
+ ),
125
+ ParameterDefinition(
126
+ name="group_by",
127
+ label="Group By Columns",
128
+ type=ParameterType.COLUMN_LIST,
129
+ description="Columns to group by",
130
+ required=True,
131
+ ),
132
+ ],
133
+ tags=["uniqueness", "duplicate", "group"],
134
+ severity_default="high",
135
+ ),
136
+ ValidatorDefinition(
137
+ name="PrimaryKey",
138
+ display_name="Primary Key",
139
+ category=ValidatorCategory.UNIQUENESS,
140
+ description="Validates primary key constraints (unique and non-null).",
141
+ parameters=[
142
+ ParameterDefinition(
143
+ name="column",
144
+ label="Primary Key Column",
145
+ type=ParameterType.COLUMN,
146
+ required=True,
147
+ ),
148
+ ],
149
+ tags=["uniqueness", "primary_key", "constraint"],
150
+ severity_default="critical",
151
+ ),
152
+ ValidatorDefinition(
153
+ name="CompoundKey",
154
+ display_name="Compound Key",
155
+ category=ValidatorCategory.UNIQUENESS,
156
+ description="Validates composite primary key constraints.",
157
+ parameters=[
158
+ ParameterDefinition(
159
+ name="columns",
160
+ label="Key Columns",
161
+ type=ParameterType.COLUMN_LIST,
162
+ description="Columns forming the compound key",
163
+ required=True,
164
+ ),
165
+ ],
166
+ tags=["uniqueness", "compound_key", "composite"],
167
+ severity_default="critical",
168
+ ),
169
+ ValidatorDefinition(
170
+ name="DistinctValuesInSet",
171
+ display_name="Distinct Values In Set",
172
+ category=ValidatorCategory.UNIQUENESS,
173
+ description="Ensures all distinct values belong to a specified set.",
174
+ parameters=[
175
+ ParameterDefinition(
176
+ name="column",
177
+ label="Column",
178
+ type=ParameterType.COLUMN,
179
+ required=True,
180
+ ),
181
+ ParameterDefinition(
182
+ name="value_set",
183
+ label="Allowed Values",
184
+ type=ParameterType.STRING_LIST,
185
+ description="Set of allowed values",
186
+ required=True,
187
+ ),
188
+ ],
189
+ tags=["uniqueness", "set", "enum"],
190
+ severity_default="medium",
191
+ ),
192
+ ValidatorDefinition(
193
+ name="DistinctValuesEqualSet",
194
+ display_name="Distinct Values Equal Set",
195
+ category=ValidatorCategory.UNIQUENESS,
196
+ description="Validates that distinct values exactly match a specified set.",
197
+ parameters=[
198
+ ParameterDefinition(
199
+ name="column",
200
+ label="Column",
201
+ type=ParameterType.COLUMN,
202
+ required=True,
203
+ ),
204
+ ParameterDefinition(
205
+ name="value_set",
206
+ label="Expected Values",
207
+ type=ParameterType.STRING_LIST,
208
+ description="Exact set of expected values",
209
+ required=True,
210
+ ),
211
+ ],
212
+ tags=["uniqueness", "set", "exact"],
213
+ severity_default="medium",
214
+ ),
215
+ ValidatorDefinition(
216
+ name="DistinctValuesContainSet",
217
+ display_name="Distinct Values Contain Set",
218
+ category=ValidatorCategory.UNIQUENESS,
219
+ description="Ensures distinct values contain all elements of a specified set.",
220
+ parameters=[
221
+ ParameterDefinition(
222
+ name="column",
223
+ label="Column",
224
+ type=ParameterType.COLUMN,
225
+ required=True,
226
+ ),
227
+ ParameterDefinition(
228
+ name="required_values",
229
+ label="Required Values",
230
+ type=ParameterType.STRING_LIST,
231
+ description="Values that must be present",
232
+ required=True,
233
+ ),
234
+ ],
235
+ tags=["uniqueness", "set", "contains"],
236
+ severity_default="medium",
237
+ ),
238
+ ValidatorDefinition(
239
+ name="DistinctCountBetween",
240
+ display_name="Distinct Count Between",
241
+ category=ValidatorCategory.UNIQUENESS,
242
+ description="Validates that distinct count falls within a range.",
243
+ parameters=[
244
+ ParameterDefinition(
245
+ name="column",
246
+ label="Column",
247
+ type=ParameterType.COLUMN,
248
+ required=True,
249
+ ),
250
+ ParameterDefinition(
251
+ name="min_count",
252
+ label="Minimum Count",
253
+ type=ParameterType.INTEGER,
254
+ required=True,
255
+ min_value=0,
256
+ ),
257
+ ParameterDefinition(
258
+ name="max_count",
259
+ label="Maximum Count",
260
+ type=ParameterType.INTEGER,
261
+ required=True,
262
+ min_value=0,
263
+ ),
264
+ ],
265
+ tags=["uniqueness", "distinct", "range"],
266
+ severity_default="medium",
267
+ ),
268
+ ValidatorDefinition(
269
+ name="UniqueWithinRecord",
270
+ display_name="Unique Within Record",
271
+ category=ValidatorCategory.UNIQUENESS,
272
+ description="Ensures specified columns have unique values within each record.",
273
+ parameters=[
274
+ ParameterDefinition(
275
+ name="columns",
276
+ label="Columns",
277
+ type=ParameterType.COLUMN_LIST,
278
+ description="Columns to compare within each row",
279
+ required=True,
280
+ ),
281
+ ],
282
+ tags=["uniqueness", "row", "record"],
283
+ severity_default="medium",
284
+ ),
285
+ ValidatorDefinition(
286
+ name="AllColumnsUniqueWithinRecord",
287
+ display_name="All Columns Unique Within Record",
288
+ category=ValidatorCategory.UNIQUENESS,
289
+ description="Validates that all values within each record are unique.",
290
+ parameters=[
291
+ ParameterDefinition(
292
+ name="columns",
293
+ label="Columns",
294
+ type=ParameterType.COLUMN_LIST,
295
+ description="Columns to check (leave empty for all)",
296
+ ),
297
+ ],
298
+ tags=["uniqueness", "row", "all"],
299
+ severity_default="low",
300
+ ),
301
+ ValidatorDefinition(
302
+ name="NaturalKey",
303
+ display_name="Natural Key",
304
+ category=ValidatorCategory.UNIQUENESS,
305
+ description="Validates natural business key uniqueness (unique + meaningful).",
306
+ parameters=[
307
+ ParameterDefinition(
308
+ name="columns",
309
+ label="Key Columns",
310
+ type=ParameterType.COLUMN_LIST,
311
+ description="Columns forming the natural key",
312
+ required=True,
313
+ ),
314
+ ParameterDefinition(
315
+ name="allow_null",
316
+ label="Allow Null",
317
+ type=ParameterType.BOOLEAN,
318
+ description="Allow null values in key columns",
319
+ default=False,
320
+ ),
321
+ ],
322
+ tags=["uniqueness", "natural_key", "business"],
323
+ severity_default="high",
324
+ ),
325
+ ValidatorDefinition(
326
+ name="SurrogateKey",
327
+ display_name="Surrogate Key",
328
+ category=ValidatorCategory.UNIQUENESS,
329
+ description="Validates surrogate key properties (unique, non-null, sequential).",
330
+ parameters=[
331
+ ParameterDefinition(
332
+ name="column",
333
+ label="Surrogate Key Column",
334
+ type=ParameterType.COLUMN,
335
+ required=True,
336
+ ),
337
+ ParameterDefinition(
338
+ name="check_sequential",
339
+ label="Check Sequential",
340
+ type=ParameterType.BOOLEAN,
341
+ description="Verify keys are sequential without gaps",
342
+ default=False,
343
+ ),
344
+ ParameterDefinition(
345
+ name="start_value",
346
+ label="Start Value",
347
+ type=ParameterType.INTEGER,
348
+ description="Expected starting value",
349
+ default=1,
350
+ ),
351
+ ],
352
+ tags=["uniqueness", "surrogate_key", "identity"],
353
+ severity_default="critical",
354
+ ),
355
+ ]
@@ -0,0 +1,59 @@
1
+ """Validator configuration schemas.
2
+
3
+ This module provides backward compatibility for the validators subpackage.
4
+ All types and functions are re-exported from the validators module.
5
+
6
+ For new code, prefer importing directly from truthound_dashboard.schemas.validators:
7
+
8
+ from truthound_dashboard.schemas.validators import (
9
+ VALIDATOR_REGISTRY,
10
+ ValidatorDefinition,
11
+ ValidatorConfig,
12
+ get_validator_by_name,
13
+ )
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ # Re-export all public symbols from the validators subpackage
19
+ from truthound_dashboard.schemas.validators import (
20
+ # Base types
21
+ ParameterDefinition,
22
+ ParameterType,
23
+ ValidatorCategory,
24
+ ValidatorConfig,
25
+ ValidatorConfigList,
26
+ ValidatorDefinition,
27
+ # Utility functions
28
+ configs_to_truthound_format,
29
+ has_custom_params,
30
+ merge_severity_overrides,
31
+ # Registry
32
+ VALIDATOR_REGISTRY,
33
+ get_validator_by_name,
34
+ get_validators_by_category,
35
+ search_validators,
36
+ get_category_info,
37
+ CATEGORY_INFO,
38
+ )
39
+
40
+ __all__ = [
41
+ # Base types
42
+ "ParameterDefinition",
43
+ "ParameterType",
44
+ "ValidatorCategory",
45
+ "ValidatorConfig",
46
+ "ValidatorConfigList",
47
+ "ValidatorDefinition",
48
+ # Utility functions
49
+ "configs_to_truthound_format",
50
+ "has_custom_params",
51
+ "merge_severity_overrides",
52
+ # Registry
53
+ "VALIDATOR_REGISTRY",
54
+ "get_validator_by_name",
55
+ "get_validators_by_category",
56
+ "search_validators",
57
+ "get_category_info",
58
+ "CATEGORY_INFO",
59
+ ]