superb-ai-onprem 0.9.1__py3-none-any.whl → 0.10.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.
Potentially problematic release.
This version of superb-ai-onprem might be problematic. Click here for more details.
- spb_onprem/__init__.py +39 -4
- spb_onprem/_version.py +2 -2
- spb_onprem/data/entities/__init__.py +2 -0
- spb_onprem/data/entities/data.py +2 -0
- spb_onprem/data/entities/data_annotation_stats.py +8 -0
- spb_onprem/data/params/data_list.py +7 -2
- spb_onprem/data/params/update_data.py +11 -0
- spb_onprem/data/params/update_data_slice.py +14 -2
- spb_onprem/data/queries.py +12 -1
- spb_onprem/data/service.py +9 -0
- spb_onprem/entities.py +24 -2
- spb_onprem/models/__init__.py +8 -3
- spb_onprem/models/entities/__init__.py +9 -0
- spb_onprem/models/entities/model.py +32 -0
- spb_onprem/models/entities/model_page_info.py +14 -0
- spb_onprem/models/entities/model_train_class.py +15 -0
- spb_onprem/models/params/__init__.py +16 -4
- spb_onprem/models/params/create_model.py +70 -0
- spb_onprem/models/params/delete_model.py +11 -8
- spb_onprem/models/params/model.py +17 -0
- spb_onprem/models/params/models.py +60 -0
- spb_onprem/models/params/pin_model.py +17 -0
- spb_onprem/models/params/unpin_model.py +17 -0
- spb_onprem/models/params/update_model.py +61 -0
- spb_onprem/models/queries.py +224 -19
- spb_onprem/models/service.py +251 -30
- spb_onprem/reports/__init__.py +25 -0
- spb_onprem/reports/entities/__init__.py +10 -0
- spb_onprem/reports/entities/analytics_report.py +22 -0
- spb_onprem/reports/entities/analytics_report_item.py +30 -0
- spb_onprem/reports/entities/analytics_report_page_info.py +14 -0
- spb_onprem/reports/params/__init__.py +29 -0
- spb_onprem/reports/params/analytics_report.py +17 -0
- spb_onprem/reports/params/analytics_reports.py +87 -0
- spb_onprem/reports/params/create_analytics_report.py +35 -0
- spb_onprem/reports/params/create_analytics_report_item.py +47 -0
- spb_onprem/reports/params/delete_analytics_report.py +17 -0
- spb_onprem/reports/params/delete_analytics_report_item.py +20 -0
- spb_onprem/reports/params/update_analytics_report.py +38 -0
- spb_onprem/reports/params/update_analytics_report_item.py +46 -0
- spb_onprem/reports/queries.py +239 -0
- spb_onprem/reports/service.py +328 -0
- spb_onprem/searches.py +18 -0
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/METADATA +53 -9
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/RECORD +48 -38
- spb_onprem/models/entities.py +0 -9
- spb_onprem/models/params/get_models.py +0 -29
- spb_onprem/predictions/__init__.py +0 -7
- spb_onprem/predictions/entities.py +0 -11
- spb_onprem/predictions/params/__init__.py +0 -15
- spb_onprem/predictions/params/create_prediction_set.py +0 -44
- spb_onprem/predictions/params/delete_prediction_from_data.py +0 -20
- spb_onprem/predictions/params/delete_prediction_set.py +0 -14
- spb_onprem/predictions/params/get_prediction_set.py +0 -14
- spb_onprem/predictions/params/get_prediction_sets.py +0 -29
- spb_onprem/predictions/params/update_prediction_set_data_info.py +0 -28
- spb_onprem/predictions/queries.py +0 -110
- spb_onprem/predictions/service.py +0 -225
- tests/models/__init__.py +0 -1
- tests/models/test_model_service.py +0 -249
- tests/predictions/__init__.py +0 -1
- tests/predictions/test_prediction_service.py +0 -359
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/WHEEL +0 -0
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/licenses/LICENSE +0 -0
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from .service import ReportService
|
|
2
|
+
from .entities import (
|
|
3
|
+
AnalyticsReport,
|
|
4
|
+
AnalyticsReportItem,
|
|
5
|
+
AnalyticsReportItemType,
|
|
6
|
+
AnalyticsReportPageInfo,
|
|
7
|
+
)
|
|
8
|
+
from .params import (
|
|
9
|
+
AnalyticsReportsFilter,
|
|
10
|
+
AnalyticsReportsFilterOptions,
|
|
11
|
+
AnalyticsReportsOrderBy,
|
|
12
|
+
AnalyticsReportListOrderFields,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = (
|
|
16
|
+
"ReportService",
|
|
17
|
+
"AnalyticsReport",
|
|
18
|
+
"AnalyticsReportItem",
|
|
19
|
+
"AnalyticsReportItemType",
|
|
20
|
+
"AnalyticsReportPageInfo",
|
|
21
|
+
"AnalyticsReportsFilter",
|
|
22
|
+
"AnalyticsReportsFilterOptions",
|
|
23
|
+
"AnalyticsReportsOrderBy",
|
|
24
|
+
"AnalyticsReportListOrderFields",
|
|
25
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from .analytics_report import AnalyticsReport
|
|
2
|
+
from .analytics_report_item import AnalyticsReportItem, AnalyticsReportItemType
|
|
3
|
+
from .analytics_report_page_info import AnalyticsReportPageInfo
|
|
4
|
+
|
|
5
|
+
__all__ = (
|
|
6
|
+
"AnalyticsReport",
|
|
7
|
+
"AnalyticsReportItem",
|
|
8
|
+
"AnalyticsReportItemType",
|
|
9
|
+
"AnalyticsReportPageInfo",
|
|
10
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from typing import Optional, List, Any
|
|
2
|
+
from spb_onprem.base_model import CustomBaseModel, Field
|
|
3
|
+
from .analytics_report_item import AnalyticsReportItem
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AnalyticsReport(CustomBaseModel):
|
|
7
|
+
"""
|
|
8
|
+
분석 리포트 엔터티
|
|
9
|
+
|
|
10
|
+
데이터셋의 분석 리포트를 나타냅니다.
|
|
11
|
+
여러 개의 리포트 아이템(차트, 그래프 등)으로 구성됩니다.
|
|
12
|
+
"""
|
|
13
|
+
id: Optional[str] = Field(None, description="리포트 고유 식별자")
|
|
14
|
+
dataset_id: Optional[str] = Field(None, alias="datasetId", description="이 리포트가 속한 데이터셋 ID")
|
|
15
|
+
title: Optional[str] = Field(None, description="리포트 제목")
|
|
16
|
+
description: Optional[str] = Field(None, description="리포트 설명")
|
|
17
|
+
meta: Optional[dict] = Field(None, description="추가 메타데이터 (JSONObject)")
|
|
18
|
+
created_at: Optional[str] = Field(None, alias="createdAt", description="생성일시 (ISO 8601)")
|
|
19
|
+
created_by: Optional[str] = Field(None, alias="createdBy", description="생성자")
|
|
20
|
+
updated_at: Optional[str] = Field(None, alias="updatedAt", description="수정일시 (ISO 8601)")
|
|
21
|
+
updated_by: Optional[str] = Field(None, alias="updatedBy", description="수정자")
|
|
22
|
+
items: Optional[List[AnalyticsReportItem]] = Field(None, description="리포트 아이템 목록")
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Optional, Any
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from spb_onprem.base_model import CustomBaseModel, Field
|
|
4
|
+
from spb_onprem.contents.entities.base_content import BaseContent
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AnalyticsReportItemType(str, Enum):
|
|
8
|
+
"""분석 리포트 아이템 타입"""
|
|
9
|
+
PIE = "PIE"
|
|
10
|
+
HORIZONTAL_BAR = "HORIZONTAL_BAR"
|
|
11
|
+
VERTICAL_BAR = "VERTICAL_BAR"
|
|
12
|
+
HEATMAP = "HEATMAP"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AnalyticsReportItem(CustomBaseModel):
|
|
16
|
+
"""
|
|
17
|
+
분석 리포트 아이템 엔터티
|
|
18
|
+
|
|
19
|
+
리포트 내의 개별 차트나 시각화 아이템을 나타냅니다.
|
|
20
|
+
"""
|
|
21
|
+
id: Optional[str] = Field(None, description="리포트 아이템 고유 식별자")
|
|
22
|
+
type: Optional[AnalyticsReportItemType] = Field(None, description="리포트 아이템 타입 (PIE, BAR, HEATMAP 등)")
|
|
23
|
+
title: Optional[str] = Field(None, description="리포트 아이템 제목")
|
|
24
|
+
description: Optional[str] = Field(None, description="리포트 아이템 설명")
|
|
25
|
+
content: Optional[BaseContent] = Field(None, description="리포트 아이템 컨텐츠")
|
|
26
|
+
meta: Optional[Any] = Field(None, description="추가 메타데이터 (JSONObject)")
|
|
27
|
+
created_at: Optional[str] = Field(None, alias="createdAt", description="생성일시 (ISO 8601)")
|
|
28
|
+
created_by: Optional[str] = Field(None, alias="createdBy", description="생성자")
|
|
29
|
+
updated_at: Optional[str] = Field(None, alias="updatedAt", description="수정일시 (ISO 8601)")
|
|
30
|
+
updated_by: Optional[str] = Field(None, alias="updatedBy", description="수정자")
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from typing import Optional, List
|
|
2
|
+
from spb_onprem.base_model import CustomBaseModel, Field
|
|
3
|
+
from .analytics_report import AnalyticsReport
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AnalyticsReportPageInfo(CustomBaseModel):
|
|
7
|
+
"""
|
|
8
|
+
분석 리포트 페이지 정보 엔터티
|
|
9
|
+
|
|
10
|
+
분석 리포트 목록 조회 시 페이지네이션 정보를 포함합니다.
|
|
11
|
+
"""
|
|
12
|
+
analytics_reports: Optional[List[AnalyticsReport]] = Field(None, alias="analyticsReports", description="쿼리와 일치하는 리포트 목록")
|
|
13
|
+
next: Optional[str] = Field(None, description="페이지네이션에 사용할 커서")
|
|
14
|
+
total_count: Optional[int] = Field(None, alias="totalCount", description="쿼리와 일치하는 리포트의 총 개수")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from .analytics_report import analytics_report_params
|
|
2
|
+
from .analytics_reports import (
|
|
3
|
+
analytics_reports_params,
|
|
4
|
+
AnalyticsReportsFilter,
|
|
5
|
+
AnalyticsReportsFilterOptions,
|
|
6
|
+
AnalyticsReportsOrderBy,
|
|
7
|
+
AnalyticsReportListOrderFields,
|
|
8
|
+
)
|
|
9
|
+
from .create_analytics_report import create_analytics_report_params
|
|
10
|
+
from .update_analytics_report import update_analytics_report_params
|
|
11
|
+
from .delete_analytics_report import delete_analytics_report_params
|
|
12
|
+
from .create_analytics_report_item import create_analytics_report_item_params
|
|
13
|
+
from .update_analytics_report_item import update_analytics_report_item_params
|
|
14
|
+
from .delete_analytics_report_item import delete_analytics_report_item_params
|
|
15
|
+
|
|
16
|
+
__all__ = (
|
|
17
|
+
"analytics_report_params",
|
|
18
|
+
"analytics_reports_params",
|
|
19
|
+
"create_analytics_report_params",
|
|
20
|
+
"update_analytics_report_params",
|
|
21
|
+
"delete_analytics_report_params",
|
|
22
|
+
"create_analytics_report_item_params",
|
|
23
|
+
"update_analytics_report_item_params",
|
|
24
|
+
"delete_analytics_report_item_params",
|
|
25
|
+
"AnalyticsReportsFilter",
|
|
26
|
+
"AnalyticsReportsFilterOptions",
|
|
27
|
+
"AnalyticsReportsOrderBy",
|
|
28
|
+
"AnalyticsReportListOrderFields",
|
|
29
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
def analytics_report_params(
|
|
2
|
+
report_id: str,
|
|
3
|
+
dataset_id: str,
|
|
4
|
+
):
|
|
5
|
+
"""Get parameters for retrieving a single analytics report.
|
|
6
|
+
|
|
7
|
+
Args:
|
|
8
|
+
report_id: The report ID
|
|
9
|
+
dataset_id: The dataset ID
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
dict: Parameters for retrieving an analytics report
|
|
13
|
+
"""
|
|
14
|
+
return {
|
|
15
|
+
"reportId": report_id,
|
|
16
|
+
"datasetId": dataset_id,
|
|
17
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from typing import Optional, Union
|
|
2
|
+
from enum import Enum
|
|
3
|
+
|
|
4
|
+
from spb_onprem.base_model import CustomBaseModel, Field
|
|
5
|
+
from spb_onprem.base_types import Undefined, UndefinedType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AnalyticsReportListOrderFields(str, Enum):
|
|
9
|
+
"""분석 리포트 정렬 필드"""
|
|
10
|
+
UPDATED_AT = "updatedAt"
|
|
11
|
+
CREATED_AT = "createdAt"
|
|
12
|
+
TITLE = "title"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AnalyticsReportsFilterOptions(CustomBaseModel):
|
|
16
|
+
"""Options for filtering analytics reports.
|
|
17
|
+
|
|
18
|
+
Attributes:
|
|
19
|
+
title_contains: Filter reports by title containing this string
|
|
20
|
+
"""
|
|
21
|
+
title_contains: Optional[str] = Field(None, alias="titleContains")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AnalyticsReportsFilter(CustomBaseModel):
|
|
25
|
+
"""Filter criteria for analytics report queries.
|
|
26
|
+
|
|
27
|
+
Attributes:
|
|
28
|
+
must_filter: Conditions that must be met
|
|
29
|
+
not_filter: Conditions that must not be met
|
|
30
|
+
"""
|
|
31
|
+
must_filter: Optional[AnalyticsReportsFilterOptions] = Field(None, alias="must")
|
|
32
|
+
not_filter: Optional[AnalyticsReportsFilterOptions] = Field(None, alias="not")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AnalyticsReportsOrderBy(CustomBaseModel):
|
|
36
|
+
"""Order by options for analytics reports.
|
|
37
|
+
|
|
38
|
+
Attributes:
|
|
39
|
+
field: The field to order by
|
|
40
|
+
direction: The direction to order (ASC or DESC)
|
|
41
|
+
"""
|
|
42
|
+
field: Optional[AnalyticsReportListOrderFields] = Field(None, description="정렬 필드")
|
|
43
|
+
direction: Optional[str] = Field(None, description="정렬 방향 (ASC or DESC)")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def analytics_reports_params(
|
|
47
|
+
dataset_id: str,
|
|
48
|
+
analytics_reports_filter: Union[
|
|
49
|
+
AnalyticsReportsFilter,
|
|
50
|
+
UndefinedType
|
|
51
|
+
] = Undefined,
|
|
52
|
+
cursor: Optional[str] = None,
|
|
53
|
+
length: Optional[int] = 10,
|
|
54
|
+
order_by: Union[
|
|
55
|
+
AnalyticsReportsOrderBy,
|
|
56
|
+
UndefinedType
|
|
57
|
+
] = Undefined,
|
|
58
|
+
):
|
|
59
|
+
"""Get parameters for listing analytics reports.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
dataset_id: Required dataset ID
|
|
63
|
+
analytics_reports_filter: Optional filter criteria for reports
|
|
64
|
+
cursor: Optional cursor for pagination
|
|
65
|
+
length: Optional number of items per page (default: 10)
|
|
66
|
+
order_by: Optional order by options
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
dict: Parameters for listing analytics reports
|
|
70
|
+
"""
|
|
71
|
+
params = {
|
|
72
|
+
"datasetId": dataset_id,
|
|
73
|
+
"cursor": cursor,
|
|
74
|
+
"length": length,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if analytics_reports_filter and not isinstance(analytics_reports_filter, UndefinedType):
|
|
78
|
+
params["filter"] = analytics_reports_filter.model_dump(
|
|
79
|
+
by_alias=True, exclude_unset=True
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
if order_by and not isinstance(order_by, UndefinedType):
|
|
83
|
+
params["orderBy"] = order_by.model_dump(
|
|
84
|
+
by_alias=True, exclude_unset=True
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
return params
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import Union, Any
|
|
2
|
+
from spb_onprem.base_types import Undefined, UndefinedType
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def create_analytics_report_params(
|
|
6
|
+
dataset_id: str,
|
|
7
|
+
title: Union[str, UndefinedType] = Undefined,
|
|
8
|
+
description: Union[str, UndefinedType] = Undefined,
|
|
9
|
+
meta: Union[Any, UndefinedType] = Undefined,
|
|
10
|
+
):
|
|
11
|
+
"""Get parameters for creating an analytics report.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
dataset_id: The dataset ID
|
|
15
|
+
title: Optional report title
|
|
16
|
+
description: Optional report description
|
|
17
|
+
meta: Optional metadata
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
dict: Parameters for creating an analytics report
|
|
21
|
+
"""
|
|
22
|
+
params = {
|
|
23
|
+
"datasetId": dataset_id,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if not isinstance(title, UndefinedType):
|
|
27
|
+
params["title"] = title
|
|
28
|
+
|
|
29
|
+
if not isinstance(description, UndefinedType):
|
|
30
|
+
params["description"] = description
|
|
31
|
+
|
|
32
|
+
if not isinstance(meta, UndefinedType):
|
|
33
|
+
params["meta"] = meta
|
|
34
|
+
|
|
35
|
+
return params
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from typing import Union, Any
|
|
2
|
+
from spb_onprem.base_types import Undefined, UndefinedType
|
|
3
|
+
from spb_onprem.reports.entities.analytics_report_item import AnalyticsReportItemType
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def create_analytics_report_item_params(
|
|
7
|
+
dataset_id: str,
|
|
8
|
+
report_id: str,
|
|
9
|
+
type: AnalyticsReportItemType,
|
|
10
|
+
title: Union[str, UndefinedType] = Undefined,
|
|
11
|
+
description: Union[str, UndefinedType] = Undefined,
|
|
12
|
+
content_id: Union[str, UndefinedType] = Undefined,
|
|
13
|
+
meta: Union[Any, UndefinedType] = Undefined,
|
|
14
|
+
):
|
|
15
|
+
"""Get parameters for creating an analytics report item.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
dataset_id: The dataset ID
|
|
19
|
+
report_id: The report ID
|
|
20
|
+
type: The type of report item (PIE, HORIZONTAL_BAR, etc.)
|
|
21
|
+
title: Optional item title
|
|
22
|
+
description: Optional item description
|
|
23
|
+
content_id: Optional content ID
|
|
24
|
+
meta: Optional metadata
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
dict: Parameters for creating an analytics report item
|
|
28
|
+
"""
|
|
29
|
+
params = {
|
|
30
|
+
"datasetId": dataset_id,
|
|
31
|
+
"reportId": report_id,
|
|
32
|
+
"type": type.value if isinstance(type, AnalyticsReportItemType) else type,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if not isinstance(title, UndefinedType):
|
|
36
|
+
params["title"] = title
|
|
37
|
+
|
|
38
|
+
if not isinstance(description, UndefinedType):
|
|
39
|
+
params["description"] = description
|
|
40
|
+
|
|
41
|
+
if not isinstance(content_id, UndefinedType):
|
|
42
|
+
params["contentId"] = content_id
|
|
43
|
+
|
|
44
|
+
if not isinstance(meta, UndefinedType):
|
|
45
|
+
params["meta"] = meta
|
|
46
|
+
|
|
47
|
+
return params
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
def delete_analytics_report_params(
|
|
2
|
+
report_id: str,
|
|
3
|
+
dataset_id: str,
|
|
4
|
+
):
|
|
5
|
+
"""Get parameters for deleting an analytics report.
|
|
6
|
+
|
|
7
|
+
Args:
|
|
8
|
+
report_id: The report ID
|
|
9
|
+
dataset_id: The dataset ID
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
dict: Parameters for deleting an analytics report
|
|
13
|
+
"""
|
|
14
|
+
return {
|
|
15
|
+
"reportId": report_id,
|
|
16
|
+
"datasetId": dataset_id,
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
def delete_analytics_report_item_params(
|
|
2
|
+
item_id: str,
|
|
3
|
+
report_id: str,
|
|
4
|
+
dataset_id: str,
|
|
5
|
+
):
|
|
6
|
+
"""Get parameters for deleting an analytics report item.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
item_id: The item ID
|
|
10
|
+
report_id: The report ID
|
|
11
|
+
dataset_id: The dataset ID
|
|
12
|
+
|
|
13
|
+
Returns:
|
|
14
|
+
dict: Parameters for deleting an analytics report item
|
|
15
|
+
"""
|
|
16
|
+
return {
|
|
17
|
+
"itemId": item_id,
|
|
18
|
+
"reportId": report_id,
|
|
19
|
+
"datasetId": dataset_id,
|
|
20
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from typing import Union, Any
|
|
2
|
+
from spb_onprem.base_types import Undefined, UndefinedType
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def update_analytics_report_params(
|
|
6
|
+
dataset_id: str,
|
|
7
|
+
report_id: str,
|
|
8
|
+
title: Union[str, UndefinedType] = Undefined,
|
|
9
|
+
description: Union[str, UndefinedType] = Undefined,
|
|
10
|
+
meta: Union[Any, UndefinedType] = Undefined,
|
|
11
|
+
):
|
|
12
|
+
"""Get parameters for updating an analytics report.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
dataset_id: The dataset ID
|
|
16
|
+
report_id: The report ID
|
|
17
|
+
title: Optional new title
|
|
18
|
+
description: Optional new description
|
|
19
|
+
meta: Optional new metadata
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
dict: Parameters for updating an analytics report
|
|
23
|
+
"""
|
|
24
|
+
params = {
|
|
25
|
+
"datasetId": dataset_id,
|
|
26
|
+
"reportId": report_id,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if not isinstance(title, UndefinedType):
|
|
30
|
+
params["title"] = title
|
|
31
|
+
|
|
32
|
+
if not isinstance(description, UndefinedType):
|
|
33
|
+
params["description"] = description
|
|
34
|
+
|
|
35
|
+
if not isinstance(meta, UndefinedType):
|
|
36
|
+
params["meta"] = meta
|
|
37
|
+
|
|
38
|
+
return params
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from typing import Union, Any
|
|
2
|
+
from spb_onprem.base_types import Undefined, UndefinedType
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def update_analytics_report_item_params(
|
|
6
|
+
dataset_id: str,
|
|
7
|
+
report_id: str,
|
|
8
|
+
item_id: str,
|
|
9
|
+
title: Union[str, UndefinedType] = Undefined,
|
|
10
|
+
description: Union[str, UndefinedType] = Undefined,
|
|
11
|
+
content_id: Union[str, UndefinedType] = Undefined,
|
|
12
|
+
meta: Union[Any, UndefinedType] = Undefined,
|
|
13
|
+
):
|
|
14
|
+
"""Get parameters for updating an analytics report item.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
dataset_id: The dataset ID
|
|
18
|
+
report_id: The report ID
|
|
19
|
+
item_id: The item ID
|
|
20
|
+
title: Optional new title
|
|
21
|
+
description: Optional new description
|
|
22
|
+
content_id: Optional new content ID
|
|
23
|
+
meta: Optional new metadata
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
dict: Parameters for updating an analytics report item
|
|
27
|
+
"""
|
|
28
|
+
params = {
|
|
29
|
+
"datasetId": dataset_id,
|
|
30
|
+
"reportId": report_id,
|
|
31
|
+
"itemId": item_id,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if not isinstance(title, UndefinedType):
|
|
35
|
+
params["title"] = title
|
|
36
|
+
|
|
37
|
+
if not isinstance(description, UndefinedType):
|
|
38
|
+
params["description"] = description
|
|
39
|
+
|
|
40
|
+
if not isinstance(content_id, UndefinedType):
|
|
41
|
+
params["contentId"] = content_id
|
|
42
|
+
|
|
43
|
+
if not isinstance(meta, UndefinedType):
|
|
44
|
+
params["meta"] = meta
|
|
45
|
+
|
|
46
|
+
return params
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
from spb_onprem.reports.params import (
|
|
2
|
+
analytics_report_params,
|
|
3
|
+
analytics_reports_params,
|
|
4
|
+
create_analytics_report_params,
|
|
5
|
+
update_analytics_report_params,
|
|
6
|
+
delete_analytics_report_params,
|
|
7
|
+
create_analytics_report_item_params,
|
|
8
|
+
update_analytics_report_item_params,
|
|
9
|
+
delete_analytics_report_item_params,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Schemas:
|
|
14
|
+
ANALYTICS_REPORT_ITEM = '''
|
|
15
|
+
id
|
|
16
|
+
type
|
|
17
|
+
title
|
|
18
|
+
description
|
|
19
|
+
content {
|
|
20
|
+
id
|
|
21
|
+
downloadURL
|
|
22
|
+
}
|
|
23
|
+
meta
|
|
24
|
+
createdAt
|
|
25
|
+
createdBy
|
|
26
|
+
updatedAt
|
|
27
|
+
updatedBy
|
|
28
|
+
'''
|
|
29
|
+
|
|
30
|
+
ANALYTICS_REPORT = '''
|
|
31
|
+
datasetId
|
|
32
|
+
id
|
|
33
|
+
title
|
|
34
|
+
description
|
|
35
|
+
meta
|
|
36
|
+
createdAt
|
|
37
|
+
updatedAt
|
|
38
|
+
createdBy
|
|
39
|
+
updatedBy
|
|
40
|
+
items {
|
|
41
|
+
id
|
|
42
|
+
type
|
|
43
|
+
title
|
|
44
|
+
description
|
|
45
|
+
content {
|
|
46
|
+
id
|
|
47
|
+
downloadURL
|
|
48
|
+
}
|
|
49
|
+
meta
|
|
50
|
+
createdAt
|
|
51
|
+
createdBy
|
|
52
|
+
updatedAt
|
|
53
|
+
updatedBy
|
|
54
|
+
}
|
|
55
|
+
'''
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class Queries():
|
|
59
|
+
ANALYTICS_REPORT = {
|
|
60
|
+
"name": "analyticsReport",
|
|
61
|
+
"query": f'''
|
|
62
|
+
query AnalyticsReport(
|
|
63
|
+
$reportId: ID!,
|
|
64
|
+
$datasetId: String!
|
|
65
|
+
) {{
|
|
66
|
+
analyticsReport(
|
|
67
|
+
reportId: $reportId,
|
|
68
|
+
datasetId: $datasetId
|
|
69
|
+
) {{
|
|
70
|
+
{Schemas.ANALYTICS_REPORT}
|
|
71
|
+
}}
|
|
72
|
+
}}
|
|
73
|
+
''',
|
|
74
|
+
"variables": analytics_report_params,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ANALYTICS_REPORTS = {
|
|
78
|
+
"name": "analyticsReports",
|
|
79
|
+
"query": f'''
|
|
80
|
+
query AnalyticsReports(
|
|
81
|
+
$datasetId: ID!,
|
|
82
|
+
$filter: AnalyticsReportFilter,
|
|
83
|
+
$cursor: String,
|
|
84
|
+
$length: Int,
|
|
85
|
+
$orderBy: AnalyticsReportOrderBy
|
|
86
|
+
) {{
|
|
87
|
+
analyticsReports(
|
|
88
|
+
datasetId: $datasetId,
|
|
89
|
+
filter: $filter,
|
|
90
|
+
cursor: $cursor,
|
|
91
|
+
length: $length,
|
|
92
|
+
orderBy: $orderBy
|
|
93
|
+
) {{
|
|
94
|
+
analyticsReports {{
|
|
95
|
+
{Schemas.ANALYTICS_REPORT}
|
|
96
|
+
}}
|
|
97
|
+
next
|
|
98
|
+
totalCount
|
|
99
|
+
}}
|
|
100
|
+
}}
|
|
101
|
+
''',
|
|
102
|
+
"variables": analytics_reports_params,
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
CREATE_ANALYTICS_REPORT = {
|
|
106
|
+
"name": "createAnalyticsReport",
|
|
107
|
+
"query": f'''
|
|
108
|
+
mutation CreateAnalyticsReport(
|
|
109
|
+
$datasetId: ID!,
|
|
110
|
+
$title: String,
|
|
111
|
+
$description: String,
|
|
112
|
+
$meta: JSONObject
|
|
113
|
+
) {{
|
|
114
|
+
createAnalyticsReport(
|
|
115
|
+
datasetId: $datasetId,
|
|
116
|
+
title: $title,
|
|
117
|
+
description: $description,
|
|
118
|
+
meta: $meta
|
|
119
|
+
) {{
|
|
120
|
+
{Schemas.ANALYTICS_REPORT}
|
|
121
|
+
}}
|
|
122
|
+
}}
|
|
123
|
+
''',
|
|
124
|
+
"variables": create_analytics_report_params,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
UPDATE_ANALYTICS_REPORT = {
|
|
128
|
+
"name": "updateAnalyticsReport",
|
|
129
|
+
"query": f'''
|
|
130
|
+
mutation UpdateAnalyticsReport(
|
|
131
|
+
$datasetId: ID!,
|
|
132
|
+
$reportId: ID!,
|
|
133
|
+
$title: String,
|
|
134
|
+
$description: String,
|
|
135
|
+
$meta: JSONObject
|
|
136
|
+
) {{
|
|
137
|
+
updateAnalyticsReport(
|
|
138
|
+
datasetId: $datasetId,
|
|
139
|
+
reportId: $reportId,
|
|
140
|
+
title: $title,
|
|
141
|
+
description: $description,
|
|
142
|
+
meta: $meta
|
|
143
|
+
) {{
|
|
144
|
+
{Schemas.ANALYTICS_REPORT}
|
|
145
|
+
}}
|
|
146
|
+
}}
|
|
147
|
+
''',
|
|
148
|
+
"variables": update_analytics_report_params,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
DELETE_ANALYTICS_REPORT = {
|
|
152
|
+
"name": "deleteAnalyticsReport",
|
|
153
|
+
"query": '''
|
|
154
|
+
mutation DeleteAnalyticsReport(
|
|
155
|
+
$reportId: String!,
|
|
156
|
+
$datasetId: String!
|
|
157
|
+
) {
|
|
158
|
+
deleteAnalyticsReport(
|
|
159
|
+
reportId: $reportId,
|
|
160
|
+
datasetId: $datasetId
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
''',
|
|
164
|
+
"variables": delete_analytics_report_params,
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
CREATE_ANALYTICS_REPORT_ITEM = {
|
|
168
|
+
"name": "createAnalyticsReportItem",
|
|
169
|
+
"query": f'''
|
|
170
|
+
mutation CreateAnalyticsReportItem(
|
|
171
|
+
$datasetId: ID!,
|
|
172
|
+
$reportId: ID!,
|
|
173
|
+
$type: AnalyticsReportItemType!,
|
|
174
|
+
$title: String,
|
|
175
|
+
$description: String,
|
|
176
|
+
$contentId: String,
|
|
177
|
+
$meta: JSONObject
|
|
178
|
+
) {{
|
|
179
|
+
createAnalyticsReportItem(
|
|
180
|
+
datasetId: $datasetId,
|
|
181
|
+
reportId: $reportId,
|
|
182
|
+
type: $type,
|
|
183
|
+
title: $title,
|
|
184
|
+
description: $description,
|
|
185
|
+
contentId: $contentId,
|
|
186
|
+
meta: $meta
|
|
187
|
+
) {{
|
|
188
|
+
{Schemas.ANALYTICS_REPORT_ITEM}
|
|
189
|
+
}}
|
|
190
|
+
}}
|
|
191
|
+
''',
|
|
192
|
+
"variables": create_analytics_report_item_params,
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
UPDATE_ANALYTICS_REPORT_ITEM = {
|
|
196
|
+
"name": "updateAnalyticsReportItem",
|
|
197
|
+
"query": f'''
|
|
198
|
+
mutation UpdateAnalyticsReportItem(
|
|
199
|
+
$datasetId: ID!,
|
|
200
|
+
$reportId: ID!,
|
|
201
|
+
$itemId: ID!,
|
|
202
|
+
$title: String,
|
|
203
|
+
$description: String,
|
|
204
|
+
$contentId: String,
|
|
205
|
+
$meta: JSONObject
|
|
206
|
+
) {{
|
|
207
|
+
updateAnalyticsReportItem(
|
|
208
|
+
datasetId: $datasetId,
|
|
209
|
+
reportId: $reportId,
|
|
210
|
+
itemId: $itemId,
|
|
211
|
+
title: $title,
|
|
212
|
+
description: $description,
|
|
213
|
+
contentId: $contentId,
|
|
214
|
+
meta: $meta
|
|
215
|
+
) {{
|
|
216
|
+
{Schemas.ANALYTICS_REPORT_ITEM}
|
|
217
|
+
}}
|
|
218
|
+
}}
|
|
219
|
+
''',
|
|
220
|
+
"variables": update_analytics_report_item_params,
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
DELETE_ANALYTICS_REPORT_ITEM = {
|
|
224
|
+
"name": "deleteAnalyticsReportItem",
|
|
225
|
+
"query": '''
|
|
226
|
+
mutation DeleteAnalyticsReportItem(
|
|
227
|
+
$itemId: String!,
|
|
228
|
+
$reportId: String!,
|
|
229
|
+
$datasetId: String!
|
|
230
|
+
) {
|
|
231
|
+
deleteAnalyticsReportItem(
|
|
232
|
+
itemId: $itemId,
|
|
233
|
+
reportId: $reportId,
|
|
234
|
+
datasetId: $datasetId
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
''',
|
|
238
|
+
"variables": delete_analytics_report_item_params,
|
|
239
|
+
}
|