neurograph-core 1.202510092220__py3-none-any.whl → 1.202510232007__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 (33) hide show
  1. neurograph/v1/__init__.py +0 -34
  2. neurograph/v1/api/admin_api.py +8 -8
  3. neurograph/v1/api/reporting_api.py +36 -1475
  4. neurograph/v1/models/__init__.py +0 -17
  5. neurograph/v1/models/admin_user_detail_response.py +11 -4
  6. neurograph/v1/models/db_user_client_role.py +6 -2
  7. neurograph/v1/models/db_user_in_db.py +11 -4
  8. neurograph/v1/models/db_user_org_role.py +6 -2
  9. neurograph/v1/models/db_user_role.py +6 -2
  10. neurograph/v1/models/knowledge_enrichment_artifact_create_request.py +3 -1
  11. neurograph/v1/models/reporting_daily_metric.py +23 -7
  12. neurograph/v1/models/reporting_query.py +4 -2
  13. {neurograph_core-1.202510092220.dist-info → neurograph_core-1.202510232007.dist-info}/METADATA +1 -1
  14. {neurograph_core-1.202510092220.dist-info → neurograph_core-1.202510232007.dist-info}/RECORD +16 -33
  15. neurograph/v1/models/reporting_affinities_response.py +0 -89
  16. neurograph/v1/models/reporting_chart_data.py +0 -97
  17. neurograph/v1/models/reporting_chart_dataset.py +0 -93
  18. neurograph/v1/models/reporting_chart_defaults.py +0 -91
  19. neurograph/v1/models/reporting_chart_options.py +0 -93
  20. neurograph/v1/models/reporting_content_config.py +0 -113
  21. neurograph/v1/models/reporting_customer_activity_response.py +0 -89
  22. neurograph/v1/models/reporting_data_range.py +0 -89
  23. neurograph/v1/models/reporting_exploration_topic.py +0 -91
  24. neurograph/v1/models/reporting_header_config.py +0 -89
  25. neurograph/v1/models/reporting_meta_config.py +0 -99
  26. neurograph/v1/models/reporting_persona_activity_response.py +0 -89
  27. neurograph/v1/models/reporting_personas_response.py +0 -89
  28. neurograph/v1/models/reporting_primary_analysis.py +0 -99
  29. neurograph/v1/models/reporting_rich_insights_config.py +0 -97
  30. neurograph/v1/models/reporting_visualization.py +0 -103
  31. neurograph/v1/models/reporting_visualization_insights.py +0 -91
  32. {neurograph_core-1.202510092220.dist-info → neurograph_core-1.202510232007.dist-info}/WHEEL +0 -0
  33. {neurograph_core-1.202510092220.dist-info → neurograph_core-1.202510232007.dist-info}/top_level.txt +0 -0
