arthur-common 1.0.1__py3-none-any.whl → 2.1.48__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.
Potentially problematic release.
This version of arthur-common might be problematic. Click here for more details.
- arthur_common/aggregations/aggregator.py +10 -1
- arthur_common/aggregations/functions/categorical_count.py +51 -11
- arthur_common/aggregations/functions/confusion_matrix.py +122 -28
- arthur_common/aggregations/functions/inference_count.py +46 -9
- arthur_common/aggregations/functions/inference_count_by_class.py +101 -24
- arthur_common/aggregations/functions/inference_null_count.py +50 -10
- arthur_common/aggregations/functions/mean_absolute_error.py +55 -15
- arthur_common/aggregations/functions/mean_squared_error.py +55 -15
- arthur_common/aggregations/functions/multiclass_confusion_matrix.py +78 -24
- arthur_common/aggregations/functions/multiclass_inference_count_by_class.py +19 -1
- arthur_common/aggregations/functions/numeric_stats.py +46 -9
- arthur_common/aggregations/functions/numeric_sum.py +52 -12
- arthur_common/models/connectors.py +6 -1
- arthur_common/models/metrics.py +5 -9
- arthur_common/models/schema_definitions.py +2 -0
- arthur_common/tools/aggregation_analyzer.py +31 -1
- arthur_common/tools/duckdb_data_loader.py +1 -1
- {arthur_common-1.0.1.dist-info → arthur_common-2.1.48.dist-info}/METADATA +1 -4
- {arthur_common-1.0.1.dist-info → arthur_common-2.1.48.dist-info}/RECORD +20 -21
- arthur_common/__version__.py +0 -1
- {arthur_common-1.0.1.dist-info → arthur_common-2.1.48.dist-info}/WHEEL +0 -0
|
@@ -4,7 +4,6 @@ from pydantic import BaseModel, Field
|
|
|
4
4
|
class ConnectorPaginationOptions(BaseModel):
|
|
5
5
|
page: int = Field(default=1, ge=1)
|
|
6
6
|
page_size: int = Field(default=25, gt=0, le=500)
|
|
7
|
-
# comment to run pipeline
|
|
8
7
|
|
|
9
8
|
@property
|
|
10
9
|
def page_params(self) -> tuple[int, int]:
|
|
@@ -30,6 +29,12 @@ GOOGLE_CONNECTOR_PROJECT_ID_FIELD = "project_id"
|
|
|
30
29
|
GOOGLE_CONNECTOR_LOCATION_FIELD = "location"
|
|
31
30
|
SHIELD_CONNECTOR_API_KEY_FIELD = "api_key"
|
|
32
31
|
SHIELD_CONNECTOR_ENDPOINT_FIELD = "endpoint"
|
|
32
|
+
MSSQL_CONNECTOR_HOST_FIELD = "host"
|
|
33
|
+
MSSQL_CONNECTOR_PORT_FIELD = "port"
|
|
34
|
+
MSSQL_CONNECTOR_DATABASE_FIELD = "database"
|
|
35
|
+
MSSQL_CONNECTOR_USERNAME_FIELD = "username"
|
|
36
|
+
MSSQL_CONNECTOR_PASSWORD_FIELD = "password"
|
|
37
|
+
MSSQL_CONNECTOR_DRIVER_FIELD = "driver"
|
|
33
38
|
|
|
34
39
|
# dataset (connector type dependent) constants
|
|
35
40
|
SHIELD_DATASET_TASK_ID_FIELD = "task_id"
|
arthur_common/models/metrics.py
CHANGED
|
@@ -166,7 +166,7 @@ class MetricsColumnParameterSchema(MetricsParameterSchema):
|
|
|
166
166
|
|
|
167
167
|
|
|
168
168
|
# Not used /implemented yet. Might turn into group by column list
|
|
169
|
-
class MetricsColumnListParameterSchema(
|
|
169
|
+
class MetricsColumnListParameterSchema(MetricsColumnParameterSchema):
|
|
170
170
|
parameter_type: Literal["column_list"] = "column_list"
|
|
171
171
|
|
|
172
172
|
|
|
@@ -202,13 +202,6 @@ class AggregationSpecSchema(BaseModel):
|
|
|
202
202
|
description="List of parameters to the aggregation's aggregate function.",
|
|
203
203
|
)
|
|
204
204
|
|
|
205
|
-
def parameter_is_column_reference(self, parameter_name: str) -> bool:
|
|
206
|
-
return any(
|
|
207
|
-
param.parameter_key == parameter_name
|
|
208
|
-
and isinstance(param, MetricsColumnParameterSchema)
|
|
209
|
-
for param in self.aggregate_args
|
|
210
|
-
)
|
|
211
|
-
|
|
212
205
|
@model_validator(mode="after")
|
|
213
206
|
def column_dataset_references_exist(self) -> Self:
|
|
214
207
|
dataset_parameter_keys = [
|
|
@@ -218,7 +211,10 @@ class AggregationSpecSchema(BaseModel):
|
|
|
218
211
|
]
|
|
219
212
|
for param in self.aggregate_args:
|
|
220
213
|
if (
|
|
221
|
-
isinstance(
|
|
214
|
+
isinstance(
|
|
215
|
+
param,
|
|
216
|
+
(MetricsColumnParameterSchema, MetricsColumnListParameterSchema),
|
|
217
|
+
)
|
|
222
218
|
and param.source_dataset_parameter_key not in dataset_parameter_keys
|
|
223
219
|
):
|
|
224
220
|
raise ValueError(
|
|
@@ -17,6 +17,7 @@ class ScopeSchemaTag(str, Enum):
|
|
|
17
17
|
CONTINUOUS = "continuous"
|
|
18
18
|
PREDICTION = "prediction"
|
|
19
19
|
GROUND_TRUTH = "ground_truth"
|
|
20
|
+
PIN_IN_DEEP_DIVE = "pin_in_deep_dive"
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class DType(str, Enum):
|
|
@@ -29,6 +30,7 @@ class DType(str, Enum):
|
|
|
29
30
|
TIMESTAMP = "timestamp"
|
|
30
31
|
DATE = "date"
|
|
31
32
|
JSON = "json"
|
|
33
|
+
IMAGE = "image"
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
class MetricParameterAnnotation(BaseModel):
|
|
@@ -13,6 +13,7 @@ from arthur_common.models.metrics import (
|
|
|
13
13
|
AggregationMetricType,
|
|
14
14
|
AggregationSpecSchema,
|
|
15
15
|
DatasetReference,
|
|
16
|
+
MetricsColumnListParameterSchema,
|
|
16
17
|
MetricsColumnParameterSchema,
|
|
17
18
|
MetricsDatasetParameterSchema,
|
|
18
19
|
MetricsLiteralParameterSchema,
|
|
@@ -23,6 +24,7 @@ from arthur_common.models.schema_definitions import (
|
|
|
23
24
|
MetricColumnParameterAnnotation,
|
|
24
25
|
MetricDatasetParameterAnnotation,
|
|
25
26
|
MetricLiteralParameterAnnotation,
|
|
27
|
+
MetricMultipleColumnParameterAnnotation,
|
|
26
28
|
MetricsParameterAnnotationUnion,
|
|
27
29
|
)
|
|
28
30
|
|
|
@@ -44,6 +46,19 @@ class FunctionAnalyzer:
|
|
|
44
46
|
return DType.UUID
|
|
45
47
|
elif t is DatasetReference:
|
|
46
48
|
return DType.UUID
|
|
49
|
+
elif typing.get_origin(t) is list:
|
|
50
|
+
return DType.JSON
|
|
51
|
+
elif typing.get_origin(t) is typing.Union:
|
|
52
|
+
# handle union types to add support for Optional types only
|
|
53
|
+
# extract the non-None type from Optional[T] = Union[T, None]
|
|
54
|
+
args = typing.get_args(t)
|
|
55
|
+
non_none_args = [arg for arg in args if arg is not type(None)]
|
|
56
|
+
if len(non_none_args) == 1:
|
|
57
|
+
return FunctionAnalyzer._python_type_to_scope_dtype(non_none_args[0])
|
|
58
|
+
else:
|
|
59
|
+
raise ValueError(
|
|
60
|
+
f"Union type {t} is not supported (only Optional[T] is supported).",
|
|
61
|
+
)
|
|
47
62
|
else:
|
|
48
63
|
raise ValueError(f"Parameter type {t} is not supported.")
|
|
49
64
|
|
|
@@ -69,7 +84,7 @@ class FunctionAnalyzer:
|
|
|
69
84
|
@staticmethod
|
|
70
85
|
def _get_scope_metric_parameter_from_annotation(
|
|
71
86
|
param_name: str,
|
|
72
|
-
param_dtype: DType,
|
|
87
|
+
param_dtype: typing.Optional[DType],
|
|
73
88
|
optional: bool,
|
|
74
89
|
annotation: typing.Annotated, # type: ignore
|
|
75
90
|
) -> MetricsParameterSchemaUnion:
|
|
@@ -101,6 +116,21 @@ class FunctionAnalyzer:
|
|
|
101
116
|
description=annotation.description,
|
|
102
117
|
model_problem_type=annotation.model_problem_type,
|
|
103
118
|
)
|
|
119
|
+
elif isinstance(annotation, MetricMultipleColumnParameterAnnotation):
|
|
120
|
+
if param_dtype != DType.JSON:
|
|
121
|
+
raise ValueError(
|
|
122
|
+
f"Dataset parameter {param_name} has type {param_dtype}, but should be a JSON type (valid list expected).",
|
|
123
|
+
)
|
|
124
|
+
return MetricsColumnListParameterSchema(
|
|
125
|
+
parameter_key=param_name,
|
|
126
|
+
tag_hints=annotation.tag_hints,
|
|
127
|
+
optional=optional,
|
|
128
|
+
source_dataset_parameter_key=annotation.source_dataset_parameter_key,
|
|
129
|
+
allowed_column_types=annotation.allowed_column_types,
|
|
130
|
+
allow_any_column_type=annotation.allow_any_column_type,
|
|
131
|
+
friendly_name=annotation.friendly_name,
|
|
132
|
+
description=annotation.description,
|
|
133
|
+
)
|
|
104
134
|
elif isinstance(annotation, MetricColumnParameterAnnotation):
|
|
105
135
|
if param_dtype != DType.STRING:
|
|
106
136
|
raise ValueError(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: arthur-common
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 2.1.48
|
|
4
4
|
Summary: Utility code common to Arthur platform components.
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Arthur
|
|
@@ -69,6 +69,3 @@ This project is licensed under the MIT License.
|
|
|
69
69
|
|
|
70
70
|
- Arthur <engineering@arthur.ai>
|
|
71
71
|
|
|
72
|
-
# ALEX
|
|
73
|
-
- Change for testing
|
|
74
|
-
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
arthur_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
arthur_common/__version__.py,sha256=d4QHYmS_30j0hPN8NmNPnQ_Z0TphDRbu4MtQj9cT9e8,22
|
|
3
2
|
arthur_common/aggregations/__init__.py,sha256=vISWyciQAtksa71OKeHNP-QyFGd1NzBKq_LBsG0QSG8,67
|
|
4
|
-
arthur_common/aggregations/aggregator.py,sha256=
|
|
3
|
+
arthur_common/aggregations/aggregator.py,sha256=8J0TRYjQdwf0qXBnoZ4ETJVCdo4UIyvQnBTZCypY7Fo,7713
|
|
5
4
|
arthur_common/aggregations/functions/README.md,sha256=MkZoTAJ94My96R5Z8GAxud7S6vyR0vgVi9gqdt9a4XY,5460
|
|
6
5
|
arthur_common/aggregations/functions/__init__.py,sha256=HqC3UNRURX7ZQHgamTrQvfA8u_FiZGZ4I4eQW7Ooe5o,1299
|
|
7
|
-
arthur_common/aggregations/functions/categorical_count.py,sha256=
|
|
8
|
-
arthur_common/aggregations/functions/confusion_matrix.py,sha256=
|
|
9
|
-
arthur_common/aggregations/functions/inference_count.py,sha256=
|
|
10
|
-
arthur_common/aggregations/functions/inference_count_by_class.py,sha256=
|
|
11
|
-
arthur_common/aggregations/functions/inference_null_count.py,sha256=
|
|
12
|
-
arthur_common/aggregations/functions/mean_absolute_error.py,sha256=
|
|
13
|
-
arthur_common/aggregations/functions/mean_squared_error.py,sha256=
|
|
14
|
-
arthur_common/aggregations/functions/multiclass_confusion_matrix.py,sha256=
|
|
15
|
-
arthur_common/aggregations/functions/multiclass_inference_count_by_class.py,sha256=
|
|
16
|
-
arthur_common/aggregations/functions/numeric_stats.py,sha256=
|
|
17
|
-
arthur_common/aggregations/functions/numeric_sum.py,sha256=
|
|
6
|
+
arthur_common/aggregations/functions/categorical_count.py,sha256=W0xIpqqSElRpGBPpvztoZBpDO5QtiGYpaMVOQ3piS-4,5077
|
|
7
|
+
arthur_common/aggregations/functions/confusion_matrix.py,sha256=fZ5SeFcENjGyoCqecRTF9Y0Ub-RzsA-SlZ8cEHzUvnM,21111
|
|
8
|
+
arthur_common/aggregations/functions/inference_count.py,sha256=jIhuh_NjL82NA84qJD2VI3FVRgZCSFjfcME3Hr_slpg,3832
|
|
9
|
+
arthur_common/aggregations/functions/inference_count_by_class.py,sha256=JKTOhXSP3hBz28u10AvA8OyDi7P68Fv7NP6j_M7kXCQ,11066
|
|
10
|
+
arthur_common/aggregations/functions/inference_null_count.py,sha256=l-yuVX7OJQGk-vvnkuXJPD-mEI1ZzwGjbzeihwSDT_M,4566
|
|
11
|
+
arthur_common/aggregations/functions/mean_absolute_error.py,sha256=pgputW69w0DUT4xbj2nfnPpqliHZAtvh7TQnBfPQ584,6000
|
|
12
|
+
arthur_common/aggregations/functions/mean_squared_error.py,sha256=o9TTdlBb1lX57kWqoMRdTNacXcEa_VH-AkfT6SL1xGs,6032
|
|
13
|
+
arthur_common/aggregations/functions/multiclass_confusion_matrix.py,sha256=47CVl-Wo40jDeKvSKHeWB2DFFTDo_ichXPGyMmlVEmo,10973
|
|
14
|
+
arthur_common/aggregations/functions/multiclass_inference_count_by_class.py,sha256=gLdjXKvQ_WDscc3zksH92LGHhuknkjf6oAF63-cwbJo,3978
|
|
15
|
+
arthur_common/aggregations/functions/numeric_stats.py,sha256=9zyroFSYXXELnz4MKow8v06-tPVL23COVafoLHaHgVc,4676
|
|
16
|
+
arthur_common/aggregations/functions/numeric_sum.py,sha256=f0ZIYqPjBsyCh-V8ktHpDIs1_4wjjPENboC607i5O3c,4785
|
|
18
17
|
arthur_common/aggregations/functions/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
18
|
arthur_common/aggregations/functions/shield_aggregations.py,sha256=nkMlj9V7NIKeRP46jpsrlfB741RHk2CgwimD7BYp9To,31540
|
|
20
19
|
arthur_common/aggregations/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
20
|
arthur_common/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
arthur_common/models/connectors.py,sha256=
|
|
21
|
+
arthur_common/models/connectors.py,sha256=hj8epo32MjtDgWGon1U4l__Ls6pf8nFp2v_jrUYUTCI,1799
|
|
23
22
|
arthur_common/models/datasets.py,sha256=giG_8mv_3ilBf7cIvRV0_TDCDdb4qxRbYZvl7hRb6l8,491
|
|
24
|
-
arthur_common/models/metrics.py,sha256=
|
|
23
|
+
arthur_common/models/metrics.py,sha256=ZfsDL3aPdhZ1-E1-wlRyZT4lZNzz2A3qL-jDrqJbQdY,8217
|
|
25
24
|
arthur_common/models/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
-
arthur_common/models/schema_definitions.py,sha256=
|
|
25
|
+
arthur_common/models/schema_definitions.py,sha256=WBJ6JvBCvThlMBGQsbiAwi9QYjhG9KyURyjE8an8-yE,14633
|
|
27
26
|
arthur_common/models/shield.py,sha256=1ZblfULKCf5BEvYURO5WScyfmijGwjAmcj0XADlF-XY,19110
|
|
28
27
|
arthur_common/models/task_job_specs.py,sha256=GLJ7qmrb5eXnl5PiV27nnx_yG4S4sc4NDJ8-6xmNDLM,2796
|
|
29
28
|
arthur_common/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
29
|
arthur_common/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
|
-
arthur_common/tools/aggregation_analyzer.py,sha256=
|
|
30
|
+
arthur_common/tools/aggregation_analyzer.py,sha256=IOpGfj-aihjUNo_L5iI47x2EuJWXAW0FKOUMzNca7ek,11130
|
|
32
31
|
arthur_common/tools/aggregation_loader.py,sha256=3CF46bNi-GdJBNOXkjYfCQ1Aung8lf65L532sdWmR_s,2351
|
|
33
|
-
arthur_common/tools/duckdb_data_loader.py,sha256=
|
|
32
|
+
arthur_common/tools/duckdb_data_loader.py,sha256=ywvFpI1qioK5Is-S7XxBqgQmQNY6u21qibKygTAW0Oo,11080
|
|
34
33
|
arthur_common/tools/functions.py,sha256=FWL4eWO5-vLp86WudT-MGUKvf2B8f02IdoXQFKd6d8k,1093
|
|
35
34
|
arthur_common/tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
35
|
arthur_common/tools/schema_inferer.py,sha256=PkAOHZRk_rZ1OZSigYrfzH-jERb9B_Gu7pOMl9WJQA8,4202
|
|
37
36
|
arthur_common/tools/time_utils.py,sha256=4gfiu9NXfvPZltiVNLSIQGylX6h2W0viNi9Kv4bKyfw,1410
|
|
38
|
-
arthur_common-1.
|
|
39
|
-
arthur_common-1.
|
|
40
|
-
arthur_common-1.
|
|
37
|
+
arthur_common-2.1.48.dist-info/METADATA,sha256=seHFqwRDe2hVB1k-mNZRKd2ZgdOMNAhJjfzh8srCkk8,1568
|
|
38
|
+
arthur_common-2.1.48.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
39
|
+
arthur_common-2.1.48.dist-info/RECORD,,
|
arthur_common/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.1"
|
|
File without changes
|