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.
Files changed (57) 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-BCA8H1hO.js +574 -0
  44. truthound_dashboard/static/assets/index-BNsSQ2fN.css +1 -0
  45. truthound_dashboard/static/assets/logo--IpBiMPK.png +0 -0
  46. truthound_dashboard/static/assets/unmerged_dictionaries-CsJWCRx9.js +1 -0
  47. truthound_dashboard/static/favicon.ico +0 -0
  48. truthound_dashboard/static/index.html +3 -3
  49. {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/METADATA +46 -11
  50. {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/RECORD +53 -28
  51. truthound_dashboard/static/assets/index-BqJMyAHX.js +0 -110
  52. truthound_dashboard/static/assets/index-DMDxHCTs.js +0 -465
  53. truthound_dashboard/static/assets/index-Dm2D11TK.css +0 -1
  54. truthound_dashboard/static/mockServiceWorker.js +0 -349
  55. {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/WHEEL +0 -0
  56. {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/entry_points.txt +0 -0
  57. {truthound_dashboard-1.2.0.dist-info → truthound_dashboard-1.3.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,412 @@
1
+ """Table validators.
2
+
3
+ Validators for table-level metadata, dimensions, freshness, and structure.
4
+ """
5
+
6
+ from .base import (
7
+ ParameterDefinition,
8
+ ParameterType,
9
+ ValidatorCategory,
10
+ ValidatorDefinition,
11
+ )
12
+
13
+ TABLE_VALIDATORS: list[ValidatorDefinition] = [
14
+ ValidatorDefinition(
15
+ name="TableNotEmpty",
16
+ display_name="Table Not Empty",
17
+ category=ValidatorCategory.TABLE,
18
+ description="Ensures the table contains at least one row.",
19
+ parameters=[],
20
+ tags=["table", "empty", "rows"],
21
+ severity_default="critical",
22
+ ),
23
+ ValidatorDefinition(
24
+ name="TableRowCountRange",
25
+ display_name="Table Row Count Range",
26
+ category=ValidatorCategory.TABLE,
27
+ description="Validates that row count falls within a range.",
28
+ parameters=[
29
+ ParameterDefinition(
30
+ name="min_rows",
31
+ label="Minimum Rows",
32
+ type=ParameterType.INTEGER,
33
+ min_value=0,
34
+ ),
35
+ ParameterDefinition(
36
+ name="max_rows",
37
+ label="Maximum Rows",
38
+ type=ParameterType.INTEGER,
39
+ min_value=0,
40
+ ),
41
+ ],
42
+ tags=["table", "row_count", "range"],
43
+ severity_default="medium",
44
+ ),
45
+ ValidatorDefinition(
46
+ name="TableRowCountExact",
47
+ display_name="Table Row Count Exact",
48
+ category=ValidatorCategory.TABLE,
49
+ description="Validates exact row count with tolerance.",
50
+ parameters=[
51
+ ParameterDefinition(
52
+ name="expected_rows",
53
+ label="Expected Rows",
54
+ type=ParameterType.INTEGER,
55
+ required=True,
56
+ min_value=0,
57
+ ),
58
+ ParameterDefinition(
59
+ name="tolerance",
60
+ label="Tolerance",
61
+ type=ParameterType.INTEGER,
62
+ description="Acceptable deviation from expected",
63
+ default=0,
64
+ min_value=0,
65
+ ),
66
+ ],
67
+ tags=["table", "row_count", "exact"],
68
+ severity_default="medium",
69
+ ),
70
+ ValidatorDefinition(
71
+ name="TableColumnCount",
72
+ display_name="Table Column Count",
73
+ category=ValidatorCategory.TABLE,
74
+ description="Validates the number of columns.",
75
+ parameters=[
76
+ ParameterDefinition(
77
+ name="expected_count",
78
+ label="Expected Count",
79
+ type=ParameterType.INTEGER,
80
+ min_value=0,
81
+ ),
82
+ ParameterDefinition(
83
+ name="min_count",
84
+ label="Minimum Count",
85
+ type=ParameterType.INTEGER,
86
+ min_value=0,
87
+ ),
88
+ ParameterDefinition(
89
+ name="max_count",
90
+ label="Maximum Count",
91
+ type=ParameterType.INTEGER,
92
+ min_value=0,
93
+ ),
94
+ ],
95
+ tags=["table", "column_count"],
96
+ severity_default="medium",
97
+ ),
98
+ ValidatorDefinition(
99
+ name="TableRequiredColumns",
100
+ display_name="Table Required Columns",
101
+ category=ValidatorCategory.TABLE,
102
+ description="Validates presence of required columns.",
103
+ parameters=[
104
+ ParameterDefinition(
105
+ name="required_columns",
106
+ label="Required Columns",
107
+ type=ParameterType.STRING_LIST,
108
+ required=True,
109
+ ),
110
+ ],
111
+ tags=["table", "columns", "required"],
112
+ severity_default="critical",
113
+ ),
114
+ ValidatorDefinition(
115
+ name="TableForbiddenColumns",
116
+ display_name="Table Forbidden Columns",
117
+ category=ValidatorCategory.TABLE,
118
+ description="Ensures certain columns are absent.",
119
+ parameters=[
120
+ ParameterDefinition(
121
+ name="forbidden_columns",
122
+ label="Forbidden Columns",
123
+ type=ParameterType.STRING_LIST,
124
+ required=True,
125
+ ),
126
+ ],
127
+ tags=["table", "columns", "forbidden", "security"],
128
+ severity_default="high",
129
+ ),
130
+ ValidatorDefinition(
131
+ name="TableFreshness",
132
+ display_name="Table Freshness",
133
+ category=ValidatorCategory.TABLE,
134
+ description="Validates that the table contains recent data.",
135
+ parameters=[
136
+ ParameterDefinition(
137
+ name="datetime_column",
138
+ label="Datetime Column",
139
+ type=ParameterType.COLUMN,
140
+ required=True,
141
+ ),
142
+ ParameterDefinition(
143
+ name="max_age_hours",
144
+ label="Max Age (Hours)",
145
+ type=ParameterType.INTEGER,
146
+ description="Maximum age of most recent record",
147
+ required=True,
148
+ min_value=1,
149
+ ),
150
+ ],
151
+ tags=["table", "freshness", "recent"],
152
+ severity_default="high",
153
+ ),
154
+ ValidatorDefinition(
155
+ name="TableDataRecency",
156
+ display_name="Table Data Recency",
157
+ category=ValidatorCategory.TABLE,
158
+ description="Ensures data is not older than specified days.",
159
+ parameters=[
160
+ ParameterDefinition(
161
+ name="datetime_column",
162
+ label="Datetime Column",
163
+ type=ParameterType.COLUMN,
164
+ required=True,
165
+ ),
166
+ ParameterDefinition(
167
+ name="max_age_days",
168
+ label="Max Age (Days)",
169
+ type=ParameterType.INTEGER,
170
+ required=True,
171
+ min_value=1,
172
+ ),
173
+ ],
174
+ tags=["table", "recency", "age"],
175
+ severity_default="medium",
176
+ ),
177
+ ValidatorDefinition(
178
+ name="TableUpdateFrequency",
179
+ display_name="Table Update Frequency",
180
+ category=ValidatorCategory.TABLE,
181
+ description="Validates expected data update frequency.",
182
+ parameters=[
183
+ ParameterDefinition(
184
+ name="datetime_column",
185
+ label="Datetime Column",
186
+ type=ParameterType.COLUMN,
187
+ required=True,
188
+ ),
189
+ ParameterDefinition(
190
+ name="expected_frequency",
191
+ label="Expected Frequency",
192
+ type=ParameterType.SELECT,
193
+ required=True,
194
+ options=[
195
+ {"value": "hourly", "label": "Hourly"},
196
+ {"value": "daily", "label": "Daily"},
197
+ {"value": "weekly", "label": "Weekly"},
198
+ {"value": "monthly", "label": "Monthly"},
199
+ ],
200
+ ),
201
+ ParameterDefinition(
202
+ name="tolerance_periods",
203
+ label="Tolerance Periods",
204
+ type=ParameterType.INTEGER,
205
+ description="Number of periods allowed to miss",
206
+ default=1,
207
+ min_value=0,
208
+ ),
209
+ ],
210
+ tags=["table", "frequency", "schedule"],
211
+ severity_default="medium",
212
+ ),
213
+ ValidatorDefinition(
214
+ name="TableSchemaMatch",
215
+ display_name="Table Schema Match",
216
+ category=ValidatorCategory.TABLE,
217
+ description="Validates schema matches expected definition.",
218
+ parameters=[
219
+ ParameterDefinition(
220
+ name="expected_schema",
221
+ label="Expected Schema",
222
+ type=ParameterType.SCHEMA,
223
+ description="Expected schema as JSON {column: type}",
224
+ required=True,
225
+ ),
226
+ ParameterDefinition(
227
+ name="strict",
228
+ label="Strict Mode",
229
+ type=ParameterType.BOOLEAN,
230
+ description="Reject extra columns not in schema",
231
+ default=False,
232
+ ),
233
+ ],
234
+ tags=["table", "schema", "match"],
235
+ severity_default="high",
236
+ ),
237
+ ValidatorDefinition(
238
+ name="TableColumnTypes",
239
+ display_name="Table Column Types",
240
+ category=ValidatorCategory.TABLE,
241
+ description="Validates expected column data types.",
242
+ parameters=[
243
+ ParameterDefinition(
244
+ name="expected_types",
245
+ label="Expected Types",
246
+ type=ParameterType.SCHEMA,
247
+ description="JSON mapping of column names to expected types",
248
+ required=True,
249
+ placeholder='{"id": "Int64", "name": "String"}',
250
+ ),
251
+ ],
252
+ tags=["table", "types", "columns"],
253
+ severity_default="high",
254
+ ),
255
+ ValidatorDefinition(
256
+ name="TableMemorySize",
257
+ display_name="Table Memory Size",
258
+ category=ValidatorCategory.TABLE,
259
+ description="Validates estimated memory usage.",
260
+ parameters=[
261
+ ParameterDefinition(
262
+ name="min_size_mb",
263
+ label="Minimum Size (MB)",
264
+ type=ParameterType.FLOAT,
265
+ min_value=0,
266
+ ),
267
+ ParameterDefinition(
268
+ name="max_size_mb",
269
+ label="Maximum Size (MB)",
270
+ type=ParameterType.FLOAT,
271
+ min_value=0,
272
+ ),
273
+ ],
274
+ tags=["table", "memory", "size"],
275
+ severity_default="low",
276
+ ),
277
+ ValidatorDefinition(
278
+ name="TableDimensions",
279
+ display_name="Table Dimensions",
280
+ category=ValidatorCategory.TABLE,
281
+ description="Validates table dimensions (rows and columns).",
282
+ parameters=[
283
+ ParameterDefinition(
284
+ name="min_rows",
285
+ label="Minimum Rows",
286
+ type=ParameterType.INTEGER,
287
+ min_value=0,
288
+ ),
289
+ ParameterDefinition(
290
+ name="max_rows",
291
+ label="Maximum Rows",
292
+ type=ParameterType.INTEGER,
293
+ min_value=0,
294
+ ),
295
+ ParameterDefinition(
296
+ name="min_cols",
297
+ label="Minimum Columns",
298
+ type=ParameterType.INTEGER,
299
+ min_value=0,
300
+ ),
301
+ ParameterDefinition(
302
+ name="max_cols",
303
+ label="Maximum Columns",
304
+ type=ParameterType.INTEGER,
305
+ min_value=0,
306
+ ),
307
+ ],
308
+ tags=["table", "dimensions", "size"],
309
+ severity_default="medium",
310
+ ),
311
+ ValidatorDefinition(
312
+ name="TableRowToColumnRatio",
313
+ display_name="Row to Column Ratio",
314
+ category=ValidatorCategory.TABLE,
315
+ description="Validates the ratio of rows to columns.",
316
+ parameters=[
317
+ ParameterDefinition(
318
+ name="min_ratio",
319
+ label="Minimum Ratio",
320
+ type=ParameterType.FLOAT,
321
+ min_value=0,
322
+ ),
323
+ ParameterDefinition(
324
+ name="max_ratio",
325
+ label="Maximum Ratio",
326
+ type=ParameterType.FLOAT,
327
+ min_value=0,
328
+ ),
329
+ ],
330
+ tags=["table", "ratio", "dimensions"],
331
+ severity_default="low",
332
+ ),
333
+ ValidatorDefinition(
334
+ name="TablePartitionCoverage",
335
+ display_name="Table Partition Coverage",
336
+ category=ValidatorCategory.TABLE,
337
+ description="Validates data coverage across partitions.",
338
+ parameters=[
339
+ ParameterDefinition(
340
+ name="partition_column",
341
+ label="Partition Column",
342
+ type=ParameterType.COLUMN,
343
+ required=True,
344
+ ),
345
+ ParameterDefinition(
346
+ name="expected_partitions",
347
+ label="Expected Partitions",
348
+ type=ParameterType.STRING_LIST,
349
+ description="List of expected partition values",
350
+ ),
351
+ ParameterDefinition(
352
+ name="min_rows_per_partition",
353
+ label="Min Rows Per Partition",
354
+ type=ParameterType.INTEGER,
355
+ default=1,
356
+ min_value=0,
357
+ ),
358
+ ],
359
+ tags=["table", "partition", "coverage"],
360
+ severity_default="medium",
361
+ ),
362
+ ValidatorDefinition(
363
+ name="TableNullRatio",
364
+ display_name="Table Null Ratio",
365
+ category=ValidatorCategory.TABLE,
366
+ description="Validates overall null ratio across the table.",
367
+ parameters=[
368
+ ParameterDefinition(
369
+ name="max_null_ratio",
370
+ label="Max Null Ratio",
371
+ type=ParameterType.FLOAT,
372
+ description="Maximum acceptable null ratio (0.0-1.0)",
373
+ default=0.1,
374
+ min_value=0,
375
+ max_value=1,
376
+ ),
377
+ ParameterDefinition(
378
+ name="columns",
379
+ label="Columns",
380
+ type=ParameterType.COLUMN_LIST,
381
+ description="Columns to check (leave empty for all)",
382
+ ),
383
+ ],
384
+ tags=["table", "null", "completeness"],
385
+ severity_default="medium",
386
+ ),
387
+ ValidatorDefinition(
388
+ name="TableDuplicateRatio",
389
+ display_name="Table Duplicate Ratio",
390
+ category=ValidatorCategory.TABLE,
391
+ description="Validates overall duplicate row ratio.",
392
+ parameters=[
393
+ ParameterDefinition(
394
+ name="max_duplicate_ratio",
395
+ label="Max Duplicate Ratio",
396
+ type=ParameterType.FLOAT,
397
+ description="Maximum acceptable duplicate ratio",
398
+ default=0.01,
399
+ min_value=0,
400
+ max_value=1,
401
+ ),
402
+ ParameterDefinition(
403
+ name="columns",
404
+ label="Columns",
405
+ type=ParameterType.COLUMN_LIST,
406
+ description="Columns to consider for duplicates (leave empty for all)",
407
+ ),
408
+ ],
409
+ tags=["table", "duplicate", "uniqueness"],
410
+ severity_default="medium",
411
+ ),
412
+ ]