@@ -1,89 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Neurograph Core
5
-
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
-
8
- The version of the OpenAPI document: 1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
- class ReportingHeaderConfig(BaseModel):
26
- """
27
- ReportingHeaderConfig
28
- """ # noqa: E501
29
- subtitle: Optional[StrictStr] = None
30
- title: Optional[StrictStr] = None
31
- __properties: ClassVar[List[str]] = ["subtitle", "title"]
32
-
33
- model_config = ConfigDict(
34
- populate_by_name=True,
35
- validate_assignment=True,
36
- protected_namespaces=(),
37
- )
38
-
39
-
40
- def to_str(self) -> str:
41
- """Returns the string representation of the model using alias"""
42
- return pprint.pformat(self.model_dump(by_alias=True))
43
-
44
- def to_json(self) -> str:
45
- """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
-
49
- @classmethod
50
- def from_json(cls, json_str: str) -> Optional[Self]:
51
- """Create an instance of ReportingHeaderConfig from a JSON string"""
52
- return cls.from_dict(json.loads(json_str))
53
-
54
- def to_dict(self) -> Dict[str, Any]:
55
- """Return the dictionary representation of the model using alias.
56
-
57
- This has the following differences from calling pydantic's
58
- `self.model_dump(by_alias=True)`:
59
-
60
- * `None` is only added to the output dict for nullable fields that
61
- were set at model initialization. Other fields with value `None`
62
- are ignored.
63
- """
64
- excluded_fields: Set[str] = set([
65
- ])
66
-
67
- _dict = self.model_dump(
68
- by_alias=True,
69
- exclude=excluded_fields,
70
- exclude_none=True,
71
- )
72
- return _dict
73
-
74
- @classmethod
75
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
- """Create an instance of ReportingHeaderConfig from a dict"""
77
- if obj is None:
78
- return None
79
-
80
- if not isinstance(obj, dict):
81
- return cls.model_validate(obj)
82
-
83
- _obj = cls.model_validate({
84
- "subtitle": obj.get("subtitle"),
85
- "title": obj.get("title")
86
- })
87
- return _obj
88
-
89
-
@@ -1,99 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Neurograph Core
5
-
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
-
8
- The version of the OpenAPI document: 1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from neurograph.v1.models.reporting_data_range import ReportingDataRange
23
- from typing import Optional, Set
24
- from typing_extensions import Self
25
-
26
- class ReportingMetaConfig(BaseModel):
27
- """
28
- ReportingMetaConfig
29
- """ # noqa: E501
30
- analysis_type: Optional[StrictStr] = Field(default=None, alias="analysisType")
31
- data_range: Optional[ReportingDataRange] = Field(default=None, alias="dataRange")
32
- entity_subtype: Optional[StrictStr] = Field(default=None, alias="entitySubtype")
33
- entity_type: Optional[StrictStr] = Field(default=None, alias="entityType")
34
- generated_at: Optional[StrictStr] = Field(default=None, alias="generatedAt")
35
- __properties: ClassVar[List[str]] = ["analysisType", "dataRange", "entitySubtype", "entityType", "generatedAt"]
36
-
37
- model_config = ConfigDict(
38
- populate_by_name=True,
39
- validate_assignment=True,
40
- protected_namespaces=(),
41
- )
42
-
43
-
44
- def to_str(self) -> str:
45
- """Returns the string representation of the model using alias"""
46
- return pprint.pformat(self.model_dump(by_alias=True))
47
-
48
- def to_json(self) -> str:
49
- """Returns the JSON representation of the model using alias"""
50
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
- return json.dumps(self.to_dict())
52
-
53
- @classmethod
54
- def from_json(cls, json_str: str) -> Optional[Self]:
55
- """Create an instance of ReportingMetaConfig from a JSON string"""
56
- return cls.from_dict(json.loads(json_str))
57
-
58
- def to_dict(self) -> Dict[str, Any]:
59
- """Return the dictionary representation of the model using alias.
60
-
61
- This has the following differences from calling pydantic's
62
- `self.model_dump(by_alias=True)`:
63
-
64
- * `None` is only added to the output dict for nullable fields that
65
- were set at model initialization. Other fields with value `None`
66
- are ignored.
67
- """
68
- excluded_fields: Set[str] = set([
69
- ])
70
-
71
- _dict = self.model_dump(
72
- by_alias=True,
73
- exclude=excluded_fields,
74
- exclude_none=True,
75
- )
76
- # override the default output from pydantic by calling `to_dict()` of data_range
77
- if self.data_range:
78
- _dict['dataRange'] = self.data_range.to_dict()
79
- return _dict
80
-
81
- @classmethod
82
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
- """Create an instance of ReportingMetaConfig from a dict"""
84
- if obj is None:
85
- return None
86
-
87
- if not isinstance(obj, dict):
88
- return cls.model_validate(obj)
89
-
90
- _obj = cls.model_validate({
91
- "analysisType": obj.get("analysisType"),
92
- "dataRange": ReportingDataRange.from_dict(obj["dataRange"]) if obj.get("dataRange") is not None else None,
93
- "entitySubtype": obj.get("entitySubtype"),
94
- "entityType": obj.get("entityType"),
95
- "generatedAt": obj.get("generatedAt")
96
- })
97
- return _obj
98
-
99
-
@@ -1,89 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Neurograph Core
5
-
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
-
8
- The version of the OpenAPI document: 1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
- class ReportingPersonaActivityResponse(BaseModel):
26
- """
27
- ReportingPersonaActivityResponse
28
- """ # noqa: E501
29
- activities: Optional[Dict[str, Any]] = None
30
- error: Optional[StrictStr] = None
31
- __properties: ClassVar[List[str]] = ["activities", "error"]
32
-
33
- model_config = ConfigDict(
34
- populate_by_name=True,
35
- validate_assignment=True,
36
- protected_namespaces=(),
37
- )
38
-
39
-
40
- def to_str(self) -> str:
41
- """Returns the string representation of the model using alias"""
42
- return pprint.pformat(self.model_dump(by_alias=True))
43
-
44
- def to_json(self) -> str:
45
- """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
-
49
- @classmethod
50
- def from_json(cls, json_str: str) -> Optional[Self]:
51
- """Create an instance of ReportingPersonaActivityResponse from a JSON string"""
52
- return cls.from_dict(json.loads(json_str))
53
-
54
- def to_dict(self) -> Dict[str, Any]:
55
- """Return the dictionary representation of the model using alias.
56
-
57
- This has the following differences from calling pydantic's
58
- `self.model_dump(by_alias=True)`:
59
-
60
- * `None` is only added to the output dict for nullable fields that
61
- were set at model initialization. Other fields with value `None`
62
- are ignored.
63
- """
64
- excluded_fields: Set[str] = set([
65
- ])
66
-
67
- _dict = self.model_dump(
68
- by_alias=True,
69
- exclude=excluded_fields,
70
- exclude_none=True,
71
- )
72
- return _dict
73
-
74
- @classmethod
75
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
- """Create an instance of ReportingPersonaActivityResponse from a dict"""
77
- if obj is None:
78
- return None
79
-
80
- if not isinstance(obj, dict):
81
- return cls.model_validate(obj)
82
-
83
- _obj = cls.model_validate({
84
- "activities": obj.get("activities"),
85
- "error": obj.get("error")
86
- })
87
- return _obj
88
-
89
-
@@ -1,89 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Neurograph Core
5
-
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
-
8
- The version of the OpenAPI document: 1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
- class ReportingPersonasResponse(BaseModel):
26
- """
27
- ReportingPersonasResponse
28
- """ # noqa: E501
29
- error: Optional[StrictStr] = None
30
- personas: Optional[Dict[str, Any]] = None
31
- __properties: ClassVar[List[str]] = ["error", "personas"]
32
-
33
- model_config = ConfigDict(
34
- populate_by_name=True,
35
- validate_assignment=True,
36
- protected_namespaces=(),
37
- )
38
-
39
-
40
- def to_str(self) -> str:
41
- """Returns the string representation of the model using alias"""
42
- return pprint.pformat(self.model_dump(by_alias=True))
43
-
44
- def to_json(self) -> str:
45
- """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
-
49
- @classmethod
50
- def from_json(cls, json_str: str) -> Optional[Self]:
51
- """Create an instance of ReportingPersonasResponse from a JSON string"""
52
- return cls.from_dict(json.loads(json_str))
53
-
54
- def to_dict(self) -> Dict[str, Any]:
55
- """Return the dictionary representation of the model using alias.
56
-
57
- This has the following differences from calling pydantic's
58
- `self.model_dump(by_alias=True)`:
59
-
60
- * `None` is only added to the output dict for nullable fields that
61
- were set at model initialization. Other fields with value `None`
62
- are ignored.
63
- """
64
- excluded_fields: Set[str] = set([
65
- ])
66
-
67
- _dict = self.model_dump(
68
- by_alias=True,
69
- exclude=excluded_fields,
70
- exclude_none=True,
71
- )
72
- return _dict
73
-
74
- @classmethod
75
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
- """Create an instance of ReportingPersonasResponse from a dict"""
77
- if obj is None:
78
- return None
79
-
80
- if not isinstance(obj, dict):
81
- return cls.model_validate(obj)
82
-
83
- _obj = cls.model_validate({
84
- "error": obj.get("error"),
85
- "personas": obj.get("personas")
86
- })
87
- return _obj
88
-
89
-
@@ -1,99 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Neurograph Core
5
-
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
-
8
- The version of the OpenAPI document: 1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from neurograph.v1.models.reporting_exploration_topic import ReportingExplorationTopic
23
- from typing import Optional, Set
24
- from typing_extensions import Self
25
-
26
- class ReportingPrimaryAnalysis(BaseModel):
27
- """
28
- ReportingPrimaryAnalysis
29
- """ # noqa: E501
30
- exploration_topics: Optional[List[ReportingExplorationTopic]] = Field(default=None, alias="explorationTopics")
31
- key_findings: Optional[List[StrictStr]] = Field(default=None, alias="keyFindings")
32
- summary: Optional[StrictStr] = None
33
- __properties: ClassVar[List[str]] = ["explorationTopics", "keyFindings", "summary"]
34
-
35
- model_config = ConfigDict(
36
- populate_by_name=True,
37
- validate_assignment=True,
38
- protected_namespaces=(),
39
- )
40
-
41
-
42
- def to_str(self) -> str:
43
- """Returns the string representation of the model using alias"""
44
- return pprint.pformat(self.model_dump(by_alias=True))
45
-
46
- def to_json(self) -> str:
47
- """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
-
51
- @classmethod
52
- def from_json(cls, json_str: str) -> Optional[Self]:
53
- """Create an instance of ReportingPrimaryAnalysis from a JSON string"""
54
- return cls.from_dict(json.loads(json_str))
55
-
56
- def to_dict(self) -> Dict[str, Any]:
57
- """Return the dictionary representation of the model using alias.
58
-
59
- This has the following differences from calling pydantic's
60
- `self.model_dump(by_alias=True)`:
61
-
62
- * `None` is only added to the output dict for nullable fields that
63
- were set at model initialization. Other fields with value `None`
64
- are ignored.
65
- """
66
- excluded_fields: Set[str] = set([
67
- ])
68
-
69
- _dict = self.model_dump(
70
- by_alias=True,
71
- exclude=excluded_fields,
72
- exclude_none=True,
73
- )
74
- # override the default output from pydantic by calling `to_dict()` of each item in exploration_topics (list)
75
- _items = []
76
- if self.exploration_topics:
77
- for _item_exploration_topics in self.exploration_topics:
78
- if _item_exploration_topics:
79
- _items.append(_item_exploration_topics.to_dict())
80
- _dict['explorationTopics'] = _items
81
- return _dict
82
-
83
- @classmethod
84
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
- """Create an instance of ReportingPrimaryAnalysis from a dict"""
86
- if obj is None:
87
- return None
88
-
89
- if not isinstance(obj, dict):
90
- return cls.model_validate(obj)
91
-
92
- _obj = cls.model_validate({
93
- "explorationTopics": [ReportingExplorationTopic.from_dict(_item) for _item in obj["explorationTopics"]] if obj.get("explorationTopics") is not None else None,
94
- "keyFindings": obj.get("keyFindings"),
95
- "summary": obj.get("summary")
96
- })
97
- return _obj
98
-
99
-
@@ -1,97 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Neurograph Core
5
-
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
-
8
- The version of the OpenAPI document: 1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from neurograph.v1.models.reporting_content_config import ReportingContentConfig
23
- from neurograph.v1.models.reporting_meta_config import ReportingMetaConfig
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class ReportingRichInsightsConfig(BaseModel):
28
- """
29
- ReportingRichInsightsConfig
30
- """ # noqa: E501
31
- content: Optional[ReportingContentConfig] = None
32
- meta: Optional[ReportingMetaConfig] = None
33
- __properties: ClassVar[List[str]] = ["content", "meta"]
34
-
35
- model_config = ConfigDict(
36
- populate_by_name=True,
37
- validate_assignment=True,
38
- protected_namespaces=(),
39
- )
40
-
41
-
42
- def to_str(self) -> str:
43
- """Returns the string representation of the model using alias"""
44
- return pprint.pformat(self.model_dump(by_alias=True))
45
-
46
- def to_json(self) -> str:
47
- """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
-
51
- @classmethod
52
- def from_json(cls, json_str: str) -> Optional[Self]:
53
- """Create an instance of ReportingRichInsightsConfig from a JSON string"""
54
- return cls.from_dict(json.loads(json_str))
55
-
56
- def to_dict(self) -> Dict[str, Any]:
57
- """Return the dictionary representation of the model using alias.
58
-
59
- This has the following differences from calling pydantic's
60
- `self.model_dump(by_alias=True)`:
61
-
62
- * `None` is only added to the output dict for nullable fields that
63
- were set at model initialization. Other fields with value `None`
64
- are ignored.
65
- """
66
- excluded_fields: Set[str] = set([
67
- ])
68
-
69
- _dict = self.model_dump(
70
- by_alias=True,
71
- exclude=excluded_fields,
72
- exclude_none=True,
73
- )
74
- # override the default output from pydantic by calling `to_dict()` of content
75
- if self.content:
76
- _dict['content'] = self.content.to_dict()
77
- # override the default output from pydantic by calling `to_dict()` of meta
78
- if self.meta:
79
- _dict['meta'] = self.meta.to_dict()
80
- return _dict
81
-
82
- @classmethod
83
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
- """Create an instance of ReportingRichInsightsConfig from a dict"""
85
- if obj is None:
86
- return None
87
-
88
- if not isinstance(obj, dict):
89
- return cls.model_validate(obj)
90
-
91
- _obj = cls.model_validate({
92
- "content": ReportingContentConfig.from_dict(obj["content"]) if obj.get("content") is not None else None,
93
- "meta": ReportingMetaConfig.from_dict(obj["meta"]) if obj.get("meta") is not None else None
94
- })
95
- return _obj
96
-
97
-
@@ -1,103 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Neurograph Core
5
-
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
-
8
- The version of the OpenAPI document: 1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from neurograph.v1.models.reporting_chart_data import ReportingChartData
23
- from neurograph.v1.models.reporting_visualization_insights import ReportingVisualizationInsights
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class ReportingVisualization(BaseModel):
28
- """
29
- ReportingVisualization
30
- """ # noqa: E501
31
- data: Optional[ReportingChartData] = None
32
- id: Optional[StrictStr] = None
33
- insights: Optional[ReportingVisualizationInsights] = None
34
- title: Optional[StrictStr] = None
35
- type: Optional[StrictStr] = None
36
- __properties: ClassVar[List[str]] = ["data", "id", "insights", "title", "type"]
37
-
38
- model_config = ConfigDict(
39
- populate_by_name=True,
40
- validate_assignment=True,
41
- protected_namespaces=(),
42
- )
43
-
44
-
45
- def to_str(self) -> str:
46
- """Returns the string representation of the model using alias"""
47
- return pprint.pformat(self.model_dump(by_alias=True))
48
-
49
- def to_json(self) -> str:
50
- """Returns the JSON representation of the model using alias"""
51
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
- return json.dumps(self.to_dict())
53
-
54
- @classmethod
55
- def from_json(cls, json_str: str) -> Optional[Self]:
56
- """Create an instance of ReportingVisualization from a JSON string"""
57
- return cls.from_dict(json.loads(json_str))
58
-
59
- def to_dict(self) -> Dict[str, Any]:
60
- """Return the dictionary representation of the model using alias.
61
-
62
- This has the following differences from calling pydantic's
63
- `self.model_dump(by_alias=True)`:
64
-
65
- * `None` is only added to the output dict for nullable fields that
66
- were set at model initialization. Other fields with value `None`
67
- are ignored.
68
- """
69
- excluded_fields: Set[str] = set([
70
- ])
71
-
72
- _dict = self.model_dump(
73
- by_alias=True,
74
- exclude=excluded_fields,
75
- exclude_none=True,
76
- )
77
- # override the default output from pydantic by calling `to_dict()` of data
78
- if self.data:
79
- _dict['data'] = self.data.to_dict()
80
- # override the default output from pydantic by calling `to_dict()` of insights
81
- if self.insights:
82
- _dict['insights'] = self.insights.to_dict()
83
- return _dict
84
-
85
- @classmethod
86
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
- """Create an instance of ReportingVisualization from a dict"""
88
- if obj is None:
89
- return None
90
-
91
- if not isinstance(obj, dict):
92
- return cls.model_validate(obj)
93
-
94
- _obj = cls.model_validate({
95
- "data": ReportingChartData.from_dict(obj["data"]) if obj.get("data") is not None else None,
96
- "id": obj.get("id"),
97
- "insights": ReportingVisualizationInsights.from_dict(obj["insights"]) if obj.get("insights") is not None else None,
98
- "title": obj.get("title"),
99
- "type": obj.get("type")
100
- })
101
- return _obj
102
-
103
